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

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

Introduction

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

Prototype

@NotNull
    public static Icon getWarningIcon() 

Source Link

Usage

From source file:org.jetbrains.tfsIntegration.ui.ManageWorkspacesForm.java

License:Apache License

private void deleteWorkspace(@NotNull WorkspaceInfo workspace) {
    if (Messages.showYesNoDialog(myContentPane,
            TFSBundle.message("delete.workspace.prompt", workspace.getName()),
            TFSBundle.message("delete.workspace.title"), Messages.getWarningIcon()) != Messages.YES) {
        return;//from   w  w  w .j  a v  a2 s  .c  om
    }

    try {
        workspace.getServer().deleteWorkspace(workspace, myContentPane, true);
        updateControls(workspace);
    } catch (UserCancelledException e) {
        // ignore
    } catch (TfsException e) {
        Messages.showErrorDialog(myProject, e.getMessage(), TFSBundle.message("delete.workspace.title"));
    }
}

From source file:org.jetbrains.tfsIntegration.ui.OverridePolicyWarningsForm.java

License:Apache License

public OverridePolicyWarningsForm(final Project project, List<PolicyFailure> failures) {
    myIconLabel.setIcon(Messages.getWarningIcon());

    myWarningsTable.setTableHeader(null);
    new DoubleClickListener() {
        @Override//from   ww w.j a va2 s .com
        protected boolean onDoubleClick(MouseEvent e) {
            final PolicyFailure failure = myWarningsTable.getSelectedObject();
            if (failure != null) {
                failure.activate(project);
                return true;
            }
            return false;
        }
    }.installOn(myWarningsTable);

    myWarningsTable.setModelAndUpdateColumns(new ListTableModel<PolicyFailure>(
            new ColumnInfo[] { CheckinParametersForm.WARNING_COLUMN_INFO }, failures, -1));

    myOverrideCheckBox.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            myReasonTextArea.setEnabled(myOverrideCheckBox.isSelected());
            if (myReasonTextArea.isEnabled()) {
                myReasonTextArea.requestFocus();
            }
            myEventDispatcher.getMulticaster().stateChanged();
        }
    });

    myReasonTextArea.getDocument().addDocumentListener(new DocumentAdapter() {
        @Override
        protected void textChanged(DocumentEvent e) {
            myEventDispatcher.getMulticaster().stateChanged();
        }
    });
}

From source file:org.onehippo.intellij.groovy.actions.ScheduleFileAction.java

License:Apache License

@Override
public void actionPerformed(AnActionEvent event) {
    final Project project = event.getData(CommonDataKeys.PROJECT);
    if (project == null) {
        return;/* w  w  w. j  a  v a  2  s .c  o m*/
    }
    final GroovySessionComponent sessionComponent = project.getComponent(GroovySessionComponent.class);

    final FileEditorManager editorManager = FileEditorManager.getInstance(project);
    final Editor selectedTextEditor = editorManager.getSelectedTextEditor();

    if (selectedTextEditor == null) {
        Util.showError(project, "No document selected");
        return;
    }
    final Document document = selectedTextEditor.getDocument();
    final VirtualFile currentFile = FileDocumentManager.getInstance().getFile(document);
    if (currentFile == null) {
        Util.showError(project, "No document selected");
        return;
    }
    // check if groovy file
    final FileType fileType = currentFile.getFileType();
    if (fileType != GroovyFileType.GROOVY_FILE_TYPE) {
        final int result = Messages.showOkCancelDialog(
                "File" + currentFile.getName() + " doesn't seems to be a groovy file",
                CommonBundle.getWarningTitle(), Messages.getWarningIcon());
        if (result != 0) {
            return;
        }
    }
    FileDialogData existingData = new FileDialogData();
    final SessionState state = sessionComponent.getState();
    if (state != null) {
        final Map<String, FileDialogData> items = state.getItems();
        final FileDialogData dialogData = items.get(currentFile.getCanonicalPath());
        if (dialogData != null) {
            existingData = dialogData;
        }
    }

    final String content = selectedTextEditor.getDocument().getText();
    final ScheduleDialog dialog = new ScheduleDialog(project, existingData);
    existingData.setContent(content);
    dialog.setTitle("Groovy Script Settings");
    dialog.show();
    switch (dialog.getExitCode()) {
    case DialogWrapper.OK_EXIT_CODE:
        processFile(dialog.getData(), sessionComponent, project);

        break;
    case DialogWrapper.CANCEL_EXIT_CODE:
        Util.showMessage(project, "File not saved");
        break;
    }

}

From source file:org.trzcinka.intellitrac.view.TracSyntaxEditor.java

License:Apache License

public TracSyntaxEditor() {
    editRadioButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            setEditMode();/*ww  w.j ava  2  s.  co  m*/
        }
    });
    previewRadioButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            setPreviewMode();
        }
    });
    editor.addHyperlinkListener(new HyperlinkListener() {
        public void hyperlinkUpdate(HyperlinkEvent e) {
            if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
                if (BrowserUtil.canStartDefaultBrowser()) {
                    BrowserUtil.launchBrowser(e.getURL().toString());
                } else {
                    ResourceBundle bundle = BundleLocator.getBundle();
                    Messages.showMessageDialog(bundle.getString("dialogs.cannot_start_browser"),
                            bundle.getString("dialogs.warning"), Messages.getWarningIcon());
                }
            }
        }
    });
}

From source file:org.twodividedbyzero.idea.findbugs.core.AbstractSuggestionNotificationListener.java

License:Open Source License

@Override
public final void hyperlinkUpdate(@NotNull final Notification notification,
        @NotNull final HyperlinkEvent event) {
    if (event.getEventType().equals(HyperlinkEvent.EventType.ACTIVATED)) {
        final String desc = event.getDescription();
        if (desc.equals(A_HREF_DISABLE_ANCHOR)) {
            final int result = Messages.showYesNoDialog(project,
                    "Notification will be disabled for all projects.\n\n"
                            + "Settings | Appearance & Behavior | Notifications | " + notificationGroupId
                            + "\ncan be used to configure the notification.",
                    "FindBugs Plugin Suggestion Notification", "Disable Notification",
                    CommonBundle.getCancelButtonText(), Messages.getWarningIcon());
            if (result == Messages.YES) {
                NotificationUtil.getNotificationsConfigurationImpl().changeSettings(notificationGroupId,
                        NotificationDisplayType.NONE, false, false);
                notification.expire();/*from   ww w.  j av a  2 s  . c  om*/
            } else {
                notification.hideBalloon();
            }
        } else {
            linkClicked(notification, desc);
        }
    }
}

From source file:org.twodividedbyzero.idea.findbugs.core.PluginSuggestion.java

License:Open Source License

private static void showSuggestions(@NotNull final Project project,
        @NotNull final FindBugsPlugin findBugsPlugin, @NotNull final FindBugsPreferences preferences,
        @NotNull final Set<Suggestion> suggestions) {

    final StringBuilder sb = new StringBuilder();
    for (final Suggestion suggestion : suggestions) {
        sb.append("&nbsp;&nbsp;- <a href='").append(suggestion._pluginId).append("'>").append("Enable '")
                .append(suggestion._name).append("'</a><br>");
    }/* www .jav  a  2  s .  c  o m*/
    sb.append("<br><a href='").append(A_HREF_DISABLE_ANCHOR).append("'>Disable Suggestion</a>");

    FindBugsPluginImpl.NOTIFICATION_GROUP_PLUGIN_SUGGESTION.createNotification("FindBugs Plugin Suggestion",
            sb.toString(), NotificationType.INFORMATION, new NotificationListener() {
                @Override
                public void hyperlinkUpdate(@NotNull final Notification notification,
                        @NotNull final HyperlinkEvent event) {
                    if (event.getEventType().equals(HyperlinkEvent.EventType.ACTIVATED)) {
                        final String desc = event.getDescription();
                        if (desc.equals(A_HREF_DISABLE_ANCHOR)) {
                            final int result = Messages.showYesNoDialog(project,
                                    "Notification will be disabled for all projects.\n\n"
                                            + "Settings | Appearance & Behavior | Notifications | "
                                            + FindBugsPluginImpl.NOTIFICATION_GROUP_ID_PLUGIN_SUGGESTION
                                            + "\ncan be used to configure the notification.",
                                    "FindBugs Plugin Suggestion Notification", "Disable Notification",
                                    CommonBundle.getCancelButtonText(), Messages.getWarningIcon());
                            if (result == Messages.YES) {
                                NotificationUtil.getNotificationsConfigurationImpl().changeSettings(
                                        FindBugsPluginImpl.NOTIFICATION_GROUP_ID_PLUGIN_SUGGESTION,
                                        NotificationDisplayType.NONE, false, false);
                                notification.expire();
                            } else {
                                notification.hideBalloon();
                            }
                        } else {
                            enablePlugin(project, findBugsPlugin, desc, preferences);
                            notification.hideBalloon();
                        }
                    }
                }
            }).setImportant(false).notify(project);
}

From source file:org.wso2.wsf.idea.ws.util.PopupMessageUtil.java

License:Apache License

public static void popupWarningMessageBox(String warningMessage) {
    Messages.showMessageDialog(warningMessage, WSASMessageConstant.WARNING_WSAS_HEADING,
            Messages.getWarningIcon());
}

From source file:org.zmlx.hg4idea.command.HgUpdateCommand.java

License:Apache License

public static int showDiscardChangesConfirmation(@NotNull final Project project,
        @NotNull final String confirmationMessage) {
    final AtomicInteger exitCode = new AtomicInteger();
    UIUtil.invokeAndWaitIfNeeded(new Runnable() {
        @Override//from   w w  w .  j a v a2 s  .  c o  m
        public void run() {
            exitCode.set(Messages.showOkCancelDialog(project, confirmationMessage,
                    "Uncommitted Changes Problem", "&Discard Changes", "&Cancel", Messages.getWarningIcon()));
        }
    });
    return exitCode.get();
}