List of usage examples for com.intellij.openapi.ui Messages showMessageDialog
public static void showMessageDialog(@NotNull Component parent, String message, @NotNull @Nls(capitalization = Nls.Capitalization.Title) String title, @Nullable Icon icon)
From source file:com.intellij.util.net.HttpProxySettingsUi.java
License:Apache License
private void configureCheckButton() { if (HttpConfigurable.getInstance() == null) { myCheckButton.setVisible(false); return;//from w w w.j av a 2 s . c o m } myCheckButton.addActionListener(new ActionListener() { @Override public void actionPerformed(@NotNull ActionEvent e) { final String title = "Check Proxy Settings"; final String answer = Messages.showInputDialog(myMainPanel, "Warning: your settings will be saved.\n\nEnter any URL to check connection to:", title, Messages.getQuestionIcon(), "http://", null); if (StringUtil.isEmptyOrSpaces(answer)) { return; } final HttpConfigurable settings = HttpConfigurable.getInstance(); apply(settings); final AtomicReference<IOException> exceptionReference = new AtomicReference<IOException>(); myCheckButton.setEnabled(false); myCheckButton.setText("Check connection (in progress...)"); myConnectionCheckInProgress = true; ApplicationManager.getApplication().executeOnPooledThread(new Runnable() { @Override public void run() { HttpURLConnection connection = null; try { //already checked for null above //noinspection ConstantConditions connection = settings.openHttpConnection(answer); connection.setReadTimeout(3 * 1000); connection.setConnectTimeout(3 * 1000); connection.connect(); final int code = connection.getResponseCode(); if (HttpURLConnection.HTTP_OK != code) { exceptionReference.set(new IOException("Error code: " + code)); } } catch (IOException e) { exceptionReference.set(e); } finally { if (connection != null) { connection.disconnect(); } } //noinspection SSBasedInspection SwingUtilities.invokeLater(new Runnable() { @Override public void run() { myConnectionCheckInProgress = false; reset(settings); // since password might have been set Component parent; if (myMainPanel.isShowing()) { parent = myMainPanel; myCheckButton.setText("Check connection"); myCheckButton.setEnabled(canEnableConnectionCheck()); } else { IdeFrame frame = IdeFocusManager.findInstance().getLastFocusedFrame(); if (frame == null) { return; } parent = frame.getComponent(); } //noinspection ThrowableResultOfMethodCallIgnored final IOException exception = exceptionReference.get(); if (exception == null) { Messages.showMessageDialog(parent, "Connection successful", title, Messages.getInformationIcon()); } else { final String message = exception.getMessage(); if (settings.USE_HTTP_PROXY) { settings.LAST_ERROR = message; } Messages.showErrorDialog(parent, errorText(message)); } } }); } }); } }); }
From source file:com.intellij.vcs.starteam.actions.UpdateStatusAction.java
License:Apache License
protected void perform(final Project project, StarteamVcs activeVcs, VirtualFile file) { try {//from www . j a v a 2 s . co m activeVcs.refresh(); activeVcs.updateStatus(file); } catch (VcsException ex) { Messages.showMessageDialog(project, ex.getMessage(), StarteamBundle.message("message.title.action.error"), Messages.getErrorIcon()); } catch (IOException ex) { Messages.showMessageDialog(project, ex.getMessage(), StarteamBundle.message("message.title.action.error"), Messages.getErrorIcon()); } }
From source file:com.photon.ui.Json2JavaDialog.java
private void okButtonActionPerformed(ActionEvent evt) {//GEN-FIRST:event_okButtonActionPerformed doClose(RET_OK);/*from w w w . jav a 2s . c o m*/ Messages.showMessageDialog(mProject, "JSON to Java conversion successful.\nOut put path : ", "Alert", Messages.getInformationIcon()); }
From source file:com.photon.ui.Plist2JsonDialog.java
private void okButtonActionPerformed(ActionEvent evt) { PlistToJsonConverter lConvertor = new PlistToJsonConverter(); String lSourceFile = jFileChooser1.getSelectedFile().getAbsolutePath(); String lDesFile = lSourceFile.substring(0, lSourceFile.lastIndexOf(".")); lDesFile = lDesFile.concat(".json"); lConvertor.convert(lSourceFile, lDesFile); doClose(RET_OK);/*from w w w. j av a2 s .c o m*/ Messages.showMessageDialog(mProject, "Plist to JSON conversion successful.\nOut put path : " + lDesFile, "Alert", Messages.getInformationIcon()); }
From source file:com.rtoth.boilerplate.BoilerplateJUnitGenerationAction.java
License:Open Source License
@Override public void actionPerformed(AnActionEvent event) { Project project = event.getData(PlatformDataKeys.PROJECT); // TODO: When would project ever be null? if (project != null) { // TODO: Eventually might want to handle multiple selection: // event.getData(PlatformDataKeys.VIRTUAL_FILE_ARRAY) PsiFile file = event.getData(LangDataKeys.PSI_FILE); // TODO: When would file ever be null? if (file != null && file instanceof PsiJavaFile) { try { PsiJavaFile sourceFile = (PsiJavaFile) file; Optional<PsiClass> optionalSourceClass = PsiUtility.getSingleClass(sourceFile); if (optionalSourceClass.isPresent()) { PsiClass sourceClass = optionalSourceClass.get(); // TODO: If we have to create the directory or file, it just exits without displaying the dialog... Optional<PsiClass> optionalTestClass = PsiUtility.findOrCreateTestClass(sourceClass); if (optionalTestClass.isPresent()) { PsiClass testClass = optionalTestClass.get(); GetTestMethodsDialog dialog = new GetTestMethodsDialog(sourceClass); if (dialog.showAndGet()) { TestCaseGenerator generator = new TestCaseGenerator(project); generator.createTestCases(testClass, dialog.getSelectedMethodRules()); }/*from w w w. j a va2 s. c om*/ } else { // TODO: Probably not best to be throwing exceptions in here just to catch // them below... log a message explicitly instead? throw new TestGenerationException( "Error finding or generating test class for " + sourceClass.getName()); } } else { // TODO: Probably not best to be throwing exceptions in here just to catch // them below... log a message explicitly instead? throw new TestGenerationException("File does not contain exactly 1 java class."); } } catch (RuntimeException | TestGenerationException e) { e.printStackTrace(); Messages.showMessageDialog(project, e.getMessage(), "Warning", Messages.getWarningIcon()); throw new RuntimeException(e); } } } }
From source file:com.theoryinpractice.testng.configuration.browser.GroupBrowser.java
License:Apache License
@Nullable @Override/*from w w w. j ava 2 s .co m*/ protected String showDialog() { TestClassFilter filter; Module module = editor.getModuleSelector().getModule(); if (module == null) { filter = new TestClassFilter(GlobalSearchScope.projectScope(getProject()), getProject(), false); } else { filter = new TestClassFilter(GlobalSearchScope.moduleScope(module), getProject(), false); } PsiClass[] classes = TestNGUtil.getAllTestClasses(filter, true); if (classes == null || classes.length == 0) { Messages.showMessageDialog(getField(), "No tests found in project", "Cannot Browse Groups", Messages.getInformationIcon()); return null; } else { return GroupList.showDialog(classes, getField()); } }
From source file:com.theoryinpractice.testng.configuration.browser.MethodBrowser.java
License:Apache License
@Override protected String showDialog() { String className = editor.getClassName(); if (className.trim().length() == 0) { Messages.showMessageDialog(getField(), "Set class name first", "Cannot Browse Methods", Messages.getInformationIcon()); return null; }/*from w w w . j a va 2 s . c o m*/ PsiClass psiclass = editor.getModuleSelector().findClass(className); if (psiclass == null) { Messages.showMessageDialog(getField(), "Class " + className + " does not exist", "Cannot Browse Methods", Messages.getInformationIcon()); return null; } else { PsiMethod psimethod = MethodList.showDialog(psiclass, getField()); return psimethod == null ? null : psimethod.getName(); } }
From source file:core.DeviceManager.java
License:Apache License
public void adbInit() throws NullAndroidHomeException { String androidHome = null;/*from ww w . j a va2s . c o m*/ androidHome = findAndroidHome(); if (androidHome == null) { Messages.showMessageDialog(mProject, "Cannot Find $ANDROID_HOME or Android SDK\nPlease set $ANDROID_HOME and restart", "Android Property Manager", Messages.getInformationIcon()); System.out.println("Cannot Find ANDROID_HOME"); throw new NullAndroidHomeException(); } AndroidDebugBridge.initIfNeeded(false); File adbPath = new File(androidHome, "platform-tools" + File.separator + "adb"); try { mADB = AndroidDebugBridge.createBridge(adbPath.getCanonicalPath(), true); } catch (IOException e) { e.printStackTrace(); } AndroidDebugBridge.addDeviceChangeListener(new AndroidDebugBridge.IDeviceChangeListener() { @Override public void deviceConnected(IDevice iDevice) { Device device = new Device(iDevice); PluginViewFactory.getInstance().setHint("Device is Connected"); String deviceName = device.getSerialNumber(); if (!mDevices.containsKey(deviceName)) { mDevices.put(deviceName, device); } System.out.println("Device Connected : " + deviceName); PluginViewFactory pluginViewFactory = PluginViewFactory.getInstance(); if (pluginViewFactory != null) { pluginViewFactory.updateDeviceListComboBox(); } } @Override public void deviceDisconnected(IDevice iDevice) { // mCurrentDevice = null; System.out.println("DeviceDisconnected"); PluginViewFactory pluginViewFactory = PluginViewFactory.getInstance(); mDevices.remove(iDevice.getSerialNumber()); if (pluginViewFactory != null) { pluginViewFactory.updateDeviceListComboBox(); } } @Override public void deviceChanged(IDevice iDevice, int i) { System.out.println("DeviceChanged : " + iDevice.getName()); PluginViewFactory pluginViewFactory = PluginViewFactory.getInstance(); if (pluginViewFactory != null && IDevice.CHANGE_STATE == i) { pluginViewFactory.SelectedDeviceChanged(); } } }); }
From source file:core.DeviceManager.java
License:Apache License
public void setPropertyValue(String name, String value) throws NullValueException { if ("".equals(value)) { Messages.showMessageDialog(mProject, "Cannot set property : value cannot be null.", "Error", Messages.getInformationIcon()); throw new NullValueException(); }/*w w w . j ava2 s .c o m*/ mDevice.setPropertyValue(name, value); }
From source file:de.fu_berlin.inf.dpp.intellij.ui.menu.AboutSarosHandler.java
License:Open Source License
@Override public void actionPerformed(AnActionEvent e) { Project project = e.getData(PlatformDataKeys.PROJECT); Messages.showMessageDialog(project, "Saros plugin for IntelliJ. \n Still under Development.", "About Saros", Messages.getInformationIcon()); }