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

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

Introduction

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

Prototype

@NotNull
    public static Icon getErrorIcon() 

Source Link

Usage

From source file:com.urswolfer.intellij.plugin.gerrit.rest.SslSupport.java

License:Apache License

@CalledInAwt
public boolean askIfShouldProceed(final String host) {
    int choice = Messages.showYesNoDialog(
            "The security certificate of " + host + " is not trusted. Do you want to proceed anyway?",
            "Not Trusted Certificate", "Proceed anyway", "No, I don't trust", Messages.getErrorIcon());
    boolean trust = (choice == Messages.YES);
    if (trust) {//from www.  j  a va2  s.co m
        saveToTrusted(host);
    }
    return trust;
}

From source file:de.mprengemann.intellij.plugin.androidicons.actions.AndroidIconsAction.java

License:Apache License

@Override
public void actionPerformed(@NotNull AnActionEvent event) {
    Project project = getEventProject(event);
    VirtualFile assetRoot = SettingsHelper.getAssetPath(IconPack.ANDROID_ICONS);
    if (assetRoot == null) {
        Messages.showMessageDialog(project,
                "You have to select the Android Icons asset folder in the settings!", "Error",
                Messages.getErrorIcon());
        if (project == null) {
            project = ProjectManager.getInstance().getDefaultProject();
        }/*from   ww  w  .j a  v  a  2 s  .  co  m*/
        ShowSettingsUtil.getInstance().showSettingsDialog(project, "Android Drawable Importer");
    } else {
        Module module = event.getData(DataKeys.MODULE);
        AndroidIconsImporter dialog = new AndroidIconsImporter(project, module);
        dialog.show();
    }
}

From source file:de.mprengemann.intellij.plugin.androidicons.actions.MaterialIconsAction.java

License:Apache License

@Override
public void actionPerformed(@NotNull AnActionEvent event) {
    Project project = getEventProject(event);
    VirtualFile assetRoot = SettingsHelper.getAssetPath(IconPack.MATERIAL_ICONS);
    if (assetRoot == null) {
        Messages.showMessageDialog(project,
                "You have to select the Material Icons root folder in the settings!", "Error",
                Messages.getErrorIcon());
        if (project == null) {
            project = ProjectManager.getInstance().getDefaultProject();
        }// w  w  w .  j  a v  a  2  s  . c  o  m
        ShowSettingsUtil.getInstance().showSettingsDialog(project, "Android Drawable Importer");
    } else {
        Module module = event.getData(DataKeys.MODULE);
        MaterialIconsImporter dialog = new MaterialIconsImporter(project, module);
        dialog.show();
    }
}

From source file:generate.tostring.GenerateToStringUtils.java

License:Apache License

/**
 * Handles any exception during the executing on this plugin.
 *
 * @param project PSI project/*from   w  w w  .j  av a 2  s  . c o  m*/
 * @param e       the caused exception.
 * @throws RuntimeException is thrown for severe exceptions
 */
public static void handleExeption(Project project, Exception e) throws RuntimeException {
    e.printStackTrace(); // must print stacktrace to see caused in IDEA log / console
    log.error(e);

    if (e instanceof GenerateCodeException) {
        // code generation error - display velocity errror in error dialog so user can identify problem quicker
        Messages.showMessageDialog(project,
                "Velocity error generating code - see IDEA log for more details (stacktrace should be in idea.log):\n"
                        + e.getMessage(),
                "Warning", Messages.getWarningIcon());
    } else if (e instanceof PluginException) {
        // plugin related error - could be recoverable.
        Messages.showMessageDialog(project,
                "A PluginException was thrown while performing the action - see IDEA log for details (stacktrace should be in idea.log):\n"
                        + e.getMessage(),
                "Warning", Messages.getWarningIcon());
    } else if (e instanceof RuntimeException) {
        // unknown error (such as NPE) - not recoverable
        Messages.showMessageDialog(project,
                "An unrecoverable exception was thrown while performing the action - see IDEA log for details (stacktrace should be in idea.log):\n"
                        + e.getMessage(),
                "Error", Messages.getErrorIcon());
        throw (RuntimeException) e; // throw to make IDEA alert user
    } else {
        // unknown error (such as NPE) - not recoverable
        Messages.showMessageDialog(project,
                "An unrecoverable exception was thrown while performing the action - see IDEA log for details (stacktrace should be in idea.log):\n"
                        + e.getMessage(),
                "Error", Messages.getErrorIcon());
        throw new RuntimeException(e); // rethrow as runtime to make IDEA alert user
    }
}

From source file:intellijeval.toolwindow.NewFileAction.java

License:Apache License

private static void createNewFile(FileSystemTree fileSystemTree, final FileType fileType,
        final String initialContent) {
    final VirtualFile file = fileSystemTree.getNewFileParent();
    if (file == null || !file.isDirectory())
        return;/* w  w w.ja va2  s. co m*/

    String newFileName;
    while (true) {
        newFileName = Messages.showInputDialog(
                UIBundle.message("create.new.file.enter.new.file.name.prompt.text"),
                UIBundle.message("new.file.dialog.title"), Messages.getQuestionIcon());
        if (newFileName == null) {
            return;
        }
        if ("".equals(newFileName.trim())) {
            Messages.showMessageDialog(
                    UIBundle.message("create.new.file.file.name.cannot.be.empty.error.message"),
                    UIBundle.message("error.dialog.title"), Messages.getErrorIcon());
            continue;
        }
        Exception failReason = ((FileSystemTreeImpl) fileSystemTree).createNewFile(file, newFileName, fileType,
                initialContent);
        if (failReason != null) {
            Messages.showMessageDialog(
                    UIBundle.message("create.new.file.could.not.create.file.error.message", newFileName),
                    UIBundle.message("error.dialog.title"), Messages.getErrorIcon());
            continue;
        }
        return;
    }
}

From source file:intellijeval.Util.java

License:Apache License

public static void showErrorDialog(Project project, String message, String title) {
    Messages.showMessageDialog(project, message, title, Messages.getErrorIcon());
}

From source file:io.ballerina.plugins.idea.webview.diagram.preview.BallerinaDiagramEditor.java

License:Open Source License

@NotNull
private HtmlPanelProvider retrievePanelProvider(@NotNull DiagramApplicationSettings settings) {
    final HtmlPanelProvider.ProviderInfo providerInfo = settings.getDiagramPreviewSettings()
            .getHtmlPanelProviderInfo();

    HtmlPanelProvider provider = HtmlPanelProvider.createFromInfo(providerInfo);

    if (provider.isAvailable() != HtmlPanelProvider.AvailabilityInfo.AVAILABLE) {
        settings.setDiagramPreviewSettings(
                new DiagramPreviewSettings(settings.getDiagramPreviewSettings().getSplitEditorLayout(),
                        DiagramPreviewSettings.DEFAULT.getHtmlPanelProviderInfo(),
                        settings.getDiagramPreviewSettings().isUseGrayscaleRendering(),
                        settings.getDiagramPreviewSettings().isAutoScrollPreview()));

        Messages.showMessageDialog(myHtmlPanelWrapper,
                "Tried to use preview panel provider (" + providerInfo.getName()
                        + "), but it is unavailable. Reverting to default.",
                CommonBundle.getErrorTitle(), Messages.getErrorIcon());

        provider = HtmlPanelProvider.getProviders()[0];
    }// w w w .java 2  s. c  om

    myLastPanelProviderInfo = settings.getDiagramPreviewSettings().getHtmlPanelProviderInfo();
    return provider;
}

From source file:io.ballerina.plugins.idea.webview.diagram.preview.HtmlPanelProvider.java

License:Open Source License

@NotNull
static HtmlPanelProvider createFromInfo(@NotNull ProviderInfo providerInfo) {
    try {/*from   ww w  . j  a va 2  s . c  om*/
        return ((HtmlPanelProvider) Class.forName(providerInfo.getClassName()).newInstance());
    } catch (Exception e) {
        Messages.showMessageDialog(
                "Cannot set preview panel provider (" + providerInfo.getName() + "):\n" + e.getMessage(),
                CommonBundle.getErrorTitle(), Messages.getErrorIcon());
        Logger.getInstance(HtmlPanelProvider.class).error(e);
        return getProviders()[0];
    }
}

From source file:liveplugin.toolwindow.addplugin.git.jetbrains.plugins.github.util.GithubSslSupport.java

License:Apache License

@CalledInAwt
public boolean askIfShouldProceed(final String url) {
    String host = GithubUrlUtil.getHostFromUrl(url);

    int choice = Messages.showYesNoDialog(
            "The security certificate of " + host + " is not trusted. Do you want to proceed anyway?",
            "Not Trusted Certificate", "Proceed anyway", "No, I don't trust", Messages.getErrorIcon());
    boolean trust = (choice == Messages.YES);
    if (trust) {// w ww .  ja  v  a2  s.  co m
        saveToTrusted(host);
    }
    return trust;
}

From source file:liveplugin.toolwindow.CreateRootFileAction.java

License:Apache License

@Override
protected void actionPerformed(FileSystemTree fileSystemTree, AnActionEvent e) {
    VirtualFile parentFile = fileSystemTree.getNewFileParent();

    //noinspection ThrowableResultOfMethodCallIgnored
    Exception failReason = ((FileSystemTreeImpl) fileSystemTree).createNewFile(parentFile, newFileName,
            fileType, fileContent);/* w  ww .  ja v  a  2  s . c  om*/
    if (failReason != null) {
        String message = UIBundle.message("create.new.file.could.not.create.file.error.message", newFileName);
        String title = UIBundle.message("error.dialog.title");
        Messages.showMessageDialog(message, title, Messages.getErrorIcon());
    }
}