mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
plugin manager: on plugin download show modal progress with ability to send it to the background (IDEA-86885)
This commit is contained in:
@@ -26,10 +26,7 @@ import com.intellij.openapi.actionSystem.*;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.PathManager;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.progress.ProcessCanceledException;
|
||||
import com.intellij.openapi.progress.ProgressIndicator;
|
||||
import com.intellij.openapi.progress.ProgressManager;
|
||||
import com.intellij.openapi.progress.Task;
|
||||
import com.intellij.openapi.progress.*;
|
||||
import com.intellij.openapi.project.DumbAwareAction;
|
||||
import com.intellij.openapi.ui.Messages;
|
||||
import com.intellij.openapi.updateSettings.impl.PluginDownloader;
|
||||
@@ -300,7 +297,7 @@ public abstract class PluginManagerMain implements Disposable {
|
||||
final Runnable cleanup) throws IOException {
|
||||
final boolean[] result = new boolean[1];
|
||||
try {
|
||||
ProgressManager.getInstance().run(new Task.Backgroundable(null, IdeBundle.message("progress.download.plugins"), true) {
|
||||
ProgressManager.getInstance().run(new Task.Backgroundable(null, IdeBundle.message("progress.download.plugins"), true, PluginManagerUISettings.getInstance()) {
|
||||
@Override
|
||||
public void run(@NotNull ProgressIndicator indicator) {
|
||||
try {
|
||||
|
||||
@@ -18,6 +18,7 @@ package com.intellij.ide.plugins;
|
||||
import com.intellij.ide.ui.SplitterProportionsDataImpl;
|
||||
import com.intellij.openapi.components.*;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.progress.PerformInBackgroundOption;
|
||||
import com.intellij.openapi.ui.SplitterProportionsData;
|
||||
import com.intellij.openapi.util.DefaultJDOMExternalizer;
|
||||
import com.intellij.openapi.util.InvalidDataException;
|
||||
@@ -38,7 +39,7 @@ import javax.swing.*;
|
||||
file = StoragePathMacros.APP_CONFIG + "/plugin_ui.xml")
|
||||
}
|
||||
)
|
||||
public class PluginManagerUISettings implements PersistentStateComponent<Element> {
|
||||
public class PluginManagerUISettings implements PersistentStateComponent<Element>, PerformInBackgroundOption {
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.ide.plugins.PluginManagerUISettings");
|
||||
|
||||
public int AVAILABLE_SORT_COLUMN_ORDER = SortOrder.ASCENDING.ordinal();
|
||||
@@ -46,6 +47,7 @@ public class PluginManagerUISettings implements PersistentStateComponent<Element
|
||||
public int AVAILABLE_SORT_MODE = 0;
|
||||
public boolean AVAILABLE_SORT_BY_STATUS = false;
|
||||
public boolean INSTALLED_SORT_BY_STATUS = false;
|
||||
public boolean UPDATE_IN_BACKGROUND = false;
|
||||
public JDOMExternalizableStringList myOutdatedPlugins = new JDOMExternalizableStringList();
|
||||
|
||||
private JDOMExternalizableStringList myInstalledPlugins = new JDOMExternalizableStringList();
|
||||
@@ -100,4 +102,14 @@ public class PluginManagerUISettings implements PersistentStateComponent<Element
|
||||
public SplitterProportionsData getAvailableSplitterProportionsData() {
|
||||
return myAvailableSplitterProportionsData;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldStartInBackground() {
|
||||
return UPDATE_IN_BACKGROUND;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processSentToBackground() {
|
||||
UPDATE_IN_BACKGROUND = true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user