List of usage examples for com.intellij.openapi.ui Messages showMessageDialog
public static void showMessageDialog(String message, @NotNull @Nls(capitalization = Nls.Capitalization.Title) String title, @Nullable Icon icon)
From source file:brainleg.app.intellij.ui.SubmitSolutionDialog.java
License:Apache License
@Override protected void doOKAction() { String solution = myPanel.solutionTextArea.getText(); String snippet = myPanel.snippetTextArea.getText(); if (solution.trim().length() + snippet.trim().length() < 15) { Messages.showMessageDialog("Please provide solution text or code snippet", "Please provide solution", Messages.getInformationIcon()); return;/*from w w w . j a va 2s . c o m*/ } boolean success = submitSolution(solution, snippet, exception); if (success) { //update submitted solution count // BLSettingsService.getSettings().submittedSolutionCount = BLSettingsService.getSettings().submittedSolutionCount + 1; submitSolutionButton.setEnabled(false); //disable button so that the user does not submit it again by mistake } super.doOKAction(); }
From source file:brainleg.app.util.AppWeb.java
License:Apache License
/** * Returns true if success, false otherwise. * @param solution/* ww w . jav a 2 s .c o m*/ * @param snippet * @param exception * @return */ public static boolean submitSolution(String solution, String snippet, EData exception) { String exceptionString = Generator.generateStringForWebSubmission(exception, BLSettingsService.getSettings().sendExceptionMessage, BLSettingsService.getSettings().sendFullTraces); try { post(getUrl("api/submitSolution"), new NameValuePair[] { new NameValuePair("clientId", "intellij"), new NameValuePair("clientVer", AppUtil.getPluginVersion()), new NameValuePair("userAPIToken", BLSettingsService.getSettings().userAuthToken == null ? "" : BLSettingsService.getSettings().userAuthToken.trim()), new NameValuePair("exception", exceptionString), new NameValuePair("solution", solution), new NameValuePair("snippet", snippet) }); return true; } catch (RequestRejectedException e) { if ("USER_NOT_FOUND".equals(e.getResponseCode())) { Messages.showMessageDialog( "The user token does not match your website profile. Please open BrainLeg settings and update it", "Incorrect user token", Messages.getInformationIcon()); } else { Messages.showMessageDialog( "Connected to server but request was rejected: " + e.getResponseCode() + ":" + e.getResponseMessage(), "Request rejected by the server", Messages.getInformationIcon()); } return false; } catch (IOException e) { System.out.println("Can't connect to the server: " + e.getMessage()); Messages.showMessageDialog("Can't connect to the server", "Connection Problem", Messages.getInformationIcon()); return false; } }
From source file:brainleg.app.util.AppWeb.java
License:Apache License
public static void sendQueryAndOpenBrowser(EData exception) { String searchString = generateExceptionStringForSearchViaApi(exception); try {//from www . jav a2s.c o m //stack trace can be too big to send via GET //so we first send the exception via POST, the server responds with a temp request token //and then we open browser with a short url containing this token String requestToken = post(getUrl("api/submitSearch"), new NameValuePair[] { new NameValuePair("plugin", "intellij"), new NameValuePair("version", AppUtil.getPluginVersion()), new NameValuePair("exception", searchString) }); BrowserUtil.launchBrowser(getUrl("api/search?token=" + requestToken)); } catch (RequestRejectedException e) { Messages.showMessageDialog("Connected to server but request was rejected", "Request rejected by the server", Messages.getInformationIcon()); } catch (IOException e) { Messages.showMessageDialog("Can't connect to the server", "Connection Problem", Messages.getInformationIcon()); } }
From source file:com.armhold.wicketsource.WicketSourceApplicationComponent.java
License:Apache License
private void initListenerAndSocket() { final int port = getPort(); try {/*w ww.j a v a 2 s.c o m*/ serverSocket = new ServerSocket(); serverSocket.bind(new InetSocketAddress("localhost", port)); log.info("WicketSource plugin listening on port: " + port); } catch (IOException e) { ApplicationManager.getApplication().invokeLater(new Runnable() { public void run() { Messages.showMessageDialog("WicketSource plugin: can't bind to port: " + port, "WicketSource Plugin Error", Messages.getErrorIcon()); } }); return; } Listener messageNotifier = new Listener(serverSocket); listener = new Thread(messageNotifier); listener.start(); }
From source file:com.atlassian.clover.idea.AboutDialog.java
License:Apache License
private void displayFile(URL url) { // use the file://title/path hack final String title = url.getHost() + " license"; final String path = url.getPath(); Reader reader;//from ww w . j a va 2 s.c o m try { reader = new BufferedReader(new InputStreamReader(getClass().getResourceAsStream(path), "UTF-8")); } catch (UnsupportedEncodingException e) { return; } final StringBuilder sb = new StringBuilder(); char[] buf = new char[1024]; int read = 0; try { try { while (read != -1) { sb.append(buf, 0, read); read = reader.read(buf); } } finally { reader.close(); } } catch (IOException e) { throw new RuntimeException(e); } Messages.showMessageDialog(sb.toString(), title, null); }
From source file:com.atlassian.theplugin.idea.config.MissingPasswordHandler.java
License:Apache License
public void go() { if (!isDialogShown && !shouldStop()) { isDialogShown = true;//from w ww .j a va 2 s. c o m boolean wasCanceled = false; boolean wasOk = false; for (ServerCfg server : projectCfgManager.getAllEnabledServers(serverFacade.getServerType())) { if (server.isComplete() || serversWithoutPassword.contains(server.getServerId()) || server.isUseDefaultCredentials()) { continue; } PasswordDialog dialog = new PasswordDialog(server, serverFacade, project); dialog.pack(); JPanel panel = dialog.getPasswordPanel(); int answer = JOptionPane.showConfirmDialog(JOptionPane.getRootFrame(), panel, PluginUtil.getInstance().getName(), OK_CANCEL_OPTION, PLAIN_MESSAGE); if (answer == JOptionPane.OK_OPTION) { String password = dialog.getPasswordString(); Boolean shouldPasswordBeStored = dialog.getShouldPasswordBeStored(); server.setPassword(password); server.setPasswordStored(shouldPasswordBeStored); server.setUsername(dialog.getUserName()); server.setUseDefaultCredentials(dialog.isUseDefaultCredentials()); wasOk = true; } else { wasCanceled = true; serversWithoutPassword.add(server.getServerId()); } } if (wasOk) { ThePluginApplicationComponent appComponent = IdeaHelper.getAppComponent(); appComponent.rescheduleStatusCheckers(true); } if (wasCanceled) { Messages.showMessageDialog( "You can always change password by changing plugin settings (Preferences | IDE Settings | " + PluginUtil.getInstance().getName() + ")", "Information", Messages.getInformationIcon()); } isDialogShown = false; } }
From source file:com.atlassian.theplugin.remoteapi.MissingPasswordHandlerJIRA.java
License:Apache License
public void go() { if (!isDialogShown) { isDialogShown = true;/*from www. j a va 2s . co m*/ boolean wasCanceled = false; // if (server.getIsConfigInitialized()) { // return; //???? // } PasswordDialog dialog = new PasswordDialog(server, serverFacade, project); dialog.pack(); JPanel panel = dialog.getPasswordPanel(); int answer = JOptionPane.CANCEL_OPTION; if (server.isUseDefaultCredentials()) { Messages.showInfoMessage(project, "Either do not use default credentials for " + server.getName() + " or change default credentials", PluginUtil.PRODUCT_NAME); } else { answer = JOptionPane.showConfirmDialog(JOptionPane.getRootFrame(), panel, PluginUtil.PRODUCT_NAME, OK_CANCEL_OPTION, PLAIN_MESSAGE); } if (!server.isUseDefaultCredentials() && answer == JOptionPane.OK_OPTION) { String password = dialog.getPasswordString(); Boolean shouldPasswordBeStored = dialog.getShouldPasswordBeStored(); server.setPassword(password); server.setPasswordStored(shouldPasswordBeStored); server.setUsername(dialog.getUserName()); } else { wasCanceled = true; } // so or so we assume that user provided password // server.transientSetIsConfigInitialized(true); if (wasCanceled && !server.isUseDefaultCredentials()) { Messages.showMessageDialog( "You can always change password by changing plugin settings (Preferences | IDE Settings | " + PluginUtil.getInstance().getName() + ")", "Information", Messages.getInformationIcon()); } isDialogShown = false; } }
From source file:com.cleverCloud.cleverIdea.vcs.CleverCheckoutProvider.java
License:Open Source License
@Override public void doCheckout(@NotNull Project project, @Nullable Listener listener) { if (!GitUtils.testGitExecutable(project)) return;//from w w w. j a va 2 s. co m BasicAction.saveAll(); List<Application> applicationList; CcApi ccApi = CcApi.getInstance(project); ccApi.login(); applicationList = getApplicationsFromOrga(project); if (applicationList == null || applicationList.size() == 0) { Messages.showMessageDialog( "No application is currently linked with you application. Impossible to clone and create a project.", "No Application Available", Messages.getErrorIcon()); return; } final CleverClone dialog = new CleverClone(project, applicationList); if (!dialog.showAndGet()) return; final VirtualFile destinationParent = LocalFileSystem.getInstance() .findFileByIoFile(new File(dialog.getParentDirectory())); if (destinationParent == null) return; final String sourceRepositoryURL = dialog.getRepositoryUrl(); final String directoryName = dialog.getDirectoryName(); final String parentDirectory = dialog.getParentDirectory(); Git git = ServiceManager.getService(Git.class); GitCheckoutProvider.clone(project, git, listener, destinationParent, sourceRepositoryURL, directoryName, parentDirectory); }
From source file:com.compoundtheory.intellij.tmux.actions.SelectPaneAction.java
License:Apache License
public void actionPerformed(AnActionEvent e) { //Messages.showMessageDialog("Selected " + target, "Information", Messages.getInformationIcon()); TmuxPlugin.currentTarget = this.target; Messages.showMessageDialog("Tmux Pane '" + this.title + "' selected.", "Tmux Pane Selected", Messages.getInformationIcon()); }
From source file:com.intellij.application.options.ExportSchemeAction.java
License:Apache License
public static <T extends Named, E extends ExternalizableScheme> void doExport(final E scheme, SchemesManager<T, E> manager) { if (scheme != null) { try {/* ww w . jav a 2 s. c o m*/ ShareSchemeDialog dialog = new ShareSchemeDialog(); dialog.init(scheme); dialog.show(); if (dialog.isOK()) { try { manager.exportScheme(scheme, dialog.getName(), dialog.getDescription()); Messages.showMessageDialog("Scheme '" + scheme.getName() + "' was shared successfully as '" + dialog.getName() + " '", "Share Scheme", Messages.getInformationIcon()); } catch (IOException e) { Messages.showErrorDialog( "Cannot share scheme '" + scheme.getName() + "': " + e.getLocalizedMessage(), "Share Shceme"); } } } catch (WriteExternalException e1) { Messages.showErrorDialog("Cannot share scheme: " + e1.getLocalizedMessage(), "Share Scheme"); } } }