List of usage examples for com.intellij.openapi.ui Messages showInfoMessage
public static void showInfoMessage(@Nullable Project project, @Nls String message, @NotNull @Nls(capitalization = Nls.Capitalization.Title) String title)
From source file:bazaar4idea.util.BzrErrorReportSubmitter.java
License:Apache License
/** * @noinspection ThrowablePrintStackTrace,ThrowableResultOfMethodCallIgnored *//*www .jav a2 s . co m*/ private static SubmittedReportInfo sendError(IdeaLoggingEvent event, Component parentComponent) { NotifierBean notifierBean = new NotifierBean(); ErrorBean errorBean = new ErrorBean(); errorBean.autoInit(); // errorBean.setLastAction(IdeaLogger.ourLastActionId); int threadId = 0; SubmittedReportInfo.SubmissionStatus submissionStatus = SubmittedReportInfo.SubmissionStatus.FAILED; final DataContext dataContext = DataManager.getInstance().getDataContext(parentComponent); Project project = PlatformDataKeys.PROJECT.getData(dataContext); String description = ""; do { // prepare try { ErrorReportSender sender = ErrorReportSender.getInstance(); // sender.prepareError(project, event.getThrowable()); // BzrSendErrorForm dlg = new BzrSendErrorForm(); dlg.setErrorDescription(description); dlg.show(); BzrErrorReportConfigurable reportConf = BzrErrorReportConfigurable.getInstance(); @NonNls String senderEmail = reportConf.EMAIL_ADDRESS; @NonNls String smtpServer = reportConf.SMTP_SERVER; @NonNls String itnLogin = reportConf.AUTH_USERNAME; @NonNls String itnPassword = reportConf.getPlainItnPassword(); notifierBean.setEmailAddress(senderEmail); notifierBean.setSmtpServer(smtpServer); notifierBean.setItnLogin(itnLogin); notifierBean.setItnPassword(itnPassword); // description = dlg.getErrorDescription(); String message = event.getMessage(); // @NonNls StringBuilder descBuilder = new StringBuilder(); if (description.length() > 0) { descBuilder.append("User description: ").append(description).append("\n"); } if (message != null) { descBuilder.append("Error message: ").append(message).append("\n"); } Throwable t = event.getThrowable(); if (t != null) { // final PluginId pluginId = IdeErrorsDialog.findPluginId(t); // if (pluginId != null) { // final IdeaPluginDescriptor ideaPluginDescriptor = ApplicationManager.getApplication().getPlugin(pluginId); // if (ideaPluginDescriptor != null && !ideaPluginDescriptor.isBundled()) { // descBuilder.append("Plugin version: ").append(ideaPluginDescriptor.getVersion()).append("\n"); // } // } } if (previousExceptionThreadId != 0) { descBuilder.append("Previous exception is: ").append(URL_HEADER) .append(previousExceptionThreadId).append("\n"); } if (wasException) { descBuilder.append("There was at least one exception before this one.\n"); } errorBean.setDescription(descBuilder.toString()); if (dlg.isShouldSend()) { threadId = sender.sendError(notifierBean, errorBean); previousExceptionThreadId = threadId; wasException = true; submissionStatus = SubmittedReportInfo.SubmissionStatus.NEW_ISSUE; Messages.showInfoMessage(parentComponent, BzrBundle.message("error.report.confirmation"), ERROR_REPORT); break; } else { break; } // } catch (NoSuchEAPUserException e) { // if (Messages.showYesNoDialog(parentComponent, DiagnosticBundle.message("error.report.authentication.failed"), // ReportMessages.ERROR_REPORT, Messages.getErrorIcon()) != 0) { // break; // } // } catch (InternalEAPException e) { // if (Messages.showYesNoDialog(parentComponent, DiagnosticBundle.message("error.report.posting.failed", e.getMessage()), // ReportMessages.ERROR_REPORT, Messages.getErrorIcon()) != 0) { // break; // } // } catch (IOException e) { // if (!IOExceptionDialog.showErrorDialog(BzrVcsMessages.message("error.report.exception.title"), // BzrVcsMessages.message("error.report.failure.message"))) { // break; // } // } catch (NewBuildException e) { // Messages.showMessageDialog(parentComponent, // DiagnosticBundle.message("error.report.new.eap.build.message", e.getMessage()), CommonBundle.getWarningTitle(), // Messages.getWarningIcon()); // break; } catch (Exception e) { LOG.info(e); if (Messages.showYesNoDialog(JOptionPane.getRootFrame(), BzrBundle.message("error.report.sending.failure"), ERROR_REPORT, Messages.getErrorIcon()) != 0) { break; } } } while (true); return new SubmittedReportInfo( submissionStatus != SubmittedReportInfo.SubmissionStatus.FAILED ? URL_HEADER + threadId : null, String.valueOf(threadId), submissionStatus); }
From source file:com.android.tools.idea.actions.AndroidImportProjectAction.java
License:Apache License
@Nullable private static AddModuleWizard importWithExtensions(@NotNull VirtualFile file) { List<ProjectImportProvider> available = getImportProvidersForTarget(file); if (available.isEmpty()) { Messages.showInfoMessage((Project) null, "Cannot import anything from " + file.getPath(), "Cannot Import"); return null; }//from w w w.j a v a 2 s. c o m String path; if (available.size() == 1) { path = available.get(0).getPathToBeImported(file); } else { path = ProjectImportProvider.getDefaultPath(file); } ProjectImportProvider[] availableProviders = available.toArray(new ProjectImportProvider[available.size()]); return new AddModuleWizard(null, path, availableProviders); }
From source file:com.android.tools.idea.actions.AndroidOpenFileAction.java
License:Apache License
@Override public void actionPerformed(AnActionEvent e) { Project project = e.getProject();/*from ww w. j a v a 2 s. com*/ boolean showFiles = project != null || PlatformProjectOpenProcessor.getInstanceIfItExists() != null; FileChooserDescriptor descriptor = showFiles ? new ProjectOrFileChooserDescriptor() : new ProjectOnlyFileChooserDescriptor(); descriptor.putUserData(PathChooserDialog.PREFER_LAST_OVER_EXPLICIT, showFiles); VirtualFile explicitPreferredDirectory = ((project != null) && !project.isDefault()) ? project.getBaseDir() : getUserHomeDir(); chooseFiles(descriptor, project, explicitPreferredDirectory, files -> { for (VirtualFile file : files) { if (!descriptor.isFileSelectable(file)) { String message = IdeBundle.message("error.dir.contains.no.project", file.getPresentableUrl()); Messages.showInfoMessage(project, message, IdeBundle.message("title.cannot.open.project")); return; } } doOpenFile(project, files); }); }
From source file:com.android.tools.idea.actions.annotations.InferSupportAnnotations.java
License:Apache License
public static void nothingFoundMessage(final Project project) { ApplicationManager.getApplication().invokeLater(new Runnable() { @Override// w ww .j a v a 2s. com public void run() { Messages.showInfoMessage(project, "Did not infer any new annotations", "Infer Support Annotation Results"); } }); }
From source file:com.android.tools.idea.fd.actions.SubmitFeedback.java
License:Apache License
@Override public void actionPerformed(AnActionEvent e) { Project project = e.getProject();/*from ww w . j ava 2 s. c o m*/ if (project == null) { Logger.getInstance(SubmitFeedback.class).info("Unable to identify current project"); return; } if (!InstantRunSettings.isInstantRunEnabled() || !InstantRunSettings.isRecorderEnabled()) { int result = Messages.showYesNoDialog(project, AndroidBundle.message("instant.run.flr.would.you.like.to.enable"), AndroidBundle.message("instant.run.flr.dialog.title"), "Yes, I'd like to help", "Cancel", Messages.getQuestionIcon()); if (result == Messages.NO) { return; } InstantRunSettings.setInstantRunEnabled(true); InstantRunSettings.setRecorderEnabled(true); Messages.showInfoMessage(project, AndroidBundle.message("instant.run.flr.howto"), AndroidBundle.message("instant.run.flr.dialog.title")); return; } InstantRunFeedbackDialog dialog = new InstantRunFeedbackDialog(project); boolean ok = dialog.showAndGet(); if (ok) { new Task.Backgroundable(project, "Submitting Instant Run Issue") { public CompletableFuture<String> myReport; @Override public void run(@NotNull ProgressIndicator indicator) { myReport = GoogleCrash.getInstance().submit(FlightRecorder.get(project), dialog.getIssueText(), dialog.getLogs()); while (!myReport.isDone()) { try { myReport.get(200, TimeUnit.MILLISECONDS); } catch (Exception ignored) { } if (indicator.isCanceled()) { return; } } } @Override public void onSuccess() { if (myReport.isDone()) { String reportId; try { reportId = myReport.getNow("00"); } catch (CancellationException e) { Logger.getInstance(SubmitFeedback.class) .info("Submission of flight recorder logs cancelled"); return; } catch (CompletionException e) { FLR_NOTIFICATION_GROUP.createNotification( "Unexpected error while submitting instant run logs: " + e.getMessage(), NotificationType.ERROR); Logger.getInstance(SubmitFeedback.class).info(e); return; } String message = String.format("<html>Thank you for submitting the bug report.<br>" + "If you would like to follow up on this report, please file a bug at <a href=\"bug\">b.android.com</a> and specify the report id '%1$s'<html>", reportId); FLR_NOTIFICATION_GROUP.createNotification("", message, NotificationType.INFORMATION, (notification, event) -> { Escaper escaper = UrlEscapers.urlFormParameterEscaper(); String comment = String.format("Build: %1$s\nInstant Run Report: %2$s", ApplicationInfo.getInstance().getFullVersion(), reportId); String url = String.format( "https://code.google.com/p/android/issues/entry?template=%1$s&comment=%2$s&status=New", escaper.escape("Android Studio Instant Run Bug"), escaper.escape(comment)); BrowserUtil.browse(url); }).notify(project); } } }.queue(); } }
From source file:com.aspiro.git.actions.GitTag.java
License:Apache License
public void perform(@NotNull Project project, GitVcs vcs, @NotNull List<VcsException> exceptions, @NotNull VirtualFile[] affectedFiles) throws VcsException { saveAll();// w w w . jav a2 s . co m if (!ProjectLevelVcsManager.getInstance(project).checkAllFilesAreUnder(vcs, affectedFiles)) return; final String tagName = Messages.showInputDialog(project, "Specify tag name", "Tag", Messages.getQuestionIcon()); if (tagName == null) return; //todo: support multiple roots? GitCommand command = new GitCommand(project, vcs.getSettings(), GitUtil.getVcsRoot(project, affectedFiles[0])); final String output = command.tag(tagName); if (output.trim().length() != 0) { Messages.showInfoMessage(project, output, "Result"); } }
From source file:com.atlassian.theplugin.idea.action.issues.RecentlyOpenIssuesAction.java
License:Apache License
@Override public void actionPerformed(final AnActionEvent e) { final Project project = IdeaHelper.getCurrentProject(e); if (project == null) { return;//from w w w .j av a 2 s . c om } final IssueListToolWindowPanel issuesWindow = IdeaHelper.getIssueListToolWindowPanel(e); if (issuesWindow == null) { return; } final JiraWorkspaceConfiguration conf = IdeaHelper.getProjectComponent(e, JiraWorkspaceConfiguration.class); if (conf == null) { return; } final List<IssueRecentlyOpenBean> recentlyOpenIssues = conf.getRecentlyOpenIssuess(); if (recentlyOpenIssues.size() > 0) { // prepare list of recentlyOpenIssues from the config list List<JiraIssueAdapter> issues = issuesWindow.getLoadedRecenltyOpenIssues(); ListPopup popup = JBPopupFactory.getInstance() .createListPopup(new IssueListPopupStep("Recently Viewed Issues", issues, issuesWindow)); // popup.showCenteredInCurrentWindow(project); that can cause NPE inside IDEA OpenAPI popup.showInCenterOf(e.getInputEvent().getComponent()); } else { Messages.showInfoMessage(project, "No recently viewed issues found.", PluginUtil.PRODUCT_NAME); } }
From source file:com.atlassian.theplugin.idea.config.ProjectConfigurationComponent.java
License:Apache License
private void migrateFileFromProjectRootToIdeaDirectory() { boolean migrationHappened = false; final File cfgFileInProjectRoot = new File(getCfgFilePathInProjectRootDirectory()); final File newCfgFile = new File(getCfgFilePath()); // note that this will always be false when using file-based project configuration, as both paths are equal if (cfgFileInProjectRoot.exists() && !newCfgFile.exists()) { try {//from w w w . j a v a 2 s .c o m FileUtils.moveFile(cfgFileInProjectRoot, newCfgFile); migrationHappened = true; } catch (IOException e) { handleServerCfgFactoryException(project, e); } } if (migrationHappened) { ApplicationManager.getApplication().invokeLater(new Runnable() { public void run() { Messages.showInfoMessage(project, "The Atlassian IDE Connector configuration file has been moved from " + getCfgFilePathInProjectRootDirectory() + " to " + getCfgFilePath() + ". If it was under version control, please make " + "the appropriate changes to reflect this.", PluginUtil.PRODUCT_NAME + " upgrade process"); } }); } }
From source file:com.atlassian.theplugin.idea.config.ProjectConfigurationPanel.java
License:Apache License
public void saveData(boolean finalizeData) { if (finalizeData) { serverConfigPanel.finalizeData(); }/*from ww w. j a v a2 s. com*/ serverConfigPanel.saveData(); if (!projectConfiguration.isDefaultFishEyeServerValid()) { projectConfiguration.setDefaultFishEyeServerId(null); if (this.isShowing()) { Messages.showInfoMessage(this, "Default FishEye server settings have been cleared.", "Information"); } } if (!projectConfiguration.isDefaultJiraServerValid()) { projectConfiguration.setDefaultJiraServerId(null); if (this.isShowing()) { Messages.showInfoMessage(this, "Default JIRA server settings have been cleared.", "Information"); } } }
From source file:com.atlassian.theplugin.idea.config.serverconfig.defaultCredentials.TestDefaultCredentialsDialog.java
License:Apache License
public void testConnection() { if (servers == null || servers.size() == 0) { Messages.showInfoMessage(project, "No server uses default credentials", PluginUtil.PRODUCT_NAME); return;/*from w ww . j a v a 2s . co m*/ } for (ServerDataExt serverDataExt : servers) { TestConnectionThread thread = new TestConnectionThread("testing connection", new LocalTestConnectionProcessor(serverDataExt), serverDataExt); threads.add(thread); thread.start(); } super.show(); for (Thread thread : threads) { if (thread.isInterrupted()) { thread.interrupt(); } } }