List of usage examples for com.intellij.openapi.ui Messages getQuestionIcon
@NotNull public static Icon getQuestionIcon()
From source file:myPlugin.src.TextBoxes.java
License:Apache License
public void actionPerformed(AnActionEvent event) { Project project = event.getData(PlatformDataKeys.PROJECT); String txt = Messages.showInputDialog(project, "Android Class Name", "Android Class Name", Messages.getQuestionIcon()); String recommendation = ""; rulesForClass = parser.getRuleForClass(rules, txt); int i = 1;//from w w w . j a va 2 s. co m for (Rule rule : rulesForClass) { recommendation += i + ") " + rule.right_hand_side + "\t Confidece: " + rule.confidence + "\n\n"; i++; } Messages.showMessageDialog(project, recommendation, "Recommended Intent Actions", Messages.getInformationIcon()); }
From source file:net.andydvorak.intellij.lessc.ui.configurable.LessProfilesPanel.java
License:Apache License
@Nullable private String askForProfileName(String title, String initialName) { final String message = UIBundle.message("action.new.less.profile.prompt.message"); return Messages.showInputDialog(message, title, Messages.getQuestionIcon(), initialName, new InputValidator() { public boolean checkInput(String s) { return !getAllProfiles().containsKey(s) && s.length() > 0; }//from w ww . j a va2 s . co m public boolean canClose(String s) { return checkInput(s); } }); }
From source file:net.andydvorak.intellij.lessc.ui.configurable.VfsLocationChangeDialog.java
License:Apache License
public synchronized boolean shouldMoveCssFile(final VirtualFileEvent virtualFileEvent) { DialogWrapper.DoNotAskOption option = new DialogWrapper.DoNotAskOption() { @Override//from w ww. j ava 2 s . co m public boolean isToBeShown() { return myLessProjectState.isPromptOnMove(); } @Override public void setToBeShown(boolean value, int exitCode) { myLessProjectState.setPromptOnMove(value); } @Override public boolean canBeHidden() { return true; } @Override public boolean shouldSaveOptionsOnCancel() { return true; } @Override public String getDoNotShowMessage() { return UIBundle.message("do.not.ask.me.again"); } }; if (option.isToBeShown()) { if (System.currentTimeMillis() - lastPrompt > promptIntervalMillis) { result = Messages.showYesNoDialog( UIBundle.message("vfs.move.message", virtualFileEvent.getFileName()), UIBundle.message("vfs.move.title"), // Title UIBundle.message("vfs.move.yes"), // "Yes" button text UIBundle.message("vfs.move.no"), // "No" button text Messages.getQuestionIcon(), option); } } else { result = myLessProjectState.isMoveCssFiles() ? DialogWrapper.OK_EXIT_CODE : DialogWrapper.CANCEL_EXIT_CODE; } lastPrompt = System.currentTimeMillis(); final boolean shouldMove = result == DialogWrapper.OK_EXIT_CODE; myLessProjectState.setMoveCssFiles(shouldMove); return shouldMove; }
From source file:net.andydvorak.intellij.lessc.ui.configurable.VfsLocationChangeDialog.java
License:Apache License
public synchronized boolean shouldCopyCssFile(final VirtualFileEvent virtualFileEvent) { DialogWrapper.DoNotAskOption option = new DialogWrapper.DoNotAskOption() { @Override//from ww w. jav a 2 s . com public boolean isToBeShown() { return myLessProjectState.isPromptOnCopy(); } @Override public void setToBeShown(boolean value, int exitCode) { myLessProjectState.setPromptOnCopy(value); } @Override public boolean canBeHidden() { return true; } @Override public boolean shouldSaveOptionsOnCancel() { return true; } @Override public String getDoNotShowMessage() { return UIBundle.message("do.not.ask.me.again"); } }; if (option.isToBeShown()) { if (System.currentTimeMillis() - lastPrompt > promptIntervalMillis) { result = Messages.showYesNoDialog( UIBundle.message("vfs.copy.message", virtualFileEvent.getFileName()), UIBundle.message("vfs.copy.title"), // Title UIBundle.message("vfs.copy.yes"), // "Yes" button text UIBundle.message("vfs.copy.no"), // "No" button text Messages.getQuestionIcon(), option); } } else { result = myLessProjectState.isCopyCssFiles() ? DialogWrapper.OK_EXIT_CODE : DialogWrapper.CANCEL_EXIT_CODE; } lastPrompt = System.currentTimeMillis(); final boolean shouldCopy = result == DialogWrapper.OK_EXIT_CODE; myLessProjectState.setCopyCssFiles(shouldCopy); return shouldCopy; }
From source file:net.andydvorak.intellij.lessc.ui.configurable.VfsLocationChangeDialog.java
License:Apache License
public synchronized boolean shouldDeleteCssFile(final VirtualFileEvent virtualFileEvent) { DialogWrapper.DoNotAskOption option = new DialogWrapper.DoNotAskOption() { @Override//ww w .java 2 s.c o m public boolean isToBeShown() { return myLessProjectState.isPromptOnDelete(); } @Override public void setToBeShown(boolean value, int exitCode) { myLessProjectState.setPromptOnDelete(value); } @Override public boolean canBeHidden() { return true; } @Override public boolean shouldSaveOptionsOnCancel() { return true; } @Override public String getDoNotShowMessage() { return UIBundle.message("do.not.ask.me.again"); } }; if (option.isToBeShown()) { if (System.currentTimeMillis() - lastPrompt > promptIntervalMillis) { result = Messages.showYesNoDialog( UIBundle.message("vfs.delete.message", virtualFileEvent.getFileName()), UIBundle.message("vfs.delete.title"), // Title UIBundle.message("vfs.delete.yes"), // "Yes" button text UIBundle.message("vfs.delete.no"), // "No" button text Messages.getQuestionIcon(), option); } } else { result = myLessProjectState.isDeleteCssFiles() ? DialogWrapper.OK_EXIT_CODE : DialogWrapper.CANCEL_EXIT_CODE; } lastPrompt = System.currentTimeMillis(); final boolean shouldDelete = result == DialogWrapper.OK_EXIT_CODE; myLessProjectState.setDeleteCssFiles(shouldDelete); return shouldDelete; }
From source file:net.groboclown.idea.p4ic.actions.P4WorkOfflineAction.java
License:Apache License
@Override public void actionPerformed(@NotNull AnActionEvent e) { Project project = getProject(e);/*from w ww . j ava 2 s. c o m*/ if (project == null) { return; } final P4Vcs vcs = P4Vcs.getInstance(getProject(e)); List<P4Server> onlineServers = new ArrayList<P4Server>(); for (P4Server server : vcs.getP4Servers()) { if (server.isWorkingOnline()) { onlineServers.add(server); } } if (!onlineServers.isEmpty()) { if (Messages.showOkCancelDialog(e.getProject(), P4Bundle.message("dialog.go-offline.message", P4Bundle.applicationName()), P4Bundle.message("dialog.go-offline.title"), Messages.getQuestionIcon()) == Messages.CANCEL) { return; } for (P4Server server : onlineServers) { server.workOffline(); } } }
From source file:net.sf.logsupport.ui.util.Dialogs.java
License:Apache License
public static String askForInput(String title, String initialInput, final Collection<String> excludes) { return Messages.showInputDialog(title, title, Messages.getQuestionIcon(), initialInput, new InputValidator() { public boolean checkInput(String s) { return s.length() > 0 && (excludes == null || !excludes.contains(s)); }/* www . j a v a 2s . c o m*/ public boolean canClose(String s) { return checkInput(s); } }); }
From source file:nieldw.plugins.idea.ImportSettings.java
License:Apache License
public static void doImport(String path) { File saveFile = new File(path); try {/*from w ww .j a v a 2 s .c o m*/ if (!saveFile.exists()) { Messages.showErrorDialog(IdeBundle.message("error.cannot.find.file", presentableFileName(saveFile)), IdeBundle.message("title.file.not.found")); return; } ZipEntry magicEntry = new ZipFile(saveFile).getEntry("IntelliJ IDEA Global Settings"); if (magicEntry == null) { Messages.showErrorDialog( IdeBundle.message("error.file.contains.no.settings.to.import", presentableFileName(saveFile), promptLocationMessage()), IdeBundle.message("title.invalid.file")); return; } ArrayList<ExportableComponent> registeredComponents = new ArrayList<ExportableComponent>(); Map<File, Set<ExportableComponent>> filesToComponents = ExportSettingsAction .getRegisteredComponentsAndFiles(registeredComponents); List<ExportableComponent> components = getComponentsStored(saveFile, registeredComponents); ChooseComponentsToImportDialog dialog = new ChooseComponentsToImportDialog(components, filesToComponents, IdeBundle.message("title.select.components.to.import"), IdeBundle.message("prompt.check.components.to.import")); dialog.show(); if (!dialog.isOK()) return; Set<ExportableComponent> chosenComponents = dialog.getExportableComponents(); Set<String> relativeNamesToExtract = new HashSet<String>(); for (ExportableComponent chosenComponent : chosenComponents) { File[] exportFiles = chosenComponent.getExportFiles(); for (File exportFile : exportFiles) { File configPath = new File(PathManager.getConfigPath()); String rPath = FileUtil.getRelativePath(configPath, exportFile); assert rPath != null; String relativePath = FileUtil.toSystemIndependentName(rPath); relativeNamesToExtract.add(relativePath); } } relativeNamesToExtract.add(PluginManager.INSTALLED_TXT); File tempFile = new File(PathManager.getPluginTempPath() + "/" + saveFile.getName()); FileUtil.copy(saveFile, tempFile); File outDir = new File(PathManager.getConfigPath()); ImportSettingsFilenameFilter filenameFilter = new ImportSettingsFilenameFilter(relativeNamesToExtract); StartupActionScriptManager.ActionCommand unzip = new StartupActionScriptManager.UnzipCommand(tempFile, outDir, filenameFilter); StartupActionScriptManager.addActionCommand(unzip); // remove temp file StartupActionScriptManager.ActionCommand deleteTemp = new StartupActionScriptManager.DeleteCommand( tempFile); StartupActionScriptManager.addActionCommand(deleteTemp); UpdateSettings.getInstance().forceCheckForUpdateAfterRestart(); String key = ApplicationManager.getApplication().isRestartCapable() ? "message.settings.imported.successfully.restart" : "message.settings.imported.successfully"; int ret = Messages.showOkCancelDialog( IdeBundle.message(key, ApplicationNamesInfo.getInstance().getProductName(), ApplicationNamesInfo.getInstance().getFullProductName()), IdeBundle.message("title.restart.needed"), Messages.getQuestionIcon()); if (ret == Messages.OK) { ((ApplicationEx) ApplicationManager.getApplication()).restart(true); } } catch (ZipException e1) { Messages.showErrorDialog(IdeBundle.message("error.reading.settings.file", presentableFileName(saveFile), e1.getMessage(), promptLocationMessage()), IdeBundle.message("title.invalid.file")); } catch (IOException e1) { Messages.showErrorDialog(IdeBundle.message("error.reading.settings.file.2", presentableFileName(saveFile), e1.getMessage()), IdeBundle.message("title.error.reading.file")); } }
From source file:org.cdv.intellij.ui.CDVNewFileAction.java
License:Open Source License
@NotNull @Override/* w w w.j a v a 2 s . co m*/ protected PsiElement[] invokeDialog(Project project, PsiDirectory psiDirectory) { final MyInputValidator validator = new MyInputValidator(project, psiDirectory); Messages.showInputDialog(project, "File name", "Create New " + CDVConstants.PLUGIN_NAME, Messages.getQuestionIcon(), "", validator); return validator.getCreatedElements(); }
From source file:org.coding.git.util.CodingNetNotifications.java
License:Apache License
@Messages.YesNoResult public static boolean showYesNoDialog(@Nullable Project project, @NotNull String title, @NotNull String message) { return Messages.YES == Messages.showYesNoDialog(project, message, title, Messages.getQuestionIcon()); }