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

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

Introduction

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

Prototype

public static void showWarningDialog(String message,
        @NotNull @Nls(capitalization = Nls.Capitalization.Title) String title) 

Source Link

Document

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

Usage

From source file:com.arcbees.plugin.idea.wizards.createpresenter.CreatePresenterAction.java

License:Apache License

private void warn(String message) {
    Messages.showWarningDialog(message, "Warning");
}

From source file:com.boxysystems.libraryfinder.view.intellij.actions.AddToNamedLibraryAction.java

License:Apache License

private void showWarningDialog(String libraryPath) {
    switch (namedLibraryConstant) {
    case PROJECT_LIBRARY:
        Messages.showWarningDialog(
                "'" + libraryPath + "' already exists in '" + namedLibrary.getName() + "' Project Library !",
                "Warning");
        break;/* www .ja v  a  2  s  .c om*/
    case GLOBAL_LIBRARY:
        Messages.showWarningDialog(
                "'" + libraryPath + "' already exists in '" + namedLibrary.getName() + "' Global Library !",
                "Warning");
        break;
    }

}

From source file:com.hp.alm.ali.idea.action.attachment.AttachmentOpenAction.java

License:Apache License

public static void openAttachment(final Project project, String name, EntityRef parent, int size) {
    try {/*from   w  ww .j a v  a2s  . c  om*/
        final File file;
        boolean agmLink = name.endsWith(".agmlink");
        if (agmLink) {
            // for the file to open correctly, there must be no trailing extension
            file = File.createTempFile("tmp", "_" + name.replaceFirst("\\.agmlink$", ""));
        } else {
            file = File.createTempFile("tmp", "_" + name);
        }
        final Runnable openFile = new Runnable() {
            @Override
            public void run() {
                String url = VirtualFileManager.constructUrl(LocalFileSystem.PROTOCOL,
                        FileUtil.toSystemIndependentName(file.getAbsolutePath()));
                final VirtualFile virtualFile = VirtualFileManager.getInstance().refreshAndFindFileByUrl(url);
                UIUtil.invokeLaterIfNeeded(new Runnable() {
                    public void run() {
                        if (virtualFile != null) {
                            FileEditor[] editors = project.getComponent(FileEditorManager.class)
                                    .openFile(virtualFile, true);
                            if (editors.length > 0) {
                                return;
                            }

                            FileType type = FileTypeManager.getInstance()
                                    .getKnownFileTypeOrAssociate(virtualFile, project);
                            if (type instanceof INativeFileType && ((INativeFileType) type)
                                    .openFileInAssociatedApplication(project, virtualFile)) {
                                return;
                            }
                        }
                        Messages.showWarningDialog(
                                "No editor seems to be associated with this file type. Try to download and open the file manually.",
                                "Not Supported");
                    }
                });
            }
        };
        if (agmLink) {
            ProgressManager.getInstance()
                    .run(new AttachmentAgmLinkDownloadTask(project, file, name, size, parent, openFile));
        } else {
            ProgressManager.getInstance()
                    .run(new AttachmentDownloadTask(project, file, name, size, parent, openFile));
        }
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
}

From source file:com.intellij.diagnostic.TestMessageBoxAction.java

License:Apache License

@Override
public void actionPerformed(final AnActionEvent e) {
    int r = myRandom.nextInt(10);
    if (r < 3) {
        String message = wrap("Test error message.", r);
        Messages.showErrorDialog(message, "Test");
    } else if (r < 6) {
        String message = wrap("Test warning message.", r);
        Messages.showWarningDialog(message, "Test");
    } else {//from   www  . j a  v a2  s. com
        String message = wrap("Test info message.", r);
        Messages.showInfoMessage(message, "Test");
    }
}

From source file:com.intellij.ide.plugins.InstalledPluginsManagerMain.java

License:Apache License

private void checkInstalledPluginDependencies(IdeaPluginDescriptorImpl pluginDescriptor) {
    final Set<PluginId> notInstalled = new HashSet<PluginId>();
    final Set<PluginId> disabledIds = new HashSet<PluginId>();
    final PluginId[] dependentPluginIds = pluginDescriptor.getDependentPluginIds();
    final PluginId[] optionalDependentPluginIds = pluginDescriptor.getOptionalDependentPluginIds();
    for (PluginId id : dependentPluginIds) {
        if (ArrayUtilRt.find(optionalDependentPluginIds, id) > -1)
            continue;
        final boolean disabled = ((InstalledPluginsTableModel) pluginsModel).isDisabled(id);
        final boolean enabled = ((InstalledPluginsTableModel) pluginsModel).isEnabled(id);
        if (!enabled && !disabled) {
            notInstalled.add(id);//from ww  w.  ja  v a2 s.  c  o  m
        } else if (disabled) {
            disabledIds.add(id);
        }
    }
    if (!notInstalled.isEmpty()) {
        Messages.showWarningDialog("Plugin " + pluginDescriptor.getName() + " depends on unknown plugin"
                + (notInstalled.size() > 1 ? "s " : " ")
                + StringUtil.join(notInstalled, new Function<PluginId, String>() {
                    @Override
                    public String fun(PluginId id) {
                        return id.toString();
                    }
                }, ", "), CommonBundle.getWarningTitle());
    }
    if (!disabledIds.isEmpty()) {
        final Set<IdeaPluginDescriptor> dependencies = new HashSet<IdeaPluginDescriptor>();
        for (IdeaPluginDescriptor ideaPluginDescriptor : pluginsModel.getAllPlugins()) {
            if (disabledIds.contains(ideaPluginDescriptor.getPluginId())) {
                dependencies.add(ideaPluginDescriptor);
            }
        }
        final String disabledPluginsMessage = "disabled plugin" + (dependencies.size() > 1 ? "s " : " ");
        String message = "Plugin " + pluginDescriptor.getName() + " depends on " + disabledPluginsMessage
                + StringUtil.join(dependencies, new Function<IdeaPluginDescriptor, String>() {
                    @Override
                    public String fun(IdeaPluginDescriptor ideaPluginDescriptor) {
                        return ideaPluginDescriptor.getName();
                    }
                }, ", ") + ". Enable " + disabledPluginsMessage.trim() + "?";
        if (Messages.showOkCancelDialog(myActionsPanel, message, CommonBundle.getWarningTitle(),
                Messages.getWarningIcon()) == Messages.OK) {
            ((InstalledPluginsTableModel) pluginsModel).enableRows(
                    dependencies.toArray(new IdeaPluginDescriptor[dependencies.size()]), Boolean.TRUE);
        }
    }
}

From source file:com.magnet.plugin.r2m.ui.AddControllerForm.java

License:Open Source License

private void showMissingDependencies() {
    String errorMessage = "The R2M Android SDK cannot be found.\n"
            + "Add these lines to app's build.gradle and re-sync your project:\n\n\n" + ""
            + "// Adding R2M dependencies and public repo\n"
            + "// Go to https://github.com/magnetsystems/r2m-plugin-android for more info\n"
            + "dependencies {\n" + "    compile(\"com.magnet:r2m-sdk-android:1.1.0@aar\") {\n"
            + "        transitive = true\n" + "    }\n" + "}\n" + "repositories {\n" + "    maven {\n"
            + "        url \"http://repo.magnet.com:8081/artifactory/public/\"\n" + "    }\n" + "}\n";
    Messages.showWarningDialog(errorMessage, "Warning");
    // So user can also copy-paste it from the event log
    Logger.error(this.getClass(), errorMessage);

}

From source file:com.magnet.plugin.ui.AddControllerForm.java

License:Open Source License

private void showMissingDependencies() {
    String errorMessage = "The R2M Android SDK cannot be found.\n"
            + "Add these lines to app's build.gradle and re-sync your project:\n\n\n" + ""
            + "// Adding R2M dependencies and public repo\n"
            + "// Go to https://github.com/magnetsystems/r2m-plugin-android for more info\n"
            + "dependencies {\n" + "    compile(\"com.magnet:r2m-sdk-android:1.1.0@aar\") {\n"
            + "        transitive = true\n" + "    }\n" + "}\n" + "repositories {\n" + "    maven {\n"
            + "        url \"http://repo.magnet.com:8081/artifactory/public/\"\n" + "    }\n" + "}\n";
    Messages.showWarningDialog(errorMessage, "Warning");
    Logger.error(this.getClass(), errorMessage);

}

From source file:com.microsoft.alm.plugin.idea.git.ui.pullrequest.CreatePullRequestController.java

License:Open Source License

private boolean sanityCheckOnModel() {
    // if we have no target branches
    if (this.createModel.getRemoteBranchDropdownModel().getSize() == 0) {

        final String warningText = TfPluginBundle
                .message(TfPluginBundle.KEY_CREATE_PR_NO_VALID_TARGET_WARNING_MESSAGE);
        final String warningTitle = TfPluginBundle
                .message(TfPluginBundle.KEY_CREATE_PR_SANITY_CHECK_FAILED_WARNING_TITLE);

        Messages.showWarningDialog(warningText, warningTitle);

        return false;
    }//from   ww  w .  j av a  2 s.c  om

    return true;
}

From source file:com.microsoft.intellij.ui.azureroles.CacheDialog.java

License:Open Source License

private ItemListener createBackupCheckListener() {
    return new ItemListener() {
        @Override/*from  ww  w  .  java  2  s  .c o m*/
        public void itemStateChanged(ItemEvent e) {
            /*
            * If user selects backup option
            * then check virtual machine instances > 2
            * otherwise give warning
            */
            if (backupCheck.isSelected()) {
                int vmCnt = 0;
                try {
                    vmCnt = Integer.parseInt(waRole.getInstances());
                } catch (Exception ex) {
                    PluginUtil.displayErrorDialogAndLog(message("genErrTitle"), message("vmInstGetErMsg"), ex);
                }
                if (vmCnt < 2) {
                    /*
                     * If virtual machine instances < 2
                     * then make back up check-box unchecked.
                     */
                    backupCheck.setSelected(false);
                    Messages.showWarningDialog(message("backWarnMsg"), message("backWarnTtl"));
                }
            }
        }
    };
}

From source file:com.microsoft.intellij.util.PluginUtil.java

License:Open Source License

public static void displayWarningDialog(String title, String message) {
    Messages.showWarningDialog(message, title);
}