List of usage examples for com.intellij.openapi.ui Messages getQuestionIcon
@NotNull public static Icon getQuestionIcon()
From source file:com.intellij.ide.impl.ProjectUtil.java
License:Apache License
/** * @return {@link com.intellij.ide.GeneralSettings#OPEN_PROJECT_SAME_WINDOW} * {@link com.intellij.ide.GeneralSettings#OPEN_PROJECT_NEW_WINDOW} * {@link com.intellij.openapi.ui.Messages#CANCEL} - if user canceled the dialog * @param isNewProject//from w ww . java 2 s . co m */ public static int confirmOpenNewProject(boolean isNewProject) { final GeneralSettings settings = GeneralSettings.getInstance(); int confirmOpenNewProject = settings.getConfirmOpenNewProject(); if (confirmOpenNewProject == GeneralSettings.OPEN_PROJECT_ASK) { if (isNewProject) { int exitCode = Messages.showYesNoDialog(IdeBundle.message("prompt.open.project.in.new.frame"), IdeBundle.message("title.new.project"), IdeBundle.message("button.existingframe"), IdeBundle.message("button.newframe"), Messages.getQuestionIcon(), new ProjectNewWindowDoNotAskOption()); return exitCode == 0 ? GeneralSettings.OPEN_PROJECT_SAME_WINDOW : GeneralSettings.OPEN_PROJECT_NEW_WINDOW; } else { int exitCode = Messages.showYesNoCancelDialog(IdeBundle.message("prompt.open.project.in.new.frame"), IdeBundle.message("title.open.project"), IdeBundle.message("button.existingframe"), IdeBundle.message("button.newframe"), CommonBundle.getCancelButtonText(), Messages.getQuestionIcon(), new ProjectNewWindowDoNotAskOption()); return exitCode == 0 ? GeneralSettings.OPEN_PROJECT_SAME_WINDOW : exitCode == 1 ? GeneralSettings.OPEN_PROJECT_NEW_WINDOW : Messages.CANCEL; } } return confirmOpenNewProject; }
From source file:com.intellij.ide.macro.PromptMacro.java
License:Apache License
@Override @Nullable//from ww w .j a v a2 s . com protected String promptUser(DataContext dataContext) { return Messages.showInputDialog(IdeBundle.message("prompt.enter.parameters"), IdeBundle.message("title.input"), Messages.getQuestionIcon()); }
From source file:com.intellij.ide.plugins.ActionInstallPlugin.java
License:Apache License
private static boolean suggestToEnableInstalledPlugins(final InstalledPluginsTableModel pluginsModel, final Set<IdeaPluginDescriptor> disabled, final Set<IdeaPluginDescriptor> disabledDependants, final ArrayList<PluginNode> list) { if (!disabled.isEmpty() || !disabledDependants.isEmpty()) { String message = ""; if (disabled.size() == 1) { message += "Updated plugin '" + disabled.iterator().next().getName() + "' is disabled."; } else if (!disabled.isEmpty()) { message += "Updated plugins " + StringUtil.join(disabled, new Function<IdeaPluginDescriptor, String>() { @Override public String fun(IdeaPluginDescriptor pluginDescriptor) { return pluginDescriptor.getName(); }// w w w . j av a 2s . c o m }, ", ") + " are disabled."; } if (!disabledDependants.isEmpty()) { message += "<br>"; message += "Updated plugin" + (list.size() > 1 ? "s depend " : " depends ") + "on disabled"; if (disabledDependants.size() == 1) { message += " plugin '" + disabledDependants.iterator().next().getName() + "'."; } else { message += " plugins " + StringUtil.join(disabledDependants, new Function<IdeaPluginDescriptor, String>() { @Override public String fun(IdeaPluginDescriptor pluginDescriptor) { return pluginDescriptor.getName(); } }, ", ") + "."; } } message += " Disabled plugins and plugins which depends on disabled plugins won't be activated after restart."; int result; if (!disabled.isEmpty() && !disabledDependants.isEmpty()) { result = Messages.showYesNoCancelDialog(XmlStringUtil.wrapInHtml(message), CommonBundle.getWarningTitle(), "Enable all", "Enable updated plugin" + (disabled.size() > 1 ? "s" : ""), CommonBundle.getCancelButtonText(), Messages.getQuestionIcon()); if (result == Messages.CANCEL) return false; } else { message += "<br>Would you like to enable "; if (!disabled.isEmpty()) { message += "updated plugin" + (disabled.size() > 1 ? "s" : ""); } else { //noinspection SpellCheckingInspection message += "plugin dependenc" + (disabledDependants.size() > 1 ? "ies" : "y"); } message += "?</body></html>"; result = Messages.showYesNoDialog(message, CommonBundle.getWarningTitle(), Messages.getQuestionIcon()); if (result == Messages.NO) return false; } if (result == Messages.YES) { disabled.addAll(disabledDependants); pluginsModel.enableRows(disabled.toArray(new IdeaPluginDescriptor[disabled.size()]), true); } else if (result == Messages.NO && !disabled.isEmpty()) { pluginsModel.enableRows(disabled.toArray(new IdeaPluginDescriptor[disabled.size()]), true); } return true; } return false; }
From source file:com.intellij.ide.plugins.ActionInstallPlugin.java
License:Apache License
private boolean userConfirm(IdeaPluginDescriptor[] selection) { String message;/* w ww . jav a 2 s . com*/ if (selection.length == 1) { if (selection[0] instanceof IdeaPluginDescriptorImpl) { message = IdeBundle.message("prompt.update.plugin", selection[0].getName()); } else { message = IdeBundle.message("prompt.download.and.install.plugin", selection[0].getName()); } } else { message = IdeBundle.message("prompt.install.several.plugins", selection.length); } return Messages.showYesNoDialog(host.getMainPanel(), message, IdeBundle.message("action.download.and.install.plugin"), Messages.getQuestionIcon()) == Messages.YES; }
From source file:com.intellij.ide.plugins.InstalledPluginsTableModel.java
License:Apache License
private void warnAboutMissedDependencies(final Boolean newVal, final IdeaPluginDescriptor... ideaPluginDescriptors) { final Set<PluginId> deps = new HashSet<PluginId>(); final List<IdeaPluginDescriptor> descriptorsToCheckDependencies = new ArrayList<IdeaPluginDescriptor>(); if (newVal) { Collections.addAll(descriptorsToCheckDependencies, ideaPluginDescriptors); } else {//w w w . j av a 2 s . co m descriptorsToCheckDependencies.addAll(getAllPlugins()); descriptorsToCheckDependencies.removeAll(Arrays.asList(ideaPluginDescriptors)); for (Iterator<IdeaPluginDescriptor> iterator = descriptorsToCheckDependencies.iterator(); iterator .hasNext();) { IdeaPluginDescriptor descriptor = iterator.next(); final Boolean enabled = myEnabled.get(descriptor.getPluginId()); if (enabled == null || !enabled.booleanValue()) { iterator.remove(); } } } for (final IdeaPluginDescriptor ideaPluginDescriptor : descriptorsToCheckDependencies) { PluginManager.checkDependants(ideaPluginDescriptor, new Function<PluginId, IdeaPluginDescriptor>() { @Override @Nullable public IdeaPluginDescriptor fun(final PluginId pluginId) { return PluginManager.getPlugin(pluginId); } }, new Condition<PluginId>() { @Override public boolean value(final PluginId pluginId) { Boolean enabled = myEnabled.get(pluginId); if (enabled == null) { return false; } if (newVal && !enabled.booleanValue()) { deps.add(pluginId); } if (!newVal) { if (ideaPluginDescriptor instanceof IdeaPluginDescriptorImpl && ((IdeaPluginDescriptorImpl) ideaPluginDescriptor).isDeleted()) return true; final PluginId pluginDescriptorId = ideaPluginDescriptor.getPluginId(); for (IdeaPluginDescriptor descriptor : ideaPluginDescriptors) { if (pluginId.equals(descriptor.getPluginId())) { deps.add(pluginDescriptorId); break; } } } return true; } }); } if (!deps.isEmpty()) { final String listOfSelectedPlugins = StringUtil.join(ideaPluginDescriptors, new Function<IdeaPluginDescriptor, String>() { @Override public String fun(IdeaPluginDescriptor pluginDescriptor) { return pluginDescriptor.getName(); } }, ", "); final Set<IdeaPluginDescriptor> pluginDependencies = new HashSet<IdeaPluginDescriptor>(); final String listOfDependencies = StringUtil.join(deps, new Function<PluginId, String>() { @Override public String fun(final PluginId pluginId) { final IdeaPluginDescriptor pluginDescriptor = PluginManager.getPlugin(pluginId); assert pluginDescriptor != null; pluginDependencies.add(pluginDescriptor); return pluginDescriptor.getName(); } }, "<br>"); final String message = !newVal ? "<html>The following plugins <br>" + listOfDependencies + "<br>are enabled and depend" + (deps.size() == 1 ? "s" : "") + " on selected plugins. " + "<br>Would you like to disable them too?</html>" : "<html>The following plugins on which " + listOfSelectedPlugins + " depend" + (ideaPluginDescriptors.length == 1 ? "s" : "") + " are disabled:<br>" + listOfDependencies + "<br>Would you like to enable them?</html>"; if (Messages.showOkCancelDialog(message, newVal ? "Enable Dependant Plugins" : "Disable Plugins with Dependency on this", Messages.getQuestionIcon()) == Messages.OK) { for (PluginId pluginId : deps) { myEnabled.put(pluginId, newVal); } updatePluginDependencies(); hideNotApplicablePlugins(newVal, pluginDependencies.toArray(new IdeaPluginDescriptor[pluginDependencies.size()])); } } }
From source file:com.intellij.ide.plugins.PluginManagerConfigurable.java
License:Apache License
@Messages.YesNoResult private static int showShutDownIDEADialog(final String title) { String message = IdeBundle.message("message.idea.shutdown.required", ApplicationNamesInfo.getInstance().getFullProductName()); return Messages.showYesNoDialog(message, title, "Shut Down", POSTPONE, Messages.getQuestionIcon()); }
From source file:com.intellij.ide.plugins.PluginManagerConfigurable.java
License:Apache License
@Messages.YesNoResult private static int showRestartIDEADialog(final String title) { String message = IdeBundle.message("message.idea.restart.required", ApplicationNamesInfo.getInstance().getFullProductName()); return Messages.showYesNoDialog(message, title, "Restart", POSTPONE, Messages.getQuestionIcon()); }
From source file:com.intellij.ide.plugins.UninstallPluginAction.java
License:Apache License
public static void uninstall(PluginManagerMain host, IdeaPluginDescriptor... selection) { String message;/* www . j a v a2 s. co m*/ if (selection.length == 1) { message = IdeBundle.message("prompt.uninstall.plugin", selection[0].getName()); } else { message = IdeBundle.message("prompt.uninstall.several.plugins", selection.length); } if (Messages.showYesNoDialog(host.getMainPanel(), message, IdeBundle.message("title.plugin.uninstall"), Messages.getQuestionIcon()) != Messages.YES) return; for (IdeaPluginDescriptor descriptor : selection) { IdeaPluginDescriptorImpl pluginDescriptor = (IdeaPluginDescriptorImpl) descriptor; boolean actualDelete = true; // Get the list of plugins which depend on this one. If this list is // not empty - issue warning instead of simple prompt. ArrayList<IdeaPluginDescriptorImpl> dependant = host.getDependentList(pluginDescriptor); if (dependant.size() > 0) { message = IdeBundle.message("several.plugins.depend.on.0.continue.to.remove", pluginDescriptor.getName()); actualDelete = (Messages.showYesNoDialog(host.getMainPanel(), message, IdeBundle.message("title.plugin.uninstall"), Messages.getQuestionIcon()) == Messages.YES); } if (actualDelete) { uninstallPlugin(pluginDescriptor, host); } } }
From source file:com.intellij.ide.projectView.actions.MoveModulesToSubGroupAction.java
License:Apache License
@Override public void actionPerformed(AnActionEvent e) { final DataContext dataContext = e.getDataContext(); final Module[] modules = LangDataKeys.MODULE_CONTEXT_ARRAY.getData(dataContext); final String[] newGroup; if (myModuleGroup != null) { String message = IdeBundle.message("prompt.specify.name.of.module.subgroup", myModuleGroup.presentableText(), whatToMove(modules)); String subgroup = Messages.showInputDialog(message, IdeBundle.message("title.module.sub.group"), Messages.getQuestionIcon()); if (subgroup == null || "".equals(subgroup.trim())) return; newGroup = ArrayUtil.append(myModuleGroup.getGroupPath(), subgroup); } else {/* www . j a va2s .co m*/ String message = IdeBundle.message("prompt.specify.module.group.name", whatToMove(modules)); String group = Messages.showInputDialog(message, IdeBundle.message("title.module.group"), Messages.getQuestionIcon()); if (group == null || "".equals(group.trim())) return; newGroup = new String[] { group }; } doMove(modules, new ModuleGroup(newGroup), dataContext); }
From source file:com.intellij.ide.projectView.impl.RenameModuleHandler.java
License:Apache License
@Override public void invoke(@NotNull final Project project, @NotNull PsiElement[] elements, @NotNull DataContext dataContext) { final Module module = LangDataKeys.MODULE_CONTEXT.getData(dataContext); LOG.assertTrue(module != null);/*from ww w .ja v a2 s . co m*/ Messages.showInputDialog(project, IdeBundle.message("prompt.enter.new.module.name"), IdeBundle.message("title.rename.module"), Messages.getQuestionIcon(), module.getName(), new MyInputValidator(project, module)); }