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:com.intellij.platform.NewDirectoryProjectAction.java
License:Apache License
@Nullable protected Project generateProject(Project project, @NotNull final NewProjectOrModuleDialog dialog) { final File location = new File(dialog.getLocationText()); final int childCount = location.exists() ? location.list().length : 0; if (!location.exists() && !location.mkdirs()) { Messages.showErrorDialog(project, "Cannot create directory '" + location + "'", "Create Project"); return null; }/* w w w. j a v a 2 s . c o m*/ final VirtualFile baseDir = ApplicationManager.getApplication() .runWriteAction(new Computable<VirtualFile>() { @Override public VirtualFile compute() { return LocalFileSystem.getInstance().refreshAndFindFileByIoFile(location); } }); baseDir.refresh(false, true); if (childCount > 0) { int rc = Messages.showYesNoDialog(project, "The directory '" + location + "' is not empty. Continue?", "Create New Project", Messages.getQuestionIcon()); if (rc == Messages.NO) { return null; } } GeneralSettings.getInstance().setLastProjectCreationLocation(location.getParent()); return PlatformProjectOpenProcessor.doOpenProject(baseDir, null, false, -1, new Consumer<Project>() { @Override public void consume(final Project project) { dialog.doCreate(project, baseDir); } }); }
From source file:com.intellij.plugins.haxe.ide.refactoring.memberPushDown.PushDownProcessor.java
License:Apache License
@Override protected boolean preprocessUsages(final Ref<UsageInfo[]> refUsages) { final UsageInfo[] usagesIn = refUsages.get(); final PushDownConflicts pushDownConflicts = new PushDownConflicts(myClass, myMemberInfos); pushDownConflicts.checkSourceClassConflicts(); if (usagesIn.length == 0) { if (myClass.isEnum() || myClass.hasModifierProperty(PsiModifier.FINAL)) { if (Messages.showOkCancelDialog( (myClass.isEnum()//from w ww .j a v a 2s . co m ? "Enum " + myClass.getQualifiedName() + " doesn't have constants to inline to. " : "Final class " + myClass.getQualifiedName() + "does not have inheritors. ") + "Pushing members down will result in them being deleted. " + "Would you like to proceed?", JavaPushDownHandler.REFACTORING_NAME, Messages.getWarningIcon()) != Messages.OK) { return false; } } else { String noInheritors = myClass.isInterface() ? RefactoringBundle.message("interface.0.does.not.have.inheritors", myClass.getQualifiedName()) : RefactoringBundle.message("class.0.does.not.have.inheritors", myClass.getQualifiedName()); final String message = noInheritors + "\n" + RefactoringBundle.message("push.down.will.delete.members"); final int answer = Messages.showYesNoCancelDialog(message, JavaPushDownHandler.REFACTORING_NAME, Messages.getWarningIcon()); if (answer == Messages.YES) { myCreateClassDlg = CreateSubclassAction.chooseSubclassToCreate(myClass); if (myCreateClassDlg != null) { pushDownConflicts.checkTargetClassConflicts(null, false, myCreateClassDlg.getTargetDirectory()); return showConflicts(pushDownConflicts.getConflicts(), usagesIn); } else { return false; } } else if (answer != Messages.NO) return false; } } Runnable runnable = new Runnable() { @Override public void run() { ApplicationManager.getApplication().runReadAction(new Runnable() { @Override public void run() { for (UsageInfo usage : usagesIn) { final PsiElement element = usage.getElement(); if (element instanceof PsiClass) { pushDownConflicts.checkTargetClassConflicts((PsiClass) element, usagesIn.length > 1, element); } } } }); } }; if (!ProgressManager.getInstance().runProcessWithProgressSynchronously(runnable, RefactoringBundle.message("detecting.possible.conflicts"), true, myProject)) { return false; } for (UsageInfo info : usagesIn) { final PsiElement element = info.getElement(); if (element instanceof PsiFunctionalExpression) { pushDownConflicts.getConflicts().putValue(element, RefactoringBundle.message("functional.interface.broken")); } } final PsiAnnotation annotation = AnnotationUtil.findAnnotation(myClass, CommonClassNames.JAVA_LANG_FUNCTIONAL_INTERFACE); if (annotation != null && isMoved(LambdaUtil.getFunctionalInterfaceMethod(myClass))) { pushDownConflicts.getConflicts().putValue(annotation, RefactoringBundle.message("functional.interface.broken")); } return showConflicts(pushDownConflicts.getConflicts(), usagesIn); }
From source file:com.intellij.ui.mac.MacMessagesImpl.java
License:Apache License
@Override @Messages.YesNoResult/* w w w. java 2s .c o m*/ public int showYesNoDialog(@NotNull String title, String message, @NotNull String yesButton, @NotNull String noButton, @Nullable Window window) { return showAlertDialog(title, yesButton, null, noButton, message, window) == Messages.YES ? Messages.YES : Messages.NO; }
From source file:com.intellij.ui.mac.MacMessagesImpl.java
License:Apache License
@Override @Messages.YesNoResult// w ww . ja v a 2 s . c o m public int showYesNoDialog(@NotNull String title, String message, @NotNull String yesButton, @NotNull String noButton, @Nullable Window window, @Nullable DialogWrapper.DoNotAskOption doNotAskDialogOption) { return showAlertDialog(title, yesButton, null, noButton, message, window, false, doNotAskDialogOption) == Messages.YES ? Messages.YES : Messages.NO; }
From source file:com.intellij.ui.mac.MacMessagesImpl.java
License:Apache License
@Messages.YesNoCancelResult private static int convertReturnCodeFromNativeAlertDialog(int returnCode, String alternateText) { // DEFAULT = 1 // ALTERNATE = 0 // OTHER = -1 (cancel) int cancelCode; int code;/*from w ww . ja v a 2 s .co m*/ if (alternateText != null) { // DEFAULT = 0 // ALTERNATE = 1 // CANCEL = 2 cancelCode = Messages.CANCEL; switch (returnCode) { case 1: code = Messages.YES; break; case 0: code = Messages.NO; break; case -1: // cancel default: code = Messages.CANCEL; break; } } else { // DEFAULT = 0 // CANCEL = 1 cancelCode = 1; switch (returnCode) { case 1: code = Messages.YES; break; case -1: // cancel default: code = Messages.NO; break; } } if (cancelCode == code) { code = Messages.CANCEL; } LOG.assertTrue(code == Messages.YES || code == Messages.NO || code == Messages.CANCEL, code); return code; }
From source file:com.intellij.ui.messages.JBMacMessages.java
License:Apache License
@Override public int showYesNoCancelDialog(@NotNull String title, String message, @NotNull String defaultButton, String alternateButton, String otherButton, @Nullable Window window, @Nullable DialogWrapper.DoNotAskOption doNotAskOption) { if (window == null) { window = getForemostWindow(null); }//from w w w . jav a 2 s.c o m SheetMessage sheetMessage = new SheetMessage(window, title, message, UIUtil.getQuestionIcon(), new String[] { defaultButton, alternateButton, otherButton }, null, defaultButton, alternateButton); String resultString = sheetMessage.getResult(); int result = resultString.equals(defaultButton) ? Messages.YES : resultString.equals(alternateButton) ? Messages.NO : Messages.CANCEL; if (doNotAskOption != null) { doNotAskOption.setToBeShown(sheetMessage.toBeShown(), result); } return result; }
From source file:com.intellij.ui.messages.JBMacMessages.java
License:Apache License
@Override public int showYesNoDialog(@NotNull String title, String message, @NotNull String yesButton, @NotNull String noButton, @Nullable Window window) { if (window == null) { window = getForemostWindow(null); }// w w w . j a va2 s.co m SheetMessage sheetMessage = new SheetMessage(window, title, message, UIUtil.getQuestionIcon(), new String[] { yesButton, noButton }, null, yesButton, noButton); return sheetMessage.getResult().equals(yesButton) ? Messages.YES : Messages.NO; }
From source file:com.intellij.ui.messages.JBMacMessages.java
License:Apache License
@Override public int showYesNoDialog(@NotNull String title, String message, @NotNull String yesButton, @NotNull String noButton, @Nullable Window window, @Nullable DialogWrapper.DoNotAskOption doNotAskDialogOption) { if (window == null) { window = getForemostWindow(null); }/*from ww w . j a va2 s . c o m*/ SheetMessage sheetMessage = new SheetMessage(window, title, message, UIUtil.getQuestionIcon(), new String[] { yesButton, noButton }, doNotAskDialogOption, yesButton, noButton); int result = sheetMessage.getResult().equals(yesButton) ? Messages.YES : Messages.NO; if (doNotAskDialogOption != null) { doNotAskDialogOption.setToBeShown(sheetMessage.toBeShown(), result); } return result; }
From source file:com.mbeddr.pluginmanager.com.intellij.ide.plugins.InstallPluginAction.java
License:Apache License
private static boolean suggestToEnableInstalledPlugins(InstalledPluginsTableModel pluginsModel, Set<IdeaPluginDescriptor> disabled, Set<IdeaPluginDescriptor> disabledDependants, List<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 ww w .j a va2 s.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 " + (disabled.isEmpty() ? "and plugins which depend on disabled " : "") + "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 += "?"; result = Messages.showYesNoDialog(XmlStringUtil.wrapInHtml(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.microsoft.intellij.ui.azureroles.ComponentsPanel.java
License:Open Source License
/** * Listener method for remove button which * deletes the selected component.//ww w . j a va 2 s . c o m */ private void removeComponent() { WindowsAzureRoleComponent component = tblComponents.getSelectedObject(); // IWorkspace workspace = ResourcesPlugin.getWorkspace(); // IWorkspaceRoot root = workspace.getRoot(); // WindowsAzureRoleComponent component = listComponents.get(selIndex); try { /* First condition: Checks component is part of a JDK, * server configuration * Second condition: For not showing error message * "Disable Server JDK Configuration" * while removing server application * when server or JDK is already disabled. */ if (component.getIsPreconfigured() && (!(component.getType().equals(message("typeSrvApp")) && windowsAzureRole.getServerName() == null))) { PluginUtil.displayErrorDialog(message("jdkDsblErrTtl"), message("jdkDsblErrMsg")); } else { int choice = Messages.showYesNoDialog(message("cmpntRmvMsg"), message("cmpntRmvTtl"), Messages.getQuestionIcon()); if (choice == Messages.YES) { String cmpntPath = String.format("%s%s%s%s%s", PluginUtil.getModulePath(ModuleManager.getInstance(project) .findModuleByName(waProjManager.getProjectName())), File.separator, windowsAzureRole.getName(), message("approot"), component.getDeployName()); File file = new File(cmpntPath); // Check import source is equal to approot if (component.getImportPath().isEmpty() && file.exists()) { int selected = Messages.showYesNoCancelDialog(message("cmpntSrcRmvMsg"), message("cmpntSrcRmvTtl"), Messages.getQuestionIcon()); switch (selected) { case Messages.YES: //yes component.delete(); // tblViewer.refresh(); fileToDel.add(file); break; case Messages.NO: //no component.delete(); // tblViewer.refresh(); break; case Messages.CANCEL: //cancel break; default: break; } } else { component.delete(); // tblViewer.refresh(); fileToDel.add(file); } myModified = true; } } // if (tblComponents.getItemCount() == 0) { // // table is empty i.e. number of rows = 0 // btnRemove.setEnabled(false); // btnEdit.setEnabled(false); // } } catch (WindowsAzureInvalidProjectOperationException e) { PluginUtil.displayErrorDialogAndLog(message("cmpntSetErrTtl"), message("cmpntRmvErrMsg"), e); } }