List of usage examples for com.intellij.openapi.ui Messages getQuestionIcon
@NotNull public static Icon getQuestionIcon()
From source file:org.visage.ideaplugin.NewVisageClassAction.java
License:Open Source License
@NotNull protected final PsiElement[] invokeDialog(Project project, PsiDirectory directory) { Module module = ModuleUtil.findModuleForFile(directory.getVirtualFile(), project); if (module == null) return PsiElement.EMPTY_ARRAY; MyInputValidator validator = new MyInputValidator(project, directory); Messages.showInputDialog(project, "Enter a new class name", "New Visage Class", Messages.getQuestionIcon(), "", validator); return validator.getCreatedElements(); }
From source file:org.zmlx.hg4idea.command.mq.HgQRenameCommand.java
License:Apache License
public void execute(@NotNull final Hash patchHash) { final Project project = myRepository.getProject(); HgNameWithHashInfo patchInfo = ContainerUtil.find(myRepository.getMQAppliedPatches(), new Condition<HgNameWithHashInfo>() { @Override/*from w ww .j a v a 2 s . co m*/ public boolean value(HgNameWithHashInfo info) { return info.getHash().equals(patchHash); } }); if (patchInfo == null) { LOG.error("Could not find patch " + patchHash.toString()); return; } final String oldName = patchInfo.getName(); final String newName = Messages.showInputDialog(project, String.format("Enter a new name for %s patch:", oldName), "Rename Patch", Messages.getQuestionIcon(), "", new HgPatchReferenceValidator(myRepository)); if (newName != null) { performPatchRename(myRepository, oldName, newName); } }
From source file:org.zmlx.hg4idea.execution.HgDeleteModifyPromptHandler.java
License:Apache License
public HgPromptChoice promptUser(@NotNull final String message, @NotNull final HgPromptChoice[] choices, @NotNull final HgPromptChoice defaultChoice) { Matcher localDelMatcher = LOCAL_DELETE_REMOTE_MODIFIED_CONFLICT_MESSAGE_PATTERN.matcher(message); Matcher localModifyMatcher = REMOTE_DELETE_LOCAL_MODIFIED_CONFLICT_MESSAGE_PATTERN.matcher(message); String filename;/*from w w w .j a va2 s. c o m*/ final String modifiedMessage; if (localDelMatcher.matches()) { filename = localDelMatcher.group(1); modifiedMessage = "File " + filename + " is deleted locally, but modified remotely. Do you want to keep the modified version or remove the file?"; } else if (localModifyMatcher.matches()) { filename = localModifyMatcher.group(1); modifiedMessage = "File " + filename + " is deleted remotely, but modified locally. Do you want to keep the modified version or remove the file?"; } else { modifiedMessage = message; } final int[] chosen = new int[] { -1 }; try { EventQueue.invokeAndWait(new Runnable() { public void run() { String[] choicePresentationArray = new String[choices.length]; for (int i = 0; i < choices.length; ++i) { choicePresentationArray[i] = choices[i].toString(); } chosen[0] = Messages.showDialog(modifiedMessage, "Delete-Modify Conflict", choicePresentationArray, defaultChoice.getChosenIndex(), Messages.getQuestionIcon()); } }); } catch (InterruptedException | InvocationTargetException e) { LOG.error(e); return defaultChoice; } return chosen[0] >= 0 ? choices[chosen[0]] : HgPromptChoice.ABORT; }
From source file:org.zmlx.hg4idea.util.HgUtil.java
License:Apache License
/** * Shows a message dialog to enter the name of new branch. * * @return name of new branch or {@code null} if user has cancelled the dialog. *///from www .j a v a2 s . c o m @Nullable public static String getNewBranchNameFromUser(@NotNull HgRepository repository, @NotNull String dialogTitle) { return Messages.showInputDialog(repository.getProject(), "Enter the name of new branch:", dialogTitle, Messages.getQuestionIcon(), "", new HgBranchReferenceValidator(repository)); }
From source file:ru.artlebedev.idea.plugins.parser.refactoring.ParserIntroduceVariableHandler.java
License:Apache License
private String showDialog() { do {//w ww. j a v a 2 s . co m String s = Messages.showInputDialog(ParserBundle.message("actions.introduceVariable.enterName"), ParserBundle.message("actions.introduceVariable.title"), Messages.getQuestionIcon()); if (s == null) return ""; if ("".equals(s.trim())) { Messages.showMessageDialog(ParserBundle.message("actions.createClass.emptyName"), ParserBundle.message("actions.createClass.emptyNameTitle"), Messages.getErrorIcon()); } else { return s; } } while (true); }
From source file:ru.artlebedev.idea.plugins.parser.zencoding.ZenCodingTemplate.java
License:Apache License
public void wrap(final String selection, @NotNull final CustomTemplateCallback callback) { InputValidatorEx validator = new InputValidatorEx() { public String getErrorText(String inputString) { if (!checkTemplateKey(inputString, callback)) { return XmlBundle.message("zen.coding.incorrect.abbreviation.error"); }//from w w w . ja va 2s . c o m return null; } public boolean checkInput(String inputString) { return getErrorText(inputString) == null; } public boolean canClose(String inputString) { return checkInput(inputString); } }; final String abbreviation = Messages.showInputDialog(callback.getProject(), XmlBundle.message("zen.coding.enter.abbreviation.dialog.label"), XmlBundle.message("zen.coding.title"), Messages.getQuestionIcon(), "", validator); if (abbreviation != null) { doWrap(selection, abbreviation, callback); } }
From source file:ru.scratch.AddScratchAction.java
License:Apache License
private String showInputDialog() { String fileName = Messages.showInputDialog("File name:", "Create New Scratch", Messages.getQuestionIcon(), getDefaultName(), new NonEmptyInputValidator()); return fileName; }
From source file:wicketforge.action.ToggleAction.java
License:Apache License
@Nullable private PsiElement createMarkup(@NotNull Module module, @NotNull PsiFile psiFile, @NotNull PsiClass psiClass) { PsiDirectory psiDirectory = psiFile.getContainingDirectory(); if (psiDirectory == null) { return null; }/*www. j a v a 2s.c om*/ PsiPackage psiPackage = JavaDirectoryService.getInstance().getPackage(psiDirectory); if (psiPackage == null) { return null; } String templateName = null; if (WicketPsiUtil.isWicketPage(psiClass)) { templateName = WicketTemplates.WICKET_PAGE_HTML; } else if (WicketPsiUtil.isWicketPanel(psiClass)) { templateName = WicketTemplates.WICKET_PANEL_HTML; } else if (WicketPsiUtil.isWicketBorder(psiClass)) { templateName = WicketTemplates.WICKET_BORDER_HTML; } if (templateName != null && Messages.showYesNoDialog(module.getProject(), String.format("Create a new markup for '%s'?", psiClass.getQualifiedName()), "Create Markup", Messages.getQuestionIcon()) == 0) { PsiDirectory directory = WicketFileUtil.selectTargetDirectory(psiPackage.getQualifiedName(), module.getProject(), module); if (directory != null) { // create return WicketFileUtil.createFileFromTemplate(WicketFilenameUtil.getMarkupFilename(psiClass), directory, templateName); } } return null; }