Example usage for com.intellij.openapi.ui Messages showInfoMessage

List of usage examples for com.intellij.openapi.ui Messages showInfoMessage

Introduction

In this page you can find the example usage for com.intellij.openapi.ui Messages showInfoMessage.

Prototype

public static void showInfoMessage(@Nullable Project project, @Nls String message,
        @NotNull @Nls(capitalization = Nls.Capitalization.Title) String title) 

Source Link

Document

Shows dialog with given message and title, information icon #getInformationIcon() and OK button

Usage

From source file:org.jetbrains.android.exportSignedPackage.ExportSignedPackageWizard.java

License:Apache License

private void createAndAlignApk(final String apkPath) {
    AndroidPlatform platform = getFacet().getConfiguration().getAndroidPlatform();
    assert platform != null;
    String sdkPath = platform.getSdkData().getLocation();
    String zipAlignPath = sdkPath + File.separatorChar + AndroidCommonUtils.toolPath(SdkConstants.FN_ZIPALIGN);
    File zipalign = new File(zipAlignPath);
    final boolean runZipAlign = zipalign.isFile();
    File destFile = null;/*from   w w  w  .  j  a va 2s.c  o  m*/
    try {
        destFile = runZipAlign ? FileUtil.createTempFile("android", ".apk") : new File(apkPath);
        createApk(destFile);
    } catch (Exception e) {
        showErrorInDispatchThread(e.getMessage());
    }
    if (destFile == null)
        return;

    if (runZipAlign) {
        File realDestFile = new File(apkPath);
        final String message = AndroidCommonUtils.executeZipAlign(zipAlignPath, destFile, realDestFile);
        if (message != null) {
            showErrorInDispatchThread(message);
            return;
        }
    }
    ApplicationManager.getApplication().invokeLater(new Runnable() {
        @Override
        public void run() {
            String title = AndroidBundle.message("android.export.package.wizard.title");
            final Project project = getProject();
            final File apkFile = new File(apkPath);

            final VirtualFile vApkFile = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(apkFile);
            if (vApkFile != null) {
                vApkFile.refresh(true, false);
            }

            if (!runZipAlign) {
                Messages.showWarningDialog(project,
                        AndroidCommonBundle.message("android.artifact.building.cannot.find.zip.align.error"),
                        title);
            }

            if (ShowFilePathAction.isSupported()) {
                if (Messages.showOkCancelDialog(project,
                        AndroidBundle.message("android.export.package.success.message", apkFile.getName()),
                        title, RevealFileAction.getActionName(), IdeBundle.message("action.close"),
                        Messages.getInformationIcon()) == Messages.OK) {
                    ShowFilePathAction.openFile(apkFile);
                }
            } else {
                Messages.showInfoMessage(project,
                        AndroidBundle.message("android.export.package.success.message", apkFile), title);
            }
        }
    }, ModalityState.NON_MODAL);
}

From source file:org.jetbrains.android.sdk.AndroidSdkData.java

License:Apache License

@Nullable
public static AndroidSdkData parse(@NotNull String path, @NotNull final Component component) {
    MessageBuildingSdkLog log = new MessageBuildingSdkLog();
    AndroidSdkData sdkData = parse(path, log);
    if (sdkData == null) {
        String message = log.getErrorMessage();
        if (message.length() > 0) {
            message = "Android SDK is parsed incorrectly. Parsing log:\n" + message;
            Messages.showInfoMessage(component, message, CommonBundle.getErrorTitle());
        }//  w ww .  j  av a 2  s.c  o m
    }
    return sdkData;
}

From source file:org.jetbrains.idea.svn.actions.MarkResolvedAction.java

License:Apache License

protected void batchPerform(Project project, SvnVcs activeVcs, VirtualFile[] files, DataContext context)
        throws VcsException {
    SvnVcs vcs = SvnVcs.getInstance(project);
    ApplicationManager.getApplication().saveAll();
    Collection<String> paths = collectResolvablePaths(vcs, files);
    if (paths.isEmpty()) {
        Messages.showInfoMessage(project, SvnBundle.message("message.text.no.conflicts.found"),
                SvnBundle.message("message.title.no.conflicts.found"));
        return;/*from w ww.j ava 2  s  . c o m*/
    }
    String[] pathsArray = ArrayUtil.toStringArray(paths);
    SelectFilesDialog dialog = new SelectFilesDialog(project,
            SvnBundle.message("label.select.files.and.directories.to.mark.resolved"),
            SvnBundle.message("dialog.title.mark.resolved"), SvnBundle.message("action.name.mark.resolved"),
            pathsArray, "vcs.subversion.resolve");
    dialog.show();
    if (!dialog.isOK()) {
        return;
    }
    pathsArray = dialog.getSelectedPaths();
    try {
        for (String path : pathsArray) {
            File ioFile = new File(path);
            ConflictClient client = vcs.getFactory(ioFile).createConflictClient();

            // TODO: Probably false should be passed to "resolveTree", but previous logic used true implicitly
            client.resolve(ioFile, SVNDepth.EMPTY, true, true, true);
        }
    } finally {
        for (VirtualFile file : files) {
            VcsDirtyScopeManager.getInstance(project).fileDirty(file);
            file.refresh(true, false);
            if (file.getParent() != null) {
                file.getParent().refresh(true, false);
            }
        }

    }
}

From source file:org.jetbrains.idea.svn.actions.ShareProjectAction.java

License:Apache License

private static boolean performImpl(final Project project, final SvnVcs activeVcs, final VirtualFile file)
        throws VcsException {
    final ShareDialog shareDialog = new ShareDialog(project, file.getName());
    shareDialog.show();/* w  ww.j  av a 2  s  .  c  o m*/

    final String parent = shareDialog.getSelectedURL();
    if (shareDialog.isOK() && parent != null) {
        final Ref<Boolean> actionStarted = new Ref<Boolean>(Boolean.TRUE);
        final Exception[] error = new Exception[1];

        final ShareDialog.ShareTarget shareTarget = shareDialog.getShareTarget();
        final ProgressManager progressManager = ProgressManager.getInstance();

        if (ShareDialog.ShareTarget.useSelected.equals(shareTarget)) {
            final boolean folderEmpty = checkRemoteFolder(project, activeVcs, parent, progressManager);

            if (!folderEmpty) {
                final int promptAnswer = Messages.showYesNoDialog(project,
                        "Remote folder \"" + parent + "\" is not empty.\nDo you want to continue sharing?",
                        "Share directory", Messages.getWarningIcon());
                if (Messages.YES != promptAnswer)
                    return false;
            }
        }

        final WorkingCopyFormat format = SvnCheckoutProvider
                .promptForWCopyFormat(VfsUtilCore.virtualToIoFile(file), project);
        actionStarted.set(format != WorkingCopyFormat.UNKNOWN);
        // means operation cancelled
        if (format == WorkingCopyFormat.UNKNOWN) {
            return true;
        }

        ExclusiveBackgroundVcsAction.run(project, new Runnable() {
            public void run() {
                progressManager.runProcessWithProgressSynchronously(new Runnable() {
                    public void run() {
                        try {
                            final ProgressIndicator indicator = ProgressManager.getInstance()
                                    .getProgressIndicator();
                            final File path = new File(file.getPath());

                            SvnWorkingCopyFormatHolder.setPresetFormat(format);

                            final SVNURL parenUrl = SVNURL.parseURIEncoded(parent);
                            final SVNURL checkoutUrl;
                            final SVNRevision revision;
                            final String commitText = shareDialog.getCommitText();
                            if (ShareDialog.ShareTarget.useSelected.equals(shareTarget)) {
                                checkoutUrl = parenUrl;
                                revision = SVNRevision.HEAD;
                            } else if (ShareDialog.ShareTarget.useProjectName.equals(shareTarget)) {
                                final Pair<SVNRevision, SVNURL> pair = createRemoteFolder(activeVcs, parenUrl,
                                        file.getName(), commitText);
                                revision = pair.getFirst();
                                checkoutUrl = pair.getSecond();
                            } else {
                                final Pair<SVNRevision, SVNURL> pair = createRemoteFolder(activeVcs, parenUrl,
                                        file.getName(), commitText);
                                final Pair<SVNRevision, SVNURL> trunkPair = createRemoteFolder(activeVcs,
                                        pair.getSecond(), "trunk", commitText);
                                checkoutUrl = trunkPair.getSecond();
                                revision = trunkPair.getFirst();

                                if (shareDialog.createStandardStructure()) {
                                    createRemoteFolder(activeVcs, pair.getSecond(), "branches", commitText);
                                    createRemoteFolder(activeVcs, pair.getSecond(), "tags", commitText);
                                }
                            }

                            if (indicator != null) {
                                indicator.checkCanceled();
                                indicator.setText(SvnBundle.message(
                                        "share.directory.checkout.back.progress.text", checkoutUrl.toString()));
                            }

                            final ClientFactory factory = SvnCheckoutProvider.getFactory(activeVcs, format);

                            factory.createCheckoutClient().checkout(SvnTarget.fromURL(checkoutUrl), path,
                                    revision, SVNDepth.INFINITY, false, false, format, null);
                            addRecursively(activeVcs, factory, file);
                        } catch (SVNException e) {
                            error[0] = e;
                        } catch (VcsException e) {
                            error[0] = e;
                        } finally {
                            activeVcs.invokeRefreshSvnRoots();
                            SvnWorkingCopyFormatHolder.setPresetFormat(null);
                        }
                    }
                }, SvnBundle.message("share.directory.title"), true, project);
            }
        });

        if (Boolean.TRUE.equals(actionStarted.get())) {
            if (error[0] != null) {
                throw new VcsException(error[0].getMessage());
            }
            Messages.showInfoMessage(project, SvnBundle.message("share.directory.info.message", file.getName()),
                    SvnBundle.message("share.directory.title"));
        }
        return true;
    }
    return false;
}

From source file:org.jetbrains.idea.svn.config.SvnConfigureProxiesDialog.java

License:Apache License

public void execute(final String url) {
    Messages.showInfoMessage(myProject,
            SvnBundle.message("dialog.edit.http.proxies.settings.test.connection.settings.will.be.stored.text"),
            SvnBundle.message(//from  w  ww .j  a  va 2 s  . c  o m
                    "dialog.edit.http.proxies.settings.test.connection.settings.will.be.stored.title"));
    if (!applyImpl()) {
        return;
    }
    final Ref<SVNException> excRef = new Ref<SVNException>();
    final ProgressManager pm = ProgressManager.getInstance();
    pm.runProcessWithProgressSynchronously(new Runnable() {
        public void run() {
            final ProgressIndicator pi = pm.getProgressIndicator();
            if (pi != null) {
                pi.setText("Connecting to " + url);
            }
            SVNRepository repository = null;
            try {
                repository = SvnVcs.getInstance(myProject).createRepository(url);
                repository.testConnection();
            } catch (SVNException exc) {
                excRef.set(exc);
            } finally {
                if (repository != null) {
                    repository.closeSession();
                }
            }
        }
    }, "Test connection", true, myProject);
    if (!excRef.isNull()) {
        Messages.showErrorDialog(myProject, excRef.get().getMessage(),
                SvnBundle.message("dialog.edit.http.proxies.settings.test.connection.error.title"));
    } else {
        Messages.showInfoMessage(myProject,
                SvnBundle.message("dialog.edit.http.proxies.settings.test.connection.succes.text"),
                SvnBundle.message("dialog.edit.http.proxies.settings.test.connection.succes.title"));
    }
}

From source file:org.jetbrains.idea.svn.dialogs.RepositoryBrowserDialog.java

License:Apache License

private void showDiffEditorResults(final Map<String, Change> changes, String sourceTitle, String targetTitle,
        final SVNURL sourceUrl, final SVNURL targetUrl, final long revision) {
    if (changes.isEmpty()) {
        // display no changes dialog.
        final String text = SvnBundle.message("repository.browser.compare.no.difference.message", sourceTitle,
                targetTitle);//from   w  ww  .  j a  v  a 2  s  .  co  m
        SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                Messages.showInfoMessage(myProject, text,
                        SvnBundle.message("repository.browser.compare.no.difference.title"));
            }
        });
        return;
    }
    final Collection<Change> changesList = changes.values();
    /*final Collection<Change> changesListConverted = new ArrayList<Change>(changesList.size());
    for (Change change : changesList) {
      final FilePath path = ChangesUtil.getFilePath(change);
      final Change newChange = new Change(
          new UrlContentRevision(change.getBeforeRevision(),
                         FilePathImpl.createNonLocal(SVNPathUtil.append(sourceUrl.toString(), path.getName()), path.isDirectory()), revision),
          new UrlContentRevision(change.getAfterRevision(),
                         FilePathImpl.createNonLocal(SVNPathUtil.append(targetUrl.toString(), path.getName()), path.isDirectory()), revision));
      changesListConverted.add(newChange);
    }*/

    final String title = SvnBundle.message("repository.browser.compare.title", sourceTitle, targetTitle);
    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            final ChangeListViewerDialog dlg = new ChangeListViewerDialog(myRepositoryBrowser, myProject,
                    changesList, true);
            dlg.setTitle(title);
            dlg.setConvertor(new NotNullFunction<Change, Change>() {
                @NotNull
                public Change fun(final Change change) {
                    final FilePath path = ChangesUtil.getFilePath(change);

                    return new Change(
                            new UrlContentRevision(change.getBeforeRevision(),
                                    FilePathImpl.createNonLocal(
                                            SVNPathUtil.append(sourceUrl.toString(), path.getPath()),
                                            path.isDirectory()),
                                    revision),
                            new UrlContentRevision(change.getAfterRevision(),
                                    FilePathImpl.createNonLocal(
                                            SVNPathUtil.append(targetUrl.toString(), path.getPath()),
                                            path.isDirectory()),
                                    revision));
                }
            });
            dlg.show();
        }
    });
}

From source file:org.jetbrains.plugins.github.util.GithubNotifications.java

License:Apache License

public static void showInfoDialog(final @Nullable Project project, final @NotNull String title,
        final @NotNull String message) {
    LOG.info(title + "; " + message);
    Messages.showInfoMessage(project, message, title);
}

From source file:org.jetbrains.plugins.github.util.GithubNotifications.java

License:Apache License

public static void showInfoDialog(final @NotNull Component component, final @NotNull String title,
        final @NotNull String message) {
    LOG.info(title + "; " + message);
    Messages.showInfoMessage(component, message, title);
}

From source file:org.jetbrains.plugins.github.util.GithubNotifications.java

License:Apache License

public static void showErrorDialog(final @NotNull Component component, final @NotNull String title,
        final @NotNull Exception e) {
    LOG.info(title, e);//  w ww.  j a  v a  2  s  .com
    Messages.showInfoMessage(component, getErrorTextFromException(e), title);
}

From source file:org.jetbrains.plugins.ruby.ruby.codeInsight.symbols.actions.ClearSymbolCachesAction.java

License:Apache License

@Override
public void actionPerformed(AnActionEvent e) {
    final Project project = e.getData(DataKeys.PROJECT);
    if (project == null) {
        return;//from  w  w w .ja  va 2  s.c  om
    }
    SymbolsCache.getInstance(project).clearCaches();
    Messages.showInfoMessage(project, "Symbol caches have been cleared", "Debug Tools");
}