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(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

Use this method only if you do not know project or component

Usage

From source file:geneon.intellij.plugin.jenkins.ui.EditServerDialog.java

License:Open Source License

private void testSettings() {
    String error = ServiceManager.getService(JenkinsService.class)
            .testServerConnectivity(urlTextField.getText());

    if (error == null) {
        Messages.showInfoMessage("Connected succesfully", "Success");
    } else {/*ww  w  .jav  a  2 s  .c o m*/
        Messages.showErrorDialog("Could not connect:\n" + error, "Failed");
    }
}

From source file:io.github.likeanowl.ProductivityMetricsPlugin.actions.CountingAction.java

License:Apache License

@Override
public void actionPerformed(@NotNull AnActionEvent e) {
    final PluginState pluginState = PluginState.getInstance();
    final StringBuilder sb = new StringBuilder();
    final VirtualFile file = e.getData(PlatformDataKeys.VIRTUAL_FILE);
    assert file != null;
    int symbolsPerMinute = (int) (pluginState.getSymbolsTypedCountThisSession(file.getName())
            / (pluginState.getTypingTime() / 60000.0));
    sb.append("In this work session:").append("\nTotal time spent on typing: ")
            .append(pluginState.getTypingTime() / 1000.0).append(" seconds")
            .append("\nYour average typing speed: ").append(symbolsPerMinute).append(" symbols/minute")
            .append("\nSymbols typed in file: ").append(file.getPresentableName()).append(": ")
            .append(pluginState.getSymbolsTypedCountThisSession(file.getName()));
    Messages.showInfoMessage(sb.toString(), "Productivity Metrics");
}

From source file:ivyplug.ReimportAllIvyModulesAction.java

License:Apache License

public void actionPerformed(AnActionEvent e) {
    final Project project = e.getData(LangDataKeys.PROJECT);
    if (project == null) {
        return;/* www  .ja  va2s. c  om*/
    }
    MessagesProjectComponent messagesProjectComponent = project.getComponent(MessagesProjectComponent.class);
    messagesProjectComponent.closeIvyPlugMessageTabs();
    List<Module> ivyModules = getIvyModules(project);
    if (ivyModules.isEmpty()) {
        SwingUtilities.invokeLater(new Runnable() {

            public void run() {
                Messages.showInfoMessage(IvyPlugBundle.message("no.ivy.modules.found.message.description"),
                        IvyPlugBundle.message("no.ivy.modules.found.message.title"));
            }
        });
        return;
    }
    IvyProjectComponent ivyProjectComponent = project.getComponent(IvyProjectComponent.class);
    ivyProjectComponent.scheduleReimport(ivyModules);
}

From source file:net.sf.logsupport.ui.util.Dialogs.java

License:Apache License

/**
 * Shows an info message without blocking the calling thread.
 *
 * @param message the message to show./*from w ww  .j a  v a  2s .co  m*/
 * @param title   the window title.
 */
public static void showInfoDialog(final String message, final String title) {
    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            Messages.showInfoMessage(message, title);
        }
    });
}

From source file:org.mvnsearch.snippet.plugin.actions.AboutAction.java

License:Apache License

public void actionPerformed(AnActionEvent e) {
    Messages.showInfoMessage("<html><body><center><h2>eSnippet Pro</h2>"
            + "<br>Your search agent to find the right code sample/snippet and main site is http://snippet.mvnsearch.org</center></body></html>",
            "eSnippet");
}

From source file:org.noam.intelliwtf.actions.SubmitWtfDialog.java

License:Apache License

private void onOK() {
    try {/*from  w  ww .  j  a  v a  2s  .  com*/
        validateFieldValues();
        Client client = new Client();
        client.setWsdlUrl("http://thedailywtf.com/SubmitWTF.asmx?wsdl");
        client.setEndPoint("http://thedailywtf.com/SubmitWTF.asmx");

        ComposedValue form = new ComposedValue();
        form.put("name", submitterNameTextField.getText());
        form.put("emailAddress", submitterEmailTextField.getText());
        form.put("subject", subjectTextField.getText());
        form.put("comments", messageTextArea.getText());
        form.put("codeSubmission", codeSnippetTextArea.getText());
        form.put("doNotPublish", Boolean.toString(noPublishCheckBox.isSelected()));

        ComposedValue response = client.call("Submit", form);
        if (response != null) {
            Messages.showInfoMessage("Your WTF was successfully submitted", "YAY!");
        }
        dispose();
    } catch (Exception iae) {
        Messages.showErrorDialog(iae.getMessage(), "Error");
    }
}

From source file:ro.catalin.prata.testflightuploader.view.TFUploader.java

License:Apache License

public TFUploader() {

    // update the list
    updateListOfTeams(KeysManager.instance().getTeamList());

    uploadButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {

            performUploadValidation();/*ww w.j  a  va 2s . c  om*/

        }
    });

    teamList.addListSelectionListener(new ListSelectionListener() {
        @Override
        public void valueChanged(ListSelectionEvent e) {

            // if the Add new Team item is selected, open a dialog with name and token input fields
            if (teamList.getSelectedIndex() == 0) {

                AddTeamDialog dialog = new AddTeamDialog(new AddTeamDialog.AddTeamListener() {
                    @Override
                    public void onTeamAdded(Team newTeam) {

                        // add the new team to the list
                        KeysManager.instance().addTeam(newTeam);

                        // update the list
                        updateListOfTeams(KeysManager.instance().getTeamList());

                    }
                });
                dialog.pack();
                dialog.setVisible(true);

            }

        }
    });

    deleteTeamButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {

            if (teamList.getSelectedIndex() > 0) {

                // remove the selected team from the list
                KeysManager.instance().removeTeamAtIndex(teamList.getSelectedIndex());
                // update the list
                updateListOfTeams(KeysManager.instance().getTeamList());

            }

        }
    });

    browseButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {

            // create a new file type with the apk extension to be used for file type filtering
            FileType type = FileTypeManager.getInstance().getFileTypeByExtension("apk");

            // create a descriptor for the file chooser
            FileChooserDescriptor descriptor = Utils.createSingleFileDescriptor(type);
            descriptor.setTitle("Android Apk File");
            descriptor.setDescription("Please chose the project Apk file to be uploaded to Test Flight");

            // by default open the first opened project root directory
            VirtualFile fileToSelect = ProjectManager.getInstance().getOpenProjects()[0].getBaseDir();

            // open the file chooser
            FileChooser.chooseFiles(descriptor, null, fileToSelect, new FileChooser.FileChooserConsumer() {
                @Override
                public void cancelled() {

                    // do nothing for now...

                }

                @Override
                public void consume(List<VirtualFile> virtualFiles) {

                    String filePath = virtualFiles.get(0).getPath();

                    // the file was selected so add it to the text field
                    apkFilePathTextField.setText(filePath);

                    // save the file path
                    KeysManager.instance().setApkFilePath(filePath);

                }
            });

        }
    });

    setApiKeyButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {

            // open an input dialog for the api key
            String apiKey = Messages.showInputDialog(ProjectManager.getInstance().getOpenProjects()[0],
                    "<HTML>This token gives you access to the upload API. You can get it from <a href=\"https://testflightapp.com/account/#api\">here</a>.</HTML>",
                    "Upload API Token", null, KeysManager.instance().getApiKey(), null);

            // save the api key after a minor validation
            if (apiKey != null && apiKey.length() > 3) {
                KeysManager.instance().setApiKey(apiKey);
            }

        }
    });

    teamList.addListSelectionListener(new ListSelectionListener() {
        @Override
        public void valueChanged(ListSelectionEvent e) {

            distributionsListTextArea.setText("");

            if (teamList.getSelectedIndex() > 0) {

                distributionsListTextArea.setText(KeysManager.instance().getTeamList()
                        .get(teamList.getSelectedIndex()).getDistributionList());
                distributionsListTextArea.setEnabled(true);

            } else {

                distributionsListTextArea.setEnabled(false);

            }

        }
    });

    distributionsListTextArea.addFocusListener(new FocusAdapter() {
        @Override
        public void focusLost(FocusEvent e) {
            super.focusLost(e);

            if (teamList.getSelectedIndex() > 0) {

                KeysManager.instance().getTeamList().get(teamList.getSelectedIndex())
                        .setDistributionList(distributionsListTextArea.getText());

            }

        }
    });

    buildVersionHelpBtn.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {

            // build version info button was pressed, display the about text...
            Messages.showInfoMessage(
                    "This feature let you change the version code/name of the build after it is sent to Test Flight.\n"
                            + "If you change the values of the build version code or name, it will be saved in your main manifest file. \n"
                            + "This can be useful to remind you to increment the build number after sending the apk to TestFlight. \n \n"
                            + "Please note that the change is made after the build is sent to Test Flight.",
                    "Android Build Version Code/Name Update");

        }
    });

    buildVersionCheck.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {

            if (buildVersionCheck.isSelected()) {

                setBuildFeatureComponentsVisible(true);

            } else {

                setBuildFeatureComponentsVisible(false);

            }

        }
    });

    moduleCombo.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {

            // if a module is selected, save the module
            KeysManager.instance().setSelectedModuleName((String) moduleCombo.getSelectedItem());

            // update the apk path
            Module module = ModulesManager.instance().getModuleByName((String) moduleCombo.getSelectedItem());
            apkFilePathTextField.setText(ModulesManager.instance().getAndroidApkPath(module));

            // update the build version fields too
            updateBuildVersionFields();

        }
    });

    // setup the previously saved values on the UI or the default ones
    setupValuesOnUI();

}