mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
plugins advertisement: suggest to restart when only enable is requested
This commit is contained in:
@@ -153,7 +153,7 @@ public class ActionInstallPlugin extends AnAction implements DumbAware {
|
||||
}
|
||||
|
||||
if (needToRestart) {
|
||||
PluginManagerMain.notifyPluginsWereInstalled(list.size() == 1 ? list.get(0).getName() : null);
|
||||
PluginManagerMain.notifyPluginsWereInstalled(list.size() == 1 ? list.get(0).getName() : null, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ import com.intellij.openapi.application.ex.ApplicationManagerEx;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.progress.*;
|
||||
import com.intellij.openapi.project.DumbAwareAction;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.Messages;
|
||||
import com.intellij.openapi.updateSettings.impl.PluginDownloader;
|
||||
import com.intellij.openapi.updateSettings.impl.UpdateChecker;
|
||||
@@ -520,13 +521,13 @@ public abstract class PluginManagerMain implements Disposable {
|
||||
}
|
||||
|
||||
|
||||
public static void notifyPluginsWereInstalled(@Nullable String pluginName) {
|
||||
public static void notifyPluginsWereInstalled(@Nullable String pluginName, final Project project) {
|
||||
notifyPluginsWereUpdated(pluginName != null
|
||||
? "Plugin \'" + pluginName + "\' was successfully installed"
|
||||
: "Plugins were installed");
|
||||
: "Plugins were installed", project);
|
||||
}
|
||||
|
||||
public static void notifyPluginsWereUpdated(final String title) {
|
||||
public static void notifyPluginsWereUpdated(final String title, final Project project) {
|
||||
final ApplicationEx app = ApplicationManagerEx.getApplicationEx();
|
||||
final boolean restartCapable = app.isRestartCapable();
|
||||
String message =
|
||||
@@ -550,7 +551,7 @@ public abstract class PluginManagerMain implements Disposable {
|
||||
app.exit(true);
|
||||
}
|
||||
}
|
||||
}).notify(null);
|
||||
}).notify(project);
|
||||
}
|
||||
|
||||
protected class SortByStatusAction extends ToggleAction {
|
||||
|
||||
+1
-1
@@ -89,7 +89,7 @@ public class PluginAdvertiserEditorNotificationProvider extends EditorNotificati
|
||||
myEnabledExtensions.add(extension);
|
||||
PluginManagerCore.enablePlugin(disabledPlugin.getPluginId().getIdString());
|
||||
myNotifications.updateAllNotifications();
|
||||
PluginManagerMain.notifyPluginsWereUpdated("Plugin was successfully enabled");
|
||||
PluginManagerMain.notifyPluginsWereUpdated("Plugin was successfully enabled", myProject);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
|
||||
+12
-6
@@ -38,12 +38,14 @@ import java.util.Set;
|
||||
public class PluginsAdvertiserDialog extends DialogWrapper {
|
||||
private static final Logger LOG = Logger.getInstance("#" + PluginsAdvertiserDialog.class.getName());
|
||||
|
||||
@Nullable private final Project myProject;
|
||||
private final PluginDownloader[] myUploadedPlugins;
|
||||
private final List<IdeaPluginDescriptor> myAllPlugins;
|
||||
private final HashSet<String> mySkippedPlugins = new HashSet<String>();
|
||||
|
||||
PluginsAdvertiserDialog(@Nullable Project project, PluginDownloader[] plugins, List<IdeaPluginDescriptor> allPlugins) {
|
||||
super(project);
|
||||
myProject = project;
|
||||
myUploadedPlugins = plugins;
|
||||
myAllPlugins = allPlugins;
|
||||
setTitle("Choose Plugins to Install or Enable");
|
||||
@@ -84,13 +86,14 @@ public class PluginsAdvertiserDialog extends DialogWrapper {
|
||||
}
|
||||
}
|
||||
}
|
||||
final Runnable notifyRunnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
PluginManagerMain.notifyPluginsWereInstalled(null, myProject);
|
||||
}
|
||||
};
|
||||
try {
|
||||
PluginManagerMain.downloadPlugins(nodes, myAllPlugins, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
PluginManagerMain.notifyPluginsWereInstalled(null);
|
||||
}
|
||||
}, null);
|
||||
PluginManagerMain.downloadPlugins(nodes, myAllPlugins, notifyRunnable, null);
|
||||
}
|
||||
catch (IOException e) {
|
||||
LOG.error(e);
|
||||
@@ -98,6 +101,9 @@ public class PluginsAdvertiserDialog extends DialogWrapper {
|
||||
for (IdeaPluginDescriptor pluginDescriptor : pluginsToEnable) {
|
||||
PluginManagerCore.enablePlugin(pluginDescriptor.getPluginId().getIdString());
|
||||
}
|
||||
if (nodes.isEmpty()) {
|
||||
notifyRunnable.run();
|
||||
}
|
||||
super.doOKAction();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user