Example usage for com.intellij.openapi.ui MessageType INFO

List of usage examples for com.intellij.openapi.ui MessageType INFO

Introduction

In this page you can find the example usage for com.intellij.openapi.ui MessageType INFO.

Prototype

MessageType INFO

To view the source code for com.intellij.openapi.ui MessageType INFO.

Click Source Link

Usage

From source file:SelectorChapekAction.java

License:Apache License

private void showInfoDialog(String text, AnActionEvent e) {
    StatusBar statusBar = WindowManager.getInstance()
            .getStatusBar(DataKeys.PROJECT.getData(e.getDataContext()));

    if (statusBar != null) {
        JBPopupFactory.getInstance().createHtmlTextBalloonBuilder(text, MessageType.INFO, null)
                .setFadeoutTime(10000).createBalloon()
                .show(RelativePoint.getCenterOf(statusBar.getComponent()), Balloon.Position.atRight);
    }/*from  www  . ja v a2  s  .  c o  m*/
}

From source file:brainleg.app.intellij.BLProjectComponent.java

License:Apache License

public void showBrainLegNotification(String exceptionChainForNotification, boolean firstTimeInThisSession,
        SearchResults searchResults, ExceptionTabMode mode, String exceptionHash) {
    if (BLSettingsService.getSettings().dontShowNotificationsFullTracesNoLinesMD5s.contains(exceptionHash)) {
        //this exception was marked as don't show notifications for, so.. don't show anything!
        System.out.println(/*from w  w  w. ja v a2s.  com*/
                "not even going to try to show notification - it is in the 'don't show notification' list.");
        return;
    }

    String notificationText;
    Long expireAfterMS = null;
    if (firstTimeInThisSession) {
        if (mode == ExceptionTabMode.GOT_SEARCH_RESULTS) {
            if (searchResults != null && (searchResults.totalMatches > 0 || searchResults.hasTip)) {
                //if we found something useful keep it until user clicks on it
                notificationText = "<b>" + exceptionChainForNotification + "</b>: BrainLeg found <b>"
                        + searchResults.totalMatches + "</b> search results";
            } else {
                //expire soon because it does not contain anything useful, just FYI
                notificationText = "<b>" + exceptionChainForNotification + "</b> - no results found";
                expireAfterMS = (long) 2 * 1000;
            }
        } else if (mode == ExceptionTabMode.NO_AUTOMATIC_SEARCH_BECAUSE_PROJECT_SPECIFIC_EXCEPTION
                || mode == ExceptionTabMode.NO_AUTOMATIC_SEARCH_SETTING) {
            //if we are not making automatic search then show notification until user clicks on it - so that he knows to make a manual search
            notificationText = "<b>" + exceptionChainForNotification + "</b>";
        } else {
            notificationText = "<b>" + exceptionChainForNotification + "</b>";
            expireAfterMS = (long) 2 * 1000;
        }
    } else {
        notificationText = "Another occurrence of <b>" + exceptionChainForNotification + "</b>";
        expireAfterMS = (long) 2 * 1000;
    }

    final Notification notification = NOTIFICATION_GROUP.createNotification(notificationText, MessageType.INFO);
    notification.notify(myProject);
    if (expireAfterMS != null) {
        final Long finalExpireAfterMS = expireAfterMS;
        executor.execute(new Runnable() {
            public void run() {
                pause(finalExpireAfterMS);
                notification.expire();
                notification.hideBalloon();
            }
        });
    }

}

From source file:com.android.tools.idea.npw.deprecated.WrapArchiveOptionsStep.java

License:Apache License

private void updateStep(@NotNull ValidationStatus result) {
    myResult = result;/*from w w  w  .  j a  v a 2  s . c  o m*/
    String message = "";
    Icon icon = null;
    if (!myIsFirstUIUpdate && (result.getMessageType() != MessageType.INFO)) {
        message = getValidationMessage(result);
        icon = result.getMessageType().getDefaultIcon();
    }
    myIsFirstUIUpdate = false;
    myValidationStatus.setText(message);
    myValidationStatus.setIcon(icon);

    myRemoveOriginalFileCheckBox.setVisible(result == ValidationStatus.IN_MODULE);
    myReplaceFileDependencyWithCheckBox.setVisible(result == ValidationStatus.IN_MODULE);

    fireStateChanged();
}

From source file:com.android.tools.idea.npw.importing.ModuleListModel.java

License:Apache License

@Nullable
public MessageType getStatusSeverity(ModuleToImport module) {
    ModuleValidationState state = getModuleState(module);
    switch (state) {
    case OK:/*from   ww w . ja  v a2s. c o  m*/
    case NULL:
        return null;
    case NOT_FOUND:
    case DUPLICATE_MODULE_NAME:
    case INVALID_NAME:
        return MessageType.ERROR;
    case ALREADY_EXISTS:
        return getSelectedModules().contains(module) ? MessageType.ERROR : MessageType.WARNING;
    case REQUIRED:
        return MessageType.INFO;
    }
    throw new IllegalArgumentException(state.name());
}

From source file:com.android.tools.idea.welcome.wizard.JdkLocationStep.java

License:Apache License

public JdkLocationStep(@NotNull ScopedStateStore.Key<String> pathKey, @NotNull FirstRunWizardMode mode) {
    super("Java Settings");
    myPathKey = pathKey;//from   ww w .j  a  v  a 2s  . c o  m
    myMode = mode;
    myDownloadPageLink.setText(getLinkText());
    WelcomeUIUtils.makeButtonAHyperlink(myDownloadPageLink, Jdks.DOWNLOAD_JDK_7_URL);
    myDownloadPageLink.getParent().invalidate();
    setComponent(myContents);
    myError.setForeground(JBColor.red);
    FileChooserDescriptor folderDescriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor();
    myJdkPath.addBrowseFolderListener("Select JDK Location", "Select compatible JDK location", null,
            folderDescriptor);
    myError.setText(null);
    myDetectButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            myDetectButton.setEnabled(false);
            JdkDetection.startWithProgressIndicator(new JdkDetection.JdkDetectionResult() {
                @Override
                public void onSuccess(String newJdkPath) {
                    if (newJdkPath == null) {
                        String message = AndroidBundle
                                .message("android.wizard.jdk.autodetect.result.not.found");
                        ExternalSystemUiUtil.showBalloon(myJdkPath, MessageType.INFO, message);
                    } else {
                        myJdkPath.setText(newJdkPath);
                    }
                    myDetectButton.setEnabled(true);
                }

                @Override
                public void onCancel() {
                    myDetectButton.setEnabled(true);
                }
            });
        }
    });
}

From source file:com.arcbees.plugin.idea.moduletypes.CreateProjectBuilder.java

License:Apache License

@Override
public void moduleCreated(@NotNull Module module) {
    project = module.getProject();/*from   ww w.jav  a 2 s  .  c o  m*/

    final File workingDir;
    try {
        workingDir = FileUtil.createTempDirectory("archetype", "tmp");
        workingDir.deleteOnExit();
    } catch (IOException e) {
        displayBalloon("Error generating project. 100", MessageType.ERROR);
        e.printStackTrace();
        return;
    }

    try {
        generateArchetype(project, workingDir);
    } catch (MavenInvocationException e) {
        displayBalloon("Error generating project. 101", MessageType.ERROR);
        e.printStackTrace();
    }

    importProject(project);

    displayBalloon("Finished generating project.", MessageType.INFO);
}

From source file:com.arcbees.plugin.idea.moduletypes.CreateProjectBuilder.java

License:Apache License

private void importProject(Project project) {
    String baseDir = project.getBasePath();
    File baseDirFile = new File(baseDir);
    String baseDirPath = baseDirFile.getPath();

    MavenProjectBuilder mavenProjectBuilder = new MavenProjectBuilder();
    try {//from w ww . j  a  va  2 s  .c  o  m
        mavenProjectBuilder.setRootDirectory(project, baseDirPath);
    } catch (ConfigurationException e) {
        displayBalloon("Error running maven builder. 105", MessageType.INFO);
        e.printStackTrace();
    }

    MavenProjectsManager manager = MavenProjectsManager.getInstance(project);

    File pomFile = new File(baseDirPath + File.separator + "pom.xml");
    VirtualFile virtualFile = VfsUtil.findFileByIoFile(pomFile, true);

    manager.addManagedFiles(Collections.singletonList(virtualFile));
}

From source file:com.github.intelliguard.util.UiUtils.java

License:Apache License

public static void showInfoBallon(final Project project, final String text) {
    Runnable r = new Runnable() {
        public void run() {
            ToolWindowManager.getInstance(project).notifyByBalloon(GuardProjectComponent.TOOLWINDOW_ID,
                    MessageType.INFO, text);
        }/*from  w w w  .ja  v a 2  s .c o  m*/
    };
    ApplicationManager.getApplication().invokeLater(r);
}

From source file:com.igormaznitsa.ideamindmap.editor.MindMapPanelControllerImpl.java

License:Apache License

@Override
public JPopupMenu makePopUpForMindMapPanel(final MindMapPanel source, final Point point,
        final AbstractElement element, final ElementPart partUnderMouse) {
    final JBPopupMenu result = new JBPopupMenu();

    if (element != null) {
        final JBMenuItem editText = new JBMenuItem(BUNDLE.getString("MMDGraphEditor.makePopUp.miEditText"),
                AllIcons.PopUp.EDITTEXT);
        editText.addActionListener(new ActionListener() {

            @Override/*  w ww  .j av a  2s.  co m*/
            public void actionPerformed(ActionEvent e) {
                editor.getMindMapPanel().startEdit(element);
            }
        });

        result.add(editText);

        final JBMenuItem addChild = new JBMenuItem(BUNDLE.getString("MMDGraphEditor.makePopUp.miAddChild"),
                AllIcons.PopUp.ADD);
        addChild.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                editor.getMindMapPanel().makeNewChildAndStartEdit(element.getModel(), null);
            }
        });

        result.add(addChild);
    }

    if (element != null || this.editor.getMindMapPanel().hasSelectedTopics()) {
        final JBMenuItem deleteItem = new JBMenuItem(this.editor.getMindMapPanel().hasSelectedTopics()
                ? BUNDLE.getString("MMDGraphEditor.makePopUp.miRemoveSelectedTopics")
                : BUNDLE.getString("MMDGraphEditor.makePopUp.miRemoveTheTopic"), AllIcons.PopUp.DELETE);
        deleteItem.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                if (editor.getMindMapPanel().hasSelectedTopics()) {
                    editor.getMindMapPanel().deleteSelectedTopics();
                } else {
                    editor.getMindMapPanel().deleteTopics(element.getModel());
                }
            }
        });

        result.add(deleteItem);
    }

    if (element != null || this.editor.getMindMapPanel().hasOnlyTopicSelected()) {
        final Topic theTopic = this.editor.getMindMapPanel().getFirstSelected() == null
                ? (element != null ? element.getModel() : null)
                : this.editor.getMindMapPanel().getFirstSelected();
        if (theTopic != null && theTopic.getParent() != null) {
            final JBMenuItem cloneItem = new JBMenuItem(
                    this.editor.getMindMapPanel().hasSelectedTopics()
                            ? BUNDLE.getString("MMDGraphEditor.makePopUp.miCloneSelectedTopic")
                            : BUNDLE.getString("MMDGraphEditor.makePopUp.miCloneTheTopic"),
                    AllIcons.PopUp.CLONE);
            cloneItem.addActionListener(new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent e) {
                    editor.getMindMapPanel().cloneTopic(theTopic);
                }
            });

            result.add(cloneItem);
        }
    }

    if (element != null) {
        if (result.getComponentCount() > 0) {
            result.add(new JSeparator());
        }

        final Topic topic = element.getModel();

        final JBMenuItem editText = new JBMenuItem(topic.getExtras().containsKey(Extra.ExtraType.NOTE)
                ? BUNDLE.getString("MMDGraphEditor.makePopUp.miEditNote")
                : BUNDLE.getString("MMDGraphEditor.makePopUp.miAddNote"), AllIcons.PopUp.NOTE);
        editText.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(final ActionEvent e) {
                editTextForTopic(topic);
                editor.getMindMapPanel().requestFocus();
            }
        });

        result.add(editText);

        final JBMenuItem editLink = new JBMenuItem(topic.getExtras().containsKey(Extra.ExtraType.LINK)
                ? BUNDLE.getString("MMDGraphEditor.makePopUp.miEditURI")
                : BUNDLE.getString("MMDGraphEditor.makePopUp.miAddURI"), AllIcons.PopUp.URL);
        editLink.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                editLinkForTopic(topic);
                editor.getMindMapPanel().requestFocus();
            }
        });

        result.add(editLink);

        final JBMenuItem editTopicLink = new JBMenuItem(topic.getExtras().containsKey(Extra.ExtraType.TOPIC)
                ? BUNDLE.getString("MMDGraphEditor.makePopUp.miEditTransition")
                : BUNDLE.getString("MMDGraphEditor.makePopUp.miAddTransition"), AllIcons.PopUp.TOPIC);
        editTopicLink.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                editTopicLinkForTopic(topic);
                editor.getMindMapPanel().requestFocus();
            }
        });

        result.add(editTopicLink);

        final JBMenuItem editFileLink = new JBMenuItem(topic.getExtras().containsKey(Extra.ExtraType.FILE)
                ? BUNDLE.getString("MMDGraphEditor.makePopUp.miEditFile")
                : BUNDLE.getString("MMDGraphEditor.makePopUp.miAddFile"), AllIcons.PopUp.FILE);
        editFileLink.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                editFileLinkForTopic(topic);
                editor.getMindMapPanel().requestFocus();
            }
        });

        result.add(editFileLink);
    }

    if (element != null || source.hasSelectedTopics()) {
        if (result.getComponentCount() > 0) {
            result.add(new JSeparator());
        }

        final Topic[] topics;
        final String name;
        if (source.hasSelectedTopics()) {
            topics = source.getSelectedTopics();
            name = String.format(BUNDLE.getString("MMDGraphEditor.makePopUp.miColorsForSelected"),
                    topics.length);
        } else {
            topics = new Topic[] { element.getModel() };
            name = BUNDLE.getString("MMDGraphEditor.makePopUp.miColorsForTopic");
        }

        final JBMenuItem colors = new JBMenuItem(name, AllIcons.PopUp.COLORS);
        colors.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                processColorDialogForTopics(source, topics);
            }
        });

        result.add(colors);
    }

    if (result.getComponentCount() > 0) {
        result.add(new JSeparator());
    }

    final JBMenuItem expandAll = new JBMenuItem(BUNDLE.getString("MMDGraphEditor.makePopUp.miExpandAll"),
            AllIcons.PopUp.EXPANDALL);
    expandAll.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(final ActionEvent e) {
            editor.getMindMapPanel().collapseOrExpandAll(false);
        }

    });

    final JBMenuItem collapseAll = new JBMenuItem(BUNDLE.getString("MMDGraphEditor.makePopUp.miCollapseAll"),
            AllIcons.PopUp.COLLAPSEALL);
    collapseAll.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            editor.getMindMapPanel().collapseOrExpandAll(true);
        }

    });

    final JCheckBoxMenuItem showJumps = new JCheckBoxMenuItem(
            BUNDLE.getString("MMDGraphEditor.makePopUp.miShowJumps"), AllIcons.PopUp.SHOWJUMPS,
            source.isShowJumps());
    showJumps.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            editor.getMindMapPanel().setShowJumps(showJumps.isSelected());
        }
    });

    result.add(showJumps);
    result.add(expandAll);
    result.add(collapseAll);

    if (result.getComponentCount() > 0) {
        result.add(new JSeparator());
    }
    final JMenu exportMenu = new JMenu(BUNDLE.getString("MMDGraphEditor.makePopUp.miExportMapAs"));
    exportMenu.setIcon(AllIcons.PopUp.EXPORT);
    for (final Exporters e : Exporters.values()) {
        final AbstractMindMapExporter exp = e.getExporter();
        final JBMenuItem item = new JBMenuItem(exp.getName());
        item.setToolTipText(exp.getReference());
        item.setIcon(exp.getIcon());
        item.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(final ActionEvent e) {
                try {
                    final JComponent options = exp.makeOptions();
                    if (options != null) {
                        if (!getDialogProvider().msgOkCancel(exp.getName(), options)) {
                            return;
                        }
                    }
                    exp.doExport(editor.getMindMapPanel(), options, null);
                    IdeaUtils.showPopup(
                            String.format(BUNDLE.getString("MMDGraphEditor.makePopUp.msgExportedSuccessfuly"),
                                    exp.getName()),
                            MessageType.INFO);
                } catch (Exception ex) {
                    LOGGER.error("Error during map export", ex); //NOI18N
                    IdeaUtils.showPopup(BUNDLE.getString("MMDGraphEditor.makePopUp.errMsgCantExport"),
                            MessageType.ERROR);
                }
            }
        });
        exportMenu.add(item);
    }
    result.add(exportMenu);

    result.add(new JSeparator());

    JBMenuItem printPreviewMenu = new JBMenuItem(BUNDLE.getString("MMDGraphEditor.makePopUp.miPrintPreview"),
            AllIcons.PopUp.PRINTER);
    printPreviewMenu.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            final MMDPrintPanel panel = new MMDPrintPanel(
                    new IdeaMMDPrintPanelAdaptor(getEditor().getProject()), getEditor().getMindMapPanel());
            IdeaUtils.plainMessageClose(getEditor().getProject(), "Print mind map", panel);
        }
    });

    result.add(printPreviewMenu);

    JBMenuItem optionsMenu = new JBMenuItem(BUNDLE.getString("MMDGraphEditor.makePopUp.miOptions"),
            AllIcons.PopUp.OPTIONS);
    optionsMenu.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            startOptionsEdit();
        }
    });

    result.add(optionsMenu);

    JBMenuItem infoMenu = new JBMenuItem(BUNDLE.getString("MMDGraphEditor.makePopUp.miAbout"),
            AllIcons.PopUp.INFO);
    infoMenu.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            showAbout();
        }
    });

    result.add(infoMenu);

    return result;
}

From source file:com.intellij.application.options.codeStyle.ManageCodeStyleSchemesDialog.java

License:Apache License

private void chooseAndImport() {
    ImportSourceChooserDialog<CodeStyleScheme> importSourceChooserDialog = new ImportSourceChooserDialog<CodeStyleScheme>(
            myContentPane, CodeStyleScheme.class);
    if (importSourceChooserDialog.showAndGet()) {
        if (importSourceChooserDialog.isImportFromSharedSelected()) {
            new SchemesToImportPopup<CodeStyleScheme>(myContentPane) {
                @Override//  ww  w  . j a v  a2  s.  com
                protected void onSchemeSelected(CodeStyleScheme scheme) {
                    if (scheme != null) {
                        myModel.addScheme(scheme, true);
                    }
                }
            }.show(myModel.getSchemes());
        } else {
            String selectedImporterName = importSourceChooserDialog.getSelectedSourceName();
            if (selectedImporterName != null) {
                try {
                    String schemeName = importExternalCodeStyle(selectedImporterName);
                    if (schemeName != null) {
                        showStatus(myImportButton,
                                ApplicationBundle.message("message.code.style.scheme.import.success",
                                        selectedImporterName, schemeName),
                                MessageType.INFO);
                    }
                } catch (SchemeImportException e) {
                    showStatus(myImportButton,
                            ApplicationBundle.message("message.code.style.scheme.import.failure",
                                    selectedImporterName, e.getMessage()),
                            MessageType.ERROR);
                }
            }
        }
    }
}