List of usage examples for com.intellij.openapi.ui Messages showMultilineInputDialog
@Nullable public static String showMultilineInputDialog(Project project, String message, @Nls(capitalization = Nls.Capitalization.Title) String title, @Nullable String initialValue, @Nullable Icon icon, @Nullable InputValidator validator)
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 va2 s . c om 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:org.intellij.xquery.runner.ui.run.main.variables.ContextItemPanel.java
License:Apache License
private String getValueFromMultilineInputDialog(Project project, EditorTextField editorTextField) { return Messages.showMultilineInputDialog(project, "Edit custom content", "Edit", editorTextField.getText(), null, null);//from ww w . j a v a2 s . co m }