List of usage examples for com.intellij.openapi.ui Messages getQuestionIcon
@NotNull public static Icon getQuestionIcon()
From source file:com.sixrr.guiceyidea.actions.NewGuiceBindingAnnotationAction.java
License:Apache License
protected PsiElement[] invokeDialogImpl(Project project, PsiDirectory directory) { final String annotationName = Messages.showInputDialog("Name for new binding annotation", "Create Guice Binding Annotation", Messages.getQuestionIcon()); if (annotationName != null) { final MyInputValidator validator = new MyInputValidator(project, directory); validator.canClose(annotationName); return validator.getCreatedElements(); }//from w w w. j av a 2 s . co m return PsiElement.EMPTY_ARRAY; }
From source file:com.sixrr.guiceyidea.actions.NewGuiceMethodInterceptorAction.java
License:Apache License
protected PsiElement[] invokeDialogImpl(Project project, PsiDirectory directory) { final String InterceptorName = Messages.showInputDialog("Name for new Method Interceptor", "Create Guice Method Interceptor", Messages.getQuestionIcon()); if (InterceptorName != null) { final MyInputValidator validator = new MyInputValidator(project, directory); validator.canClose(InterceptorName); return validator.getCreatedElements(); }/*from w ww . j a va 2 s .c o m*/ return PsiElement.EMPTY_ARRAY; }
From source file:com.sixrr.guiceyidea.actions.NewGuiceModuleAction.java
License:Apache License
protected PsiElement[] invokeDialogImpl(Project project, PsiDirectory directory) { final String moduleName = Messages.showInputDialog("Name for new module", "Create Guice Module", Messages.getQuestionIcon()); if (moduleName != null) { final MyInputValidator validator = new MyInputValidator(project, directory); validator.canClose(moduleName);/*from w ww.ja va 2 s . c o m*/ return validator.getCreatedElements(); } return PsiElement.EMPTY_ARRAY; }
From source file:com.sixrr.guiceyidea.actions.NewGuiceScopeAnnotationAction.java
License:Apache License
protected PsiElement[] invokeDialogImpl(Project project, PsiDirectory directory) { final String annotationName = Messages.showInputDialog("Name for new scope annotation", "Create Guice Scope Annotation", Messages.getQuestionIcon()); if (annotationName != null) { final MyInputValidator validator = new MyInputValidator(project, directory); validator.canClose(annotationName); return validator.getCreatedElements(); }/* w w w. ja v a 2 s . c o m*/ return PsiElement.EMPTY_ARRAY; }
From source file:com.suleyman.lua.editor.actions.NewLuaActionBase.java
License:Apache License
@NotNull protected final PsiElement[] invokeDialog(final Project project, final PsiDirectory directory) { log.debug("invokeDialog"); final MyInputValidator validator = new MyInputValidator(project, directory); Messages.showInputDialog(project, getDialogPrompt(), getDialogTitle(), Messages.getQuestionIcon(), "", validator);//from w w w . j av a 2 s . c o m final PsiElement[] elements = validator.getCreatedElements(); log.debug("Result: " + Arrays.toString(elements)); return elements; }
From source file:de.fu_berlin.inf.dpp.intellij.ui.util.SafeDialogUtils.java
License:Open Source License
/** * Shows an input dialog in the UI thread. */// ww w . j a v a 2s . c o m public static String showInputDialog(final String message, final String initialValue, final String title) { final StringBuilder response = new StringBuilder(); UIUtil.invokeAndWaitIfNeeded(new Runnable() { @Override public void run() { String option = Messages.showInputDialog(saros.getProject(), message, title, Messages.getQuestionIcon(), initialValue, null); if (option != null) { response.append(option); } } }); return response.toString(); }
From source file:de.fu_berlin.inf.dpp.intellij.ui.util.SafeDialogUtils.java
License:Open Source License
public static boolean showYesNoDialog(final String message, final String title) { final AtomicBoolean choice = new AtomicBoolean(false); UIUtil.invokeAndWaitIfNeeded(new Runnable() { @Override//from ww w . j a v a 2 s . com public void run() { int returnValue = Messages.showYesNoDialog(saros.getProject(), message, title, Messages.getQuestionIcon()); if (returnValue == Messages.YES) { choice.set(true); } } }); return choice.get(); }
From source file:de.mobilej.plugin.adc.ToolWindowFactory.java
License:Apache License
@NotNull private JPanel createPanel(@NotNull Project project) { // Create Panel and Content JPanel panel = new JPanel(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.NONE; c.anchor = GridBagConstraints.LINE_START; devices = new ComboBox(new String[] { resourceBundle.getString("device.none") }); c.gridx = 0;// w w w. j a v a 2s . c o m c.gridy = 0; panel.add(new JLabel("Device"), c); c.gridx = 1; c.gridy = 0; panel.add(devices, c); showLayoutBounds = new JBCheckBox(resourceBundle.getString("show.layout.bounds")); c.gridx = 0; c.gridy = 1; c.gridwidth = 2; panel.add(showLayoutBounds, c); showLayoutBounds.addActionListener(e -> { final String what = showLayoutBounds.isSelected() ? "true" : "\"\""; final String cmd = "setprop debug.layout " + what; ProgressManager.getInstance().runProcessWithProgressSynchronously(() -> { ProgressManager.getInstance().getProgressIndicator().setIndeterminate(true); userAction = true; executeShellCommand(cmd, true); userAction = false; }, resourceBundle.getString("setting.values.title"), false, null); }); localeChooser = new ComboBox(LOCALES); c.gridx = 0; c.gridy = 2; c.gridwidth = 2; panel.add(localeChooser, c); localeChooser.addActionListener(e -> { final LocaleData ld = (LocaleData) localeChooser.getSelectedItem(); if (ld == null) { return; } ProgressManager.getInstance().runProcessWithProgressSynchronously(() -> { ProgressManager.getInstance().getProgressIndicator().setIndeterminate(true); userAction = true; executeShellCommand( "am start -a SETMYLOCALE --es language " + ld.language + " --es country " + ld.county, false); userAction = false; }, resourceBundle.getString("setting.values.title"), false, null); }); goToActivityButton = new JButton(resourceBundle.getString("button.goto_activity")); c.gridx = 0; c.gridy = 3; c.gridwidth = 2; panel.add(goToActivityButton, c); goToActivityButton .addActionListener(e -> ProgressManager.getInstance().runProcessWithProgressSynchronously(() -> { ProgressManager.getInstance().getProgressIndicator().setIndeterminate(true); userAction = true; final String result = executeShellCommand("dumpsys activity top", false); userAction = false; if (result == null) { return; } ApplicationManager.getApplication().invokeLater(() -> { String activity = result.substring(result.indexOf("ACTIVITY ") + 9); activity = activity.substring(0, activity.indexOf(" ")); String pkg = activity.substring(0, activity.indexOf("/")); String clz = activity.substring(activity.indexOf("/") + 1); if (clz.startsWith(".")) { clz = pkg + clz; } GlobalSearchScope scope = GlobalSearchScope.allScope(project); PsiClass psiClass = JavaPsiFacade.getInstance(project).findClass(clz, scope); if (psiClass != null) { FileEditorManager fileEditorManager = FileEditorManager.getInstance(project); //Open the file containing the class VirtualFile vf = psiClass.getContainingFile().getVirtualFile(); //Jump there new OpenFileDescriptor(project, vf, 1, 0).navigateInEditor(project, false); } else { Messages.showMessageDialog(project, clz, resourceBundle.getString("error.class_not_found"), Messages.getWarningIcon()); return; } }); }, resourceBundle.getString("setting.values.title"), false, null)); inputOnDeviceButton = new JButton(resourceBundle.getString("button.input_on_device")); c.gridx = 0; c.gridy = 4; c.gridwidth = 2; panel.add(inputOnDeviceButton, c); inputOnDeviceButton.addActionListener(e -> { final String text2send = Messages.showMultilineInputDialog(project, resourceBundle.getString("send_text.message"), resourceBundle.getString("send_text.title"), storage.getLastSentText(), Messages.getQuestionIcon(), null); if (text2send != null) { storage.setLastSentText(text2send); ProgressManager.getInstance().runProcessWithProgressSynchronously(() -> { ProgressManager.getInstance().getProgressIndicator().setIndeterminate(true); userAction = true; doInputOnDevice(text2send); userAction = false; }, resourceBundle.getString("processing.title"), false, null); } }); clearDataButton = new JButton(resourceBundle.getString("button.clear_data")); c.gridx = 0; c.gridy = 5; c.gridwidth = 2; panel.add(clearDataButton, c); clearDataButton.addActionListener(actionEvent -> { ArrayList<String> appIds = new ArrayList<String>(); List<AndroidFacet> androidFacets = ProjectFacetManager.getInstance(project).getFacets(AndroidFacet.ID); if (androidFacets != null) { for (AndroidFacet facet : androidFacets) { if (!facet.isLibraryProject()) { AndroidModel androidModel = facet.getAndroidModel(); if (androidModel != null) { String appId = androidModel.getApplicationId(); appIds.add(appId); } } } } ProgressManager.getInstance().runProcessWithProgressSynchronously(() -> { ProgressManager.getInstance().getProgressIndicator().setIndeterminate(true); userAction = true; for (String appId : appIds) { executeShellCommand("pm clear " + appId, false); } userAction = false; }, resourceBundle.getString("processing.title"), false, null); }); JPanel framePanel = new JPanel(new BorderLayout()); framePanel.add(panel, BorderLayout.NORTH); return framePanel; }
From source file:de.mprengemann.intellij.plugin.androidicons.dialogs.AndroidMultiDrawableImporter.java
License:Apache License
private void importZipArchive(VirtualFile virtualFile) { final String filePath = virtualFile.getCanonicalPath(); if (filePath == null) { return;/*from w w w .j a v a 2s .co m*/ } final File tempDir = new File(ImageInformation.getTempDir(), virtualFile.getNameWithoutExtension()); final String archiveName = virtualFile.getName(); new Task.Modal(project, "Importing Archive...", true) { @Override public void run(@NotNull final ProgressIndicator progressIndicator) { progressIndicator.setIndeterminate(true); try { FileUtils.forceMkdir(tempDir); ZipUtil.extract(new File(filePath), tempDir, new FilenameFilter() { @Override public boolean accept(File dir, String name) { final String mimeType = new MimetypesFileTypeMap().getContentType(name); final String type = mimeType.split("/")[0]; return type.equals("image"); } }, true); progressIndicator.checkCanceled(); final Iterator<File> fileIterator = FileUtils.iterateFiles(tempDir, TrueFileFilter.INSTANCE, TrueFileFilter.INSTANCE); while (fileIterator.hasNext()) { File file = fileIterator.next(); if (file.isDirectory() || file.isHidden()) { continue; } final String fileRoot = file.getParent().toUpperCase(); final String name = FilenameUtils.getBaseName(file.toString()); if (name.startsWith(".") || fileRoot.contains("__MACOSX")) { continue; } for (Resolution resolution : RESOLUTIONS) { if (name.toUpperCase().contains("-" + resolution) || name.toUpperCase().contains("_" + resolution) || fileRoot.contains(resolution.toString())) { controller.addZipImage(file, resolution); break; } } } progressIndicator.checkCanceled(); final Map<Resolution, List<ImageInformation>> zipImages = controller.getZipImages(); final List<Resolution> foundResolutions = new ArrayList<Resolution>(); int foundAssets = 0; for (Resolution resolution : zipImages.keySet()) { final List<ImageInformation> assetInformation = zipImages.get(resolution); if (assetInformation != null && !assetInformation.isEmpty()) { foundAssets += assetInformation.size(); foundResolutions.add(resolution); } } progressIndicator.checkCanceled(); final int finalFoundAssets = foundAssets; UIUtil.invokeLaterIfNeeded(new DumbAwareRunnable() { public void run() { final String title = String.format("Import '%s'", archiveName); if (foundResolutions.isEmpty() || finalFoundAssets == 0) { Messages.showErrorDialog("No assets found.", title); FileUtils.deleteQuietly(tempDir); return; } final String[] options = new String[] { "Import", "Cancel" }; final String description = String.format("Import %d assets for %s to %s.", finalFoundAssets, StringUtils.join(foundResolutions, ", "), controller.getTargetRoot()); final int selection = Messages.showDialog(description, title, options, 0, Messages.getQuestionIcon()); if (selection == 0) { controller.getZipTask(project, tempDir).queue(); close(0); } else { FileUtils.deleteQuietly(tempDir); } } }); } catch (ProcessCanceledException e) { FileUtils.deleteQuietly(tempDir); } catch (IOException e) { LOGGER.error(e); } } }.queue(); }
From source file:de.mprengemann.intellij.plugin.androidicons.images.RefactoringTask.java
License:Apache License
private boolean checkFileExist(@Nullable PsiDirectory targetDirectory, int[] choice, PsiFile file, String name, String title) {//from ww w . j a v a 2 s .c o m if (targetDirectory == null) { return false; } final PsiFile existing = targetDirectory.findFile(name); if (existing == null || existing.equals(file)) { return false; } int selection; if (choice == null || choice[0] == -1) { final String message = String.format("File '%s' already exists in directory '%s'", name, targetDirectory.getVirtualFile().getPath()); String[] options = choice == null ? new String[] { "Overwrite", "Skip" } : new String[] { "Overwrite", "Skip", "Overwrite for all", "Skip for all" }; selection = Messages.showDialog(message, title, options, 0, Messages.getQuestionIcon()); if (selection == 2 || selection == 3) { this.selection = selection; } } else { selection = choice[0]; } if (choice != null && selection > 1) { choice[0] = selection % 2; selection = choice[0]; } if (selection == 0 && file != existing) { existing.delete(); } else { return true; } return false; }