List of usage examples for com.intellij.openapi.ui Messages NO
int NO
To view the source code for com.intellij.openapi.ui Messages NO.
Click Source Link
From source file:be.wimsymons.intellij.polopolyimport.PPImportAction.java
License:Apache License
public void actionPerformed(AnActionEvent e) { VirtualFile[] virtualFiles = e.getData(LangDataKeys.VIRTUAL_FILE_ARRAY); if (target.isConfirm()) { int answer = Messages.showYesNoDialog( "Are you sure to import the selected files into " + target.getProfile() + "?", "Confirm Polopoly Import", Messages.getWarningIcon()); if (answer == Messages.NO) { PPImportPlugin.doNotify("Import cancelled upon confirmation.", NotificationType.INFORMATION); return; }// www .j av a 2 s .c om } ProgressManager.getInstance().run(new ImportTask(virtualFiles, this.target, this.includeExtensions, this.replacements, this.uploadMultipleFilesAsJar)); }
From source file:com.android.tools.idea.fd.actions.SubmitFeedback.java
License:Apache License
@Override public void actionPerformed(AnActionEvent e) { Project project = e.getProject();// w w w .j a va 2 s . c o m if (project == null) { Logger.getInstance(SubmitFeedback.class).info("Unable to identify current project"); return; } if (!InstantRunSettings.isInstantRunEnabled() || !InstantRunSettings.isRecorderEnabled()) { int result = Messages.showYesNoDialog(project, AndroidBundle.message("instant.run.flr.would.you.like.to.enable"), AndroidBundle.message("instant.run.flr.dialog.title"), "Yes, I'd like to help", "Cancel", Messages.getQuestionIcon()); if (result == Messages.NO) { return; } InstantRunSettings.setInstantRunEnabled(true); InstantRunSettings.setRecorderEnabled(true); Messages.showInfoMessage(project, AndroidBundle.message("instant.run.flr.howto"), AndroidBundle.message("instant.run.flr.dialog.title")); return; } InstantRunFeedbackDialog dialog = new InstantRunFeedbackDialog(project); boolean ok = dialog.showAndGet(); if (ok) { new Task.Backgroundable(project, "Submitting Instant Run Issue") { public CompletableFuture<String> myReport; @Override public void run(@NotNull ProgressIndicator indicator) { myReport = GoogleCrash.getInstance().submit(FlightRecorder.get(project), dialog.getIssueText(), dialog.getLogs()); while (!myReport.isDone()) { try { myReport.get(200, TimeUnit.MILLISECONDS); } catch (Exception ignored) { } if (indicator.isCanceled()) { return; } } } @Override public void onSuccess() { if (myReport.isDone()) { String reportId; try { reportId = myReport.getNow("00"); } catch (CancellationException e) { Logger.getInstance(SubmitFeedback.class) .info("Submission of flight recorder logs cancelled"); return; } catch (CompletionException e) { FLR_NOTIFICATION_GROUP.createNotification( "Unexpected error while submitting instant run logs: " + e.getMessage(), NotificationType.ERROR); Logger.getInstance(SubmitFeedback.class).info(e); return; } String message = String.format("<html>Thank you for submitting the bug report.<br>" + "If you would like to follow up on this report, please file a bug at <a href=\"bug\">b.android.com</a> and specify the report id '%1$s'<html>", reportId); FLR_NOTIFICATION_GROUP.createNotification("", message, NotificationType.INFORMATION, (notification, event) -> { Escaper escaper = UrlEscapers.urlFormParameterEscaper(); String comment = String.format("Build: %1$s\nInstant Run Report: %2$s", ApplicationInfo.getInstance().getFullVersion(), reportId); String url = String.format( "https://code.google.com/p/android/issues/entry?template=%1$s&comment=%2$s&status=New", escaper.escape("Android Studio Instant Run Bug"), escaper.escape(comment)); BrowserUtil.browse(url); }).notify(project); } } }.queue(); } }
From source file:com.android.tools.idea.gradle.dependencies.GradleDependencyManagerTest.java
License:Apache License
public void testDependencyCanBeCancelledByUser() throws Exception { loadSimpleApplication();//w w w . j a v a 2 s .c o m List<GradleCoordinate> dependencies = Collections.singletonList(RECYCLER_VIEW_DEPENDENCY); GradleDependencyManager dependencyManager = GradleDependencyManager.getInstance(getProject()); assertThat(dependencyManager.findMissingDependencies(myModules.getAppModule(), dependencies)).isNotEmpty(); Messages.setTestDialog(new TestMessagesDialog(Messages.NO)); boolean found = dependencyManager.ensureLibraryIsIncluded(myModules.getAppModule(), dependencies, null); assertThat(found).isFalse(); assertThat(dependencyManager.findMissingDependencies(myModules.getAppModule(), dependencies)).isNotEmpty(); }
From source file:com.android.tools.idea.run.AndroidRunConfigurationBase.java
License:Apache License
private boolean promptAndKillSession(@NotNull Executor executor, Project project, AndroidSessionInfo info) { String previousExecutor = info.getExecutorId(); String currentExecutor = executor.getId(); if (ourKillLaunchOption.isToBeShown()) { String msg, noText;// ww w . j av a2s .co m if (previousExecutor.equals(currentExecutor)) { msg = String.format( "Restart App?\nThe app is already running. Would you like to kill it and restart the session?"); noText = "Cancel"; } else { msg = String.format("To switch from %1$s to %2$s, the app has to restart. Continue?", previousExecutor, currentExecutor); noText = "Cancel " + currentExecutor; } String title = "Launching " + getName(); String yesText = "Restart " + getName(); if (Messages.NO == Messages.showYesNoDialog(project, msg, title, yesText, noText, AllIcons.General.QuestionDialog, ourKillLaunchOption)) { return false; } } LOG.info("Disconnecting existing session of the same launch configuration"); killSession(info); return true; }
From source file:com.android.tools.idea.uibuilder.handlers.ViewEditorImpl.java
License:Apache License
@Override public void copyVectorAssetToMainModuleSourceSet(@NotNull String asset) { Project project = myScreen.getModel().getProject(); String message = "Do you want to copy vector asset " + asset + " to your main module source set?"; if (Messages.showYesNoDialog(project, message, "Copy Vector Asset", Messages.getQuestionIcon()) == Messages.NO) { return;/*from w w w . ja v a 2 s . co m*/ } try (InputStream in = GraphicGenerator.class.getClassLoader() .getResourceAsStream(MaterialDesignIcons.getPathForBasename(asset))) { createResourceFile(FD_RES_DRAWABLE, asset + DOT_XML, ByteStreams.toByteArray(in)); } catch (IOException exception) { Logger.getInstance(ViewEditorImpl.class).warn(exception); } }
From source file:com.android.tools.idea.uibuilder.handlers.ViewEditorImpl.java
License:Apache License
@Override public void copyLayoutToMainModuleSourceSet(@NotNull String layout, @Language("XML") @NotNull String xml) { String message = "Do you want to copy layout " + layout + " to your main module source set?"; if (Messages.showYesNoDialog(myScreen.getModel().getProject(), message, "Copy Layout", Messages.getQuestionIcon()) == Messages.NO) { return;//w w w . j a va 2s .co m } createResourceFile(FD_RES_LAYOUT, layout + DOT_XML, xml.getBytes(StandardCharsets.UTF_8)); }
From source file:com.eugenePetrenko.idea.dependencies.actions.OnModuleAction.java
License:Apache License
@Nullable private AnalyzeStrategy decideStrategy(@NotNull final Project project, @NotNull final Module[] modules) { boolean suggestExpand = modules.length != WITH_EXPORT_DEPENDENCIES.collectAllModules(project, modules).length;// www . ja va 2 s . c om if (!suggestExpand) return WITH_EXPORT_DEPENDENCIES; int result = Messages.showYesNoCancelDialog(project, "There are some modules with exported dependencies.\n" + "It's required to include more modules to the list " + "in order to analyze exported dependencies.\n\n" + "Do you like to include more modules?", "Unused Dependencies", "Include Modules", "Skip Exports", "Cancel", null); switch (result) { case Messages.YES: return WITH_EXPORT_DEPENDENCIES; case Messages.NO: return SKIP_EXPORT_DEPENDENCIES; default: return null; } }
From source file:com.goide.actions.tool.GoFmtCheckinFactory.java
License:Apache License
@Override @Nullable/*from w ww .j av a 2 s .com*/ public CheckinHandler createHandler(@Nonnull CheckinProjectPanel panel, @Nonnull CommitContext commitContext) { if (!ModuleExtensionHelper.getInstance(panel.getProject()).hasModuleExtension(GoModuleExtension.class)) { return null; } return new CheckinHandler() { @Override public RefreshableOnComponent getBeforeCheckinConfigurationPanel() { JCheckBox checkBox = new JCheckBox("Go fmt"); return new RefreshableOnComponent() { @Override @Nonnull public JComponent getComponent() { JPanel panel = new JPanel(new BorderLayout()); panel.add(checkBox, BorderLayout.WEST); return panel; } @Override public void refresh() { } @Override public void saveState() { PropertiesComponent.getInstance(panel.getProject()).setValue(GO_FMT, Boolean.toString(checkBox.isSelected())); } @Override public void restoreState() { checkBox.setSelected(enabled(panel)); } }; } @Override public ReturnResult beforeCheckin(@Nullable CommitExecutor executor, PairConsumer<Object, Object> additionalDataConsumer) { if (enabled(panel)) { Ref<Boolean> success = Ref.create(true); FileDocumentManager.getInstance().saveAllDocuments(); for (PsiFile file : getPsiFiles()) { VirtualFile virtualFile = file.getVirtualFile(); new GoFmtFileAction().doSomething(virtualFile, ModuleUtilCore.findModuleForPsiElement(file), file.getProject(), "Go fmt", true, result -> { if (!result) success.set(false); }); } if (!success.get()) { return showErrorMessage(executor); } } return super.beforeCheckin(); } @Nonnull private ReturnResult showErrorMessage(@Nullable CommitExecutor executor) { String[] buttons = new String[] { "&Details...", commitButtonMessage(executor, panel), CommonBundle.getCancelButtonText() }; int answer = Messages.showDialog(panel.getProject(), "<html><body>GoFmt returned non-zero code on some of the files.<br/>" + "Would you like to commit anyway?</body></html>\n", "Go Fmt", null, buttons, 0, 1, UIUtil.getWarningIcon()); if (answer == Messages.OK) { return ReturnResult.CLOSE_WINDOW; } if (answer == Messages.NO) { return ReturnResult.COMMIT; } return ReturnResult.CANCEL; } @Nonnull private List<PsiFile> getPsiFiles() { Collection<VirtualFile> files = panel.getVirtualFiles(); List<PsiFile> psiFiles = ContainerUtil.newArrayList(); PsiManager manager = PsiManager.getInstance(panel.getProject()); for (VirtualFile file : files) { PsiFile psiFile = manager.findFile(file); if (psiFile instanceof GoFile) { psiFiles.add(psiFile); } } return psiFiles; } }; }
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(); }//from w w w . j a va 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.lang.javascript.uml.FlashUmlDataModel.java
License:Apache License
@Override @Nullable// w ww . j a va 2 s . c o m public DiagramEdge<Object> createEdge(@NotNull final DiagramNode<Object> from, @NotNull final DiagramNode<Object> to) { final JSClass fromClass = (JSClass) from.getIdentifyingElement(); final JSClass toClass = (JSClass) to.getIdentifyingElement(); if (fromClass.isEquivalentTo(toClass)) { return null; } if (toClass.isInterface()) { if (JSPsiImplUtils.containsEquivalent( fromClass.isInterface() ? fromClass.getSuperClasses() : fromClass.getImplementedInterfaces(), toClass)) { return null; } Callable<DiagramEdge<Object>> callable = () -> { String targetQName = toClass.getQualifiedName(); JSRefactoringUtil.addToSupersList(fromClass, targetQName, true); if (targetQName.contains(".") && !(fromClass instanceof XmlBackedJSClassImpl)) { List<FormatFixer> formatters = new ArrayList<>(); formatters.add( ImportUtils.insertImportStatements(fromClass, Collections.singletonList(targetQName))); formatters.addAll(ECMAScriptImportOptimizer.executeNoFormat(fromClass.getContainingFile())); FormatFixer.fixAll(formatters); } return addEdgeAndRefresh(from, to, fromClass.isInterface() ? FlashUmlRelationship.GENERALIZATION : FlashUmlRelationship.INTERFACE_GENERALIZATION); }; String commandName = FlexBundle.message( fromClass.isInterface() ? "create.extends.relationship.command.name" : "create.implements.relationship.command.name", fromClass.getQualifiedName(), toClass.getQualifiedName()); return DiagramAction.performCommand(getBuilder(), callable, commandName, null, fromClass.getContainingFile()); } else { if (fromClass.isInterface()) { return null; } else if (fromClass instanceof XmlBackedJSClassImpl) { JSClass[] superClasses = fromClass.getSuperClasses(); if (JSPsiImplUtils.containsEquivalent(superClasses, toClass)) { return null; } if (superClasses.length > 0) { // if base component is not resolved, replace it silently final JSClass currentParent = superClasses[0]; if (Messages.showYesNoDialog( FlexBundle.message("replace.base.component.prompt", currentParent.getQualifiedName(), toClass.getQualifiedName()), FlexBundle.message("create.edge.title"), Messages.getQuestionIcon()) == Messages.NO) { return null; } } Callable<DiagramEdge<Object>> callable = () -> { NewFlexComponentAction.setParentComponent((MxmlJSClass) fromClass, toClass.getQualifiedName()); return addEdgeAndRefresh(from, to, DiagramRelationships.GENERALIZATION); }; String commandName = FlexBundle.message("create.extends.relationship.command.name", fromClass.getQualifiedName(), toClass.getQualifiedName()); return DiagramAction.performCommand(getBuilder(), callable, commandName, null, fromClass.getContainingFile()); } else { final JSClass[] superClasses = fromClass.getSuperClasses(); if (JSPsiImplUtils.containsEquivalent(superClasses, toClass)) { return null; } if (superClasses.length > 0 && !JSResolveUtil.isObjectClass(superClasses[0])) { // if base class is not resolved, replace it silently final JSClass currentParent = superClasses[0]; if (Messages.showYesNoDialog( FlexBundle.message("replace.base.class.prompt", currentParent.getQualifiedName(), toClass.getQualifiedName()), FlexBundle.message("create.edge.title"), Messages.getQuestionIcon()) == Messages.NO) { return null; } } Callable<DiagramEdge<Object>> callable = () -> { List<FormatFixer> formatters = new ArrayList<>(); boolean optimize = false; if (superClasses.length > 0 && !JSResolveUtil.isObjectClass(superClasses[0])) { JSRefactoringUtil.removeFromReferenceList(fromClass.getExtendsList(), superClasses[0], formatters); optimize = needsImport(fromClass, superClasses[0]); } JSRefactoringUtil.addToSupersList(fromClass, toClass.getQualifiedName(), false); if (needsImport(fromClass, toClass)) { formatters.add(ImportUtils.insertImportStatements(fromClass, Collections.singletonList(toClass.getQualifiedName()))); optimize = true; } if (optimize) { formatters.addAll(ECMAScriptImportOptimizer.executeNoFormat(fromClass.getContainingFile())); } FormatFixer.fixAll(formatters); return addEdgeAndRefresh(from, to, DiagramRelationships.GENERALIZATION); }; String commandName = FlexBundle.message("create.extends.relationship.command.name", fromClass.getQualifiedName(), toClass.getQualifiedName()); return DiagramAction.performCommand(getBuilder(), callable, commandName, null, fromClass.getContainingFile()); } } }