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

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

Introduction

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

Prototype

@NotNull
    public static Icon getInformationIcon() 

Source Link

Usage

From source file:ariba.ideplugin.idea.GotoComponent.java

License:Apache License

/**
 * Display an error into a popup window/*from w w  w . ja va2s  . c o  m*/
 *
 * @param project, current project
 * @param error,   the message to display
 */
private void showError(String error, Project project) {
    Messages.showMessageDialog(project, error, "Goto Component", Messages.getInformationIcon());
    LOG.info(error);
}

From source file:ariba.ideplugin.idea.ToggleAction.java

License:Apache License

/**
 * Display an error into a popup window/*from   ww  w.  j a va2s . c o  m*/
 * @param project, current project
 * @param msg, the message to display
 */
private void error(Project project, String msg) {
    Messages.showMessageDialog(project, msg, "Toggle AW Information", Messages.getInformationIcon());
    LOG.info("No file is currently selected");
}

From source file:brainleg.app.intellij.ui.SubmitSolutionDialog.java

License:Apache License

@Override
protected void doOKAction() {
    String solution = myPanel.solutionTextArea.getText();
    String snippet = myPanel.snippetTextArea.getText();
    if (solution.trim().length() + snippet.trim().length() < 15) {
        Messages.showMessageDialog("Please provide solution text or code snippet", "Please provide solution",
                Messages.getInformationIcon());
        return;/*www .j  a v a  2s  .co m*/
    }

    boolean success = submitSolution(solution, snippet, exception);
    if (success) {
        //update submitted solution count
        //            BLSettingsService.getSettings().submittedSolutionCount = BLSettingsService.getSettings().submittedSolutionCount + 1;

        submitSolutionButton.setEnabled(false); //disable button so that the user does not submit it again by mistake
    }
    super.doOKAction();
}

From source file:brainleg.app.util.AppWeb.java

License:Apache License

/**
 * Returns true if success, false otherwise.
 * @param solution/*from   w w  w . jav a2s  .com*/
 * @param snippet
 * @param exception
 * @return
 */
public static boolean submitSolution(String solution, String snippet, EData exception) {
    String exceptionString = Generator.generateStringForWebSubmission(exception,
            BLSettingsService.getSettings().sendExceptionMessage,
            BLSettingsService.getSettings().sendFullTraces);

    try {
        post(getUrl("api/submitSolution"),
                new NameValuePair[] { new NameValuePair("clientId", "intellij"),
                        new NameValuePair("clientVer", AppUtil.getPluginVersion()),
                        new NameValuePair("userAPIToken",
                                BLSettingsService.getSettings().userAuthToken == null ? ""
                                        : BLSettingsService.getSettings().userAuthToken.trim()),
                        new NameValuePair("exception", exceptionString),
                        new NameValuePair("solution", solution), new NameValuePair("snippet", snippet) });
        return true;
    } catch (RequestRejectedException e) {
        if ("USER_NOT_FOUND".equals(e.getResponseCode())) {
            Messages.showMessageDialog(
                    "The user token does not match your website profile. Please open BrainLeg settings and update it",
                    "Incorrect user token", Messages.getInformationIcon());
        } else {
            Messages.showMessageDialog(
                    "Connected to server but request was rejected: " + e.getResponseCode() + ":"
                            + e.getResponseMessage(),
                    "Request rejected by the server", Messages.getInformationIcon());
        }
        return false;
    } catch (IOException e) {
        System.out.println("Can't connect to the server: " + e.getMessage());
        Messages.showMessageDialog("Can't connect to the server", "Connection Problem",
                Messages.getInformationIcon());
        return false;
    }
}

From source file:brainleg.app.util.AppWeb.java

License:Apache License

public static void sendQueryAndOpenBrowser(EData exception) {
    String searchString = generateExceptionStringForSearchViaApi(exception);

    try {//w w  w .  jav a 2s. com
        //stack trace can be too big to send via GET
        //so we first send the exception via POST, the server responds with a temp request token
        //and then we open browser with a short url containing this token
        String requestToken = post(getUrl("api/submitSearch"),
                new NameValuePair[] { new NameValuePair("plugin", "intellij"),
                        new NameValuePair("version", AppUtil.getPluginVersion()),
                        new NameValuePair("exception", searchString) });

        BrowserUtil.launchBrowser(getUrl("api/search?token=" + requestToken));
    } catch (RequestRejectedException e) {
        Messages.showMessageDialog("Connected to server but request was rejected",
                "Request rejected by the server", Messages.getInformationIcon());
    } catch (IOException e) {
        Messages.showMessageDialog("Can't connect to the server", "Connection Problem",
                Messages.getInformationIcon());
    }
}

From source file:co.uk.mikedamay.MikeActionClass.java

License:Apache License

public void actionPerformed(AnActionEvent event) {
    Project project = event.getData(PlatformDataKeys.PROJECT);
    String txt = Messages.showInputDialog(project, "What is your name?", "Input your name",
            Messages.getQuestionIcon());
    Messages.showMessageDialog(project, "Hello, " + txt + "!\n I am glad to see you.", "Information",
            Messages.getInformationIcon());
}

From source file:com.atlassian.theplugin.idea.autoupdate.NewVersionCheckModalTask.java

License:Apache License

public void run(@NotNull ProgressIndicator indicator) {
    newVersion = null;//from   w  w  w  .j a v a 2 s. c  o m
    setCancelText("Stop");
    indicator.setText("Connecting...");
    indicator.setFraction(0);
    indicator.setIndeterminate(true);
    final ConnectionWrapper checkerThread = new ConnectionWrapper(new UpdateServerConnection(), null,
            "atlassian-idea-plugin New version checker");
    checkerThread.start();
    while (checkerThread.getConnectionState() == ConnectionWrapper.ConnectionState.NOT_FINISHED) {
        try {
            if (indicator.isCanceled()) {
                checkerThread.setInterrupted();
                //t.interrupt();
                break;
            } else {
                Thread.sleep(CHECK_CANCEL_INTERVAL);
            }
        } catch (InterruptedException e) {
            PluginUtil.getLogger().info(e.getMessage());
        }
    }

    switch (checkerThread.getConnectionState()) {
    case FAILED:
        EventQueue.invokeLater(new Runnable() {
            public void run() {
                com.intellij.openapi.ui.Messages.showMessageDialog(parentWindow,
                        checkerThread.getErrorMessage(), "Error occured when contacting update server",
                        Messages.getErrorIcon());
            }
        });
        break;
    case INTERUPTED:
        PluginUtil.getLogger().debug("Cancel was pressed during the upgrade process");
        break;
    case NOT_FINISHED:
        break;
    case SUCCEEDED:
        if (newVersion != null) {
            EventQueue.invokeLater(new Runnable() {
                public void run() {
                    try {
                        new NewVersionConfirmHandler(parentWindow, config).doAction(newVersion, showConfigPath);
                    } catch (ThePluginException e) {
                        com.intellij.openapi.ui.Messages.showMessageDialog(parentWindow, e.getMessage(),
                                "Error retrieving new version", Messages.getErrorIcon());
                    }
                }
            });
        } else {
            EventQueue.invokeLater(new Runnable() {
                public void run() {
                    com.intellij.openapi.ui.Messages.showMessageDialog(parentWindow,
                            "You have the latest version (" + PluginUtil.getInstance().getVersion() + ")",
                            "Version checked", Messages.getInformationIcon());
                }
            });
        }
        break;
    default:
        PluginUtil.getLogger()
                .info("Unexpected thread state: " + checkerThread.getConnectionState().toString());
    }
}

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

License:Apache License

public void go() {

    if (!isDialogShown && !shouldStop()) {

        isDialogShown = true;/* ww w .  ja  v a 2  s. c  o  m*/
        boolean wasCanceled = false;
        boolean wasOk = false;

        for (ServerCfg server : projectCfgManager.getAllEnabledServers(serverFacade.getServerType())) {
            if (server.isComplete() || serversWithoutPassword.contains(server.getServerId())
                    || server.isUseDefaultCredentials()) {
                continue;
            }
            PasswordDialog dialog = new PasswordDialog(server, serverFacade, project);
            dialog.pack();
            JPanel panel = dialog.getPasswordPanel();

            int answer = JOptionPane.showConfirmDialog(JOptionPane.getRootFrame(), panel,
                    PluginUtil.getInstance().getName(), OK_CANCEL_OPTION, PLAIN_MESSAGE);

            if (answer == JOptionPane.OK_OPTION) {
                String password = dialog.getPasswordString();
                Boolean shouldPasswordBeStored = dialog.getShouldPasswordBeStored();
                server.setPassword(password);
                server.setPasswordStored(shouldPasswordBeStored);
                server.setUsername(dialog.getUserName());
                server.setUseDefaultCredentials(dialog.isUseDefaultCredentials());
                wasOk = true;
            } else {
                wasCanceled = true;
                serversWithoutPassword.add(server.getServerId());
            }
        }
        if (wasOk) {
            ThePluginApplicationComponent appComponent = IdeaHelper.getAppComponent();
            appComponent.rescheduleStatusCheckers(true);
        }

        if (wasCanceled) {
            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.atlassian.theplugin.idea.TestConnectionTask.java

License:Apache License

@Override
public void run(@NotNull ProgressIndicator indicator) {

    if (indicator == null) {
        PluginUtil.getLogger().error("Progress Indicator is null in TestConnectionTask!!!");
        System.out.println("Progress Indicator is null in TestConnectionTask!!!");
    } else {//from   w  w  w. java2s  .  c  om
        indicator.setText("Connecting...");
        indicator.setFraction(0);
        indicator.setIndeterminate(true);
    }
    testConnector.start();

    while (testConnector.getConnectionState() == ConnectionWrapper.ConnectionState.NOT_FINISHED) {
        try {
            if (indicator.isCanceled()) {
                testConnector.setInterrupted();
                //t.interrupt();
                break;
            } else {
                java.lang.Thread.sleep(CHECK_CANCEL_INTERVAL);
            }
        } catch (InterruptedException e) {
            log.info(e.getMessage());
        }
    }

    ConnectionWrapper.ConnectionState state = testConnector.getConnectionState();
    processor.setConnectionResult(state);
    switch (testConnector.getConnectionState()) {
    case FAILED:
        EventQueue.invokeLater(new Runnable() {
            public void run() {
                if (showErrorMessage) {
                    DialogWithDetails.showExceptionDialog(getProject(),
                            serverData.getName() + " : " + testConnector.getErrorMessage(),
                            testConnector.getException(), HelpUrl.getHelpUrl(Constants.HELP_TEST_CONNECTION));
                }
                processor.onError(testConnector.getErrorMessage(), testConnector.getException(),
                        HelpUrl.getHelpUrl(Constants.HELP_TEST_CONNECTION));
            }
        });
        break;
    case INTERUPTED:
        log.debug("Cancel was pressed during 'Test Connection' operation");
        break;
    case SUCCEEDED:
        EventQueue.invokeLater(new Runnable() {
            public void run() {
                if (showOkMessage) {
                    showMessageDialog(getProject(), "Connected successfully", "Connection OK",
                            Messages.getInformationIcon());
                }
                processor.onSuccess();
            }
        });
        break;
    default: //NOT_FINISHED:
        log.warn("Unexpected 'Test Connection' thread state: " + testConnector.getConnectionState().toString());
    }
}

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

License:Apache License

public void go() {

    if (!isDialogShown) {

        isDialogShown = true;/*  w ww.ja  va 2s .  c  o  m*/
        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;
    }

}