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:com.atlassian.theplugin.idea.config.serverconfig.GenericServerConfigForm.java

License:Apache License

public void emptyURLMessage() {

    ApplicationManager.getApplication().executeOnPooledThread(new Runnable() {
        public void run() {

            final ModalityState modalityState = ModalityState.stateForComponent(rootComponent);
            ApplicationManager.getApplication().invokeAndWait(new Runnable() {
                public void run() {
                    Messages.showInfoMessage(project,
                            "<html>Server <b>" + serverCfg.getName() + "</b> will be disabled</b>",
                            "Empty server URL");
                }/*from  w  w w  .jav a 2s .  c  om*/

            }, modalityState);
        }
    });
}

From source file:com.atlassian.theplugin.idea.config.TestDefaultCredentials.java

License:Apache License

public void run(Collection<ServerDataExt> servers) {

    if (servers != null && servers.size() > 0) {
        for (ServerDataExt server : servers) {
            switch (server.getServerType()) {

            case BAMBOO_SERVER:
                testGenericConnection(server.getServerData(), bambooServerFacade);
                break;
            case JIRA_SERVER:
                testGenericConnection(server.getServerData(), jiraServerFacade);
                break;
            default:
                PluginUtil.getLogger().warn("Unknown host type " + server);
            }/*from   w w w.  jav a 2  s.co  m*/
        }

        final ArrayList<ServerData> serverDatas = MiscUtil.buildArrayList();
        for (ServerDataExt server : servers) {
            serverDatas.add(server.getServerData());
        }

        final DefaultCredentialsServerList list = new DefaultCredentialsServerList(
                "Default credentials tests result", serverDatas);
        ListPopup popup = JBPopupFactory.getInstance().createListPopup(list);
        //      popup.showCenteredInCurrentWindow(project); that can cause NPE inside IDEA OpenAPI
        popup.showInCenterOf(parentComponent);
    } else {
        Messages.showInfoMessage(project, "None of servers configuration use default credentials",
                "Default credentials");
    }
}

From source file:com.atlassian.theplugin.remoteapi.MissingPasswordHandlerJIRA.java

License:Apache License

public void go() {

    if (!isDialogShown) {

        isDialogShown = true;//w ww. ja v  a 2 s.c om
        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.igormaznitsa.ideamindmap.editor.MindMapDialogProvider.java

License:Apache License

@Override
public void msgInfo(final String text) {
    Messages.showInfoMessage(this.project, text, "Info");
}

From source file:com.intellij.codeInspection.inferNullity.NullityInferrer.java

License:Apache License

public boolean nothingFoundMessage(final Project project) {
    if (myNullableSet.isEmpty() && myNotNullSet.isEmpty()) {
        if (ApplicationManager.getApplication().isUnitTestMode()) {
            throw new RuntimeException(NOTHING_FOUND_TO_INFER);
        }//from   w w  w.j a v a2s  .c o  m
        SwingUtilities.invokeLater(new Runnable() {
            @Override
            public void run() {
                Messages.showInfoMessage(project, "No places found to infer @Nullable/@NotNull",
                        "Infer Nullity Results");
            }
        });
        return true;
    }
    return false;
}

From source file:com.intellij.codeInspection.ui.actions.InvokeQuickFixAction.java

License:Apache License

@Override
public void actionPerformed(AnActionEvent e) {
    InspectionToolWrapper toolWrapper = myView.getTree().getSelectedToolWrapper();
    assert toolWrapper != null;
    final QuickFixAction[] quickFixes = myView.getProvider().getQuickFixes(toolWrapper, myView.getTree());
    if (quickFixes == null || quickFixes.length == 0) {
        Messages.showInfoMessage(myView, "There are no applicable quickfixes", "Nothing found to fix");
        return;/* ww w .j a  va 2s  . co  m*/
    }
    ActionGroup fixes = getFixes(quickFixes);
    DataContext dataContext = e.getDataContext();
    final ListPopup popup = JBPopupFactory.getInstance().createActionGroupPopup(
            InspectionsBundle.message("inspection.tree.popup.title"), fixes, dataContext,
            JBPopupFactory.ActionSelectionAid.SPEEDSEARCH, false);
    InspectionResultsView.showPopup(e, popup);
}

From source file:com.intellij.conversion.impl.ConversionServiceImpl.java

License:Apache License

@Override
@NotNull//from ww  w .j a  v  a 2s .c  om
public ConversionResult convertModule(@NotNull final Project project, @NotNull final File moduleFile) {
    final IProjectStore stateStore = ((ProjectImpl) project).getStateStore();
    final String url = stateStore.getPresentableUrl();
    assert url != null : project;
    final String projectPath = FileUtil.toSystemDependentName(url);

    if (!isConversionNeeded(projectPath, moduleFile)) {
        return ConversionResultImpl.CONVERSION_NOT_NEEDED;
    }

    final int res = Messages.showYesNoDialog(project,
            IdeBundle.message("message.module.file.has.an.older.format.do.you.want.to.convert.it"),
            IdeBundle.message("dialog.title.convert.module"), Messages.getQuestionIcon());
    if (res != Messages.YES) {
        return ConversionResultImpl.CONVERSION_CANCELED;
    }
    if (!moduleFile.canWrite()) {
        Messages.showErrorDialog(project,
                IdeBundle.message("error.message.cannot.modify.file.0", moduleFile.getAbsolutePath()),
                IdeBundle.message("dialog.title.convert.module"));
        return ConversionResultImpl.ERROR_OCCURRED;
    }

    try {
        ConversionContextImpl context = new ConversionContextImpl(projectPath);
        final List<ConversionRunner> runners = createConversionRunners(context, Collections.<String>emptySet());
        final File backupFile = ProjectConversionUtil.backupFile(moduleFile);
        List<ConversionRunner> usedRunners = new ArrayList<ConversionRunner>();
        for (ConversionRunner runner : runners) {
            if (runner.isModuleConversionNeeded(moduleFile)) {
                runner.convertModule(moduleFile);
                usedRunners.add(runner);
            }
        }
        context.saveFiles(Collections.singletonList(moduleFile), usedRunners);
        Messages.showInfoMessage(project,
                IdeBundle.message(
                        "message.your.module.was.successfully.converted.br.old.version.was.saved.to.0",
                        backupFile.getAbsolutePath()),
                IdeBundle.message("dialog.title.convert.module"));
        return new ConversionResultImpl(runners);
    } catch (CannotConvertException e) {
        LOG.info(e);
        Messages.showErrorDialog(IdeBundle.message("error.cannot.load.project", e.getMessage()),
                "Cannot Convert Module");
        return ConversionResultImpl.ERROR_OCCURRED;
    } catch (IOException e) {
        LOG.info(e);
        return ConversionResultImpl.ERROR_OCCURRED;
    }
}

From source file:com.intellij.dvcs.ui.CloneDvcsDialog.java

License:Apache License

private void test() {
    myTestURL = getCurrentUrlText();// w w w . ja va 2s. com
    boolean testResult = test(myTestURL);

    if (testResult) {
        Messages.showInfoMessage(myTestButton, DvcsBundle.message("clone.test.success.message", myTestURL),
                DvcsBundle.message("clone.test.connection.title"));
        myTestResult = Boolean.TRUE;
    } else {
        myTestResult = Boolean.FALSE;
    }
    updateButtons();
}

From source file:com.intellij.history.integration.ui.views.RecentChangesPopup.java

License:Apache License

public void show() {
    List<RecentChange> cc = myVcs.getRecentChanges(myGateway.createTransientRootEntry());
    if (cc.isEmpty()) {
        Messages.showInfoMessage(myProject, LocalHistoryBundle.message("recent.changes.to.changes"),
                getTitle());/*from w w w . j  av a 2s .  c  o m*/
        return;
    }

    final JList list = new JBList(createModel(cc));
    list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    list.setCellRenderer(new RecentChangesListCellRenderer());

    Runnable selectAction = new Runnable() {
        public void run() {
            RecentChange c = (RecentChange) list.getSelectedValue();
            showRecentChangeDialog(c);
        }
    };

    showList(list, selectAction);
}

From source file:com.intellij.ide.actions.ImportModuleAction.java

License:Apache License

@Nullable
public static AddModuleWizard createImportWizard(final Project project, @Nullable Component dialogParent,
        final VirtualFile file, ProjectImportProvider... providers) {
    List<ProjectImportProvider> available = ContainerUtil.filter(providers,
            new Condition<ProjectImportProvider>() {
                @Override//from  w  w w.  j  ava  2  s  .  c  o  m
                public boolean value(ProjectImportProvider provider) {
                    return provider.canImport(file, project);
                }
            });
    if (available.isEmpty()) {
        Messages.showInfoMessage(project, "Cannot import anything from " + file.getPath(), "Cannot Import");
        return null;
    }

    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 dialogParent == null ? new AddModuleWizard(project, path, availableProviders)
            : new AddModuleWizard(project, dialogParent, path, availableProviders);
}