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

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

Introduction

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

Prototype

@NotNull
    public static Icon getQuestionIcon() 

Source Link

Usage

From source file:com.atlassian.theplugin.idea.config.serverconfig.CrucibleServerConfigForm.java

License:Apache License

private void createUIComponents() {
    crucibleDetailConfigForm = new CrucibleDetailConfigForm(crucibleServerFacade);
    final CrucibleConnector connector = new CrucibleConnector(crucibleServerFacade, fishEyeServerFacade);
    genericServerConfigForm = new GenericServerConfigForm(project, defaultUser, connector) {
        @Override/*from ww  w .  java2 s.c  o m*/
        public void onSuccess() {
            if (connector.isFisheye() == true && !crucibleDetailConfigForm.isFishEyeInstance()) {
                int res = Messages.showYesNoDialog(project,
                        "This Crucible server is connected to Fisheye.\nWould you like to connect to the Fisheye server as well?",
                        "Combined FishEye & Crucible detected", Messages.getQuestionIcon());
                if (res == DialogWrapper.OK_EXIT_CODE) {
                    crucibleDetailConfigForm.setIsFishEyeInstance(true);
                }
            }
        }
    };
}

From source file:com.atlassian.theplugin.idea.config.serverconfig.ServerTreePanel.java

License:Apache License

public void removeServer() {
    if (selectedNode != null) {
        if (selectedNode instanceof ServerNode) {
            final ServerNode selectedServerNode = (ServerNode) this.selectedNode;
            int response = Messages.showYesNoDialog("Are you sure you want to delete the selected server?",
                    "Confirm server delete", Messages.getQuestionIcon());

            if (response != 0) {
                return;
            }//w w w.jav  a 2 s .c o  m

            final ServerCfg serverCfg = selectedServerNode.getServer();
            if (serverCfg.isShared()) {
                serverCfg.setDeleted(true);
                serverConfigPanel.showEmptyPanel();
            } else {
                servers.remove(serverCfg);
            }
            TreeNode parent = selectedServerNode.getParent();
            selectedServerNode.removeFromParent();
            model.nodeStructureChanged(parent);
            deleteServerFile(serverCfg);
        }
    }
}

From source file:com.bitbakery.plugin.arc.actions.NewArcFileAction.java

License:Artistic License

@NotNull
protected final PsiElement[] invokeDialog(final Project project, final PsiDirectory directory) {
    MyInputValidator validator = new MyInputValidator(project, directory);
    Messages.showInputDialog(project, getDialogPrompt(), getDialogTitle(), Messages.getQuestionIcon(), "",
            validator);//from w  w  w  .j  av a2s . c  om

    return validator.getCreatedElements();
}

From source file:com.cfsoft.ofbiz.facet.ui.ComponentFileSetConfigurationTab.java

License:Apache License

private void remove() {
    final SimpleNode[] nodes = myTree.getSelectedNodesIfUniform();
    for (final SimpleNode node : nodes) {

        if (node instanceof FileSetNode) {
            final OfbizFileSet fileSet = ((FileSetNode) node).mySet;
            if (fileSet.getFiles().isEmpty()) {
                myBuffer.remove(fileSet);
                return;
            }//w ww  .j av a2  s.co  m

            final int result = Messages.showYesNoDialog(myPanel,
                    String.format("Remove File Set '%s' ?", fileSet.getName()), "Confirm removal",
                    Messages.getQuestionIcon());
            if (result == DialogWrapper.OK_EXIT_CODE) {
                if (fileSet.isAutodetected()) {
                    fileSet.setRemoved(true);
                    myBuffer.add(fileSet);
                } else {
                    myBuffer.remove(fileSet);
                }
            }
        } else if (node instanceof ConfigFileNode) {
            final VirtualFilePointer filePointer = ((ConfigFileNode) node).myFilePointer;
            final OfbizFileSet fileSet = ((FileSetNode) node.getParent()).mySet;
            fileSet.removeFile(filePointer);
        }
    }

}

From source file:com.chrisrm.idea.MTLafComponent.java

License:Open Source License

/**
 * Restart IDE if necessary (ex: material design components)
 *
 * @param mtConfig//from w w w .j  a  v a2  s . c  o  m
 * @param form
 */
private void restartIdeIfNecessary(final MTConfig mtConfig, final MTForm form) {
    // Restart the IDE if changed
    if (mtConfig.needsRestart(form)) {
        final String title = MaterialThemeBundle.message("mt.restartDialog.title");
        final String message = MaterialThemeBundle.message("mt.restartDialog.content");

        final int answer = Messages.showYesNoDialog(message, title, Messages.getQuestionIcon());
        if (answer == Messages.YES) {
            willRestartIde = true;
        }
    }
}

From source file:com.chrisrm.idea.MTLafComponent.java

License:Open Source License

/**
 * Ask for resetting custom theme colors when the LafManager is switched from or to dark mode
 *
 * @param source/*from  w ww  .j  a v a2  s.co  m*/
 */
private void askResetCustomTheme(final LafManager source) {
    // If switched look and feel and asking for reset (default true)
    if (source.getCurrentLookAndFeel() != currentLookAndFeel
            && !MTCustomThemeConfig.getInstance().isDoNotAskAgain()) {
        final int dialog = Messages.showOkCancelDialog(
                MaterialThemeBundle.message("mt.resetCustomTheme.message"),
                MaterialThemeBundle.message("mt.resetCustomTheme.title"), CommonBundle.getOkButtonText(),
                CommonBundle.getCancelButtonText(), Messages.getQuestionIcon(),
                new DialogWrapper.DoNotAskOption.Adapter() {
                    @Override
                    public void rememberChoice(final boolean isSelected, final int exitCode) {
                        if (exitCode != -1) {
                            MTCustomThemeConfig.getInstance().setDoNotAskAgain(isSelected);
                        }
                    }
                });

        if (dialog == Messages.YES) {
            MTCustomThemeConfig.getInstance().setDefaultValues();
            currentLookAndFeel = source.getCurrentLookAndFeel();

            MTThemeManager.getInstance().activate();
        }
    }
    currentLookAndFeel = source.getCurrentLookAndFeel();
}

From source file:com.chrisrm.idea.MTThemeManager.java

License:Open Source License

private void askForRestart() {
    final String title = MaterialThemeBundle.message("mt.restartDialog.title");
    final String message = MaterialThemeBundle.message("mt.restartDialog.content");

    final int answer = Messages.showYesNoDialog(message, title, Messages.getQuestionIcon());
    if (answer == Messages.YES) {
        MTUiUtils.restartIde();/*from ww  w .  ja  v  a  2 s  . com*/
    }
}

From source file:com.elega9t.intellij.plugin.jbehave.actions.CreateNewStoryAction.java

License:Open Source License

@NotNull
@Override//from ww w  .  ja  v  a 2 s .c om
protected PsiElement[] invokeDialog(Project project, PsiDirectory directory) {
    MyInputValidator validator = new MyInputValidator(project, directory);
    Messages.showInputDialog(project, "File name:", "jBehave Feature File", Messages.getQuestionIcon(), "",
            validator);
    return validator.getCreatedElements();
}

From source file:com.github.kumaraman21.intellijbehave.creator.CreateStoryAction.java

License:Apache License

@NotNull
@Override//  w  w  w .  j av a2 s .c o m
protected PsiElement[] invokeDialog(Project project, PsiDirectory directory) {
    CreateElementActionBase.MyInputValidator validator = new CreateElementActionBase.MyInputValidator(project,
            directory);
    Messages.showInputDialog(project, "Enter a new file name:", "New Story File", Messages.getQuestionIcon(),
            "", validator);
    return validator.getCreatedElements();
}

From source file:com.google.cloud.tools.intellij.settings.ImportSettings.java

License:Apache License

/**
 * Parse and update the IDEA settings in the jar at <code>path</code>. Note: This function might
 * require a restart of the application.
 *
 * @param path The location of the jar with the new IDEA settings.
 */// w  w w  .  ja  v a2 s . c om
public static void doImport(String path) {
    final File saveFile = new File(path);
    ZipFile saveZipFile = null;
    try {
        if (!saveFile.exists()) {
            Messages.showErrorDialog(IdeBundle.message("error.cannot.find.file", presentableFileName(saveFile)),
                    DIALOG_TITLE);
            return;
        }

        // What is this file used for?
        saveZipFile = new ZipFile(saveFile);
        final ZipEntry magicEntry = saveZipFile.getEntry(SETTINGS_JAR_MARKER);
        if (magicEntry == null) {
            Messages.showErrorDialog(
                    "The file " + presentableFileName(saveFile) + " contains no settings to import",
                    DIALOG_TITLE);
            return;
        }

        final List<ExportableComponent> registeredComponents = new ArrayList<ExportableComponent>(Arrays.asList(
                ApplicationManager.getApplication().getComponents(ExportableApplicationComponent.class)));
        registeredComponents.addAll(ServiceBean.loadServicesFromBeans(ExportableComponent.EXTENSION_POINT,
                ExportableComponent.class));

        List<ExportableComponent> storedComponents = getComponentsStored(saveFile, registeredComponents);

        Set<String> relativeNamesToExtract = new HashSet<String>();
        for (final ExportableComponent exportableComponent : storedComponents) {
            final File[] exportFiles = exportableComponent.getExportFiles();
            for (File exportFile : exportFiles) {
                final File configPath = new File(PathManager.getConfigPath());
                final String rPath = FileUtil.getRelativePath(configPath, exportFile);
                assert rPath != null;
                final String relativePath = FileUtil.toSystemIndependentName(rPath);
                relativeNamesToExtract.add(relativePath);
            }
        }

        relativeNamesToExtract.add(PluginManager.INSTALLED_TXT);

        final File tempFile = new File(PathManager.getPluginTempPath() + "/" + saveFile.getName());
        FileUtil.copy(saveFile, tempFile);
        File outDir = new File(PathManager.getConfigPath());
        final ImportSettingsFilenameFilter filenameFilter = new ImportSettingsFilenameFilter(
                relativeNamesToExtract);
        StartupActionScriptManager.ActionCommand unzip = new StartupActionScriptManager.UnzipCommand(tempFile,
                outDir, filenameFilter);
        StartupActionScriptManager.addActionCommand(unzip);

        // remove temp file
        StartupActionScriptManager.ActionCommand deleteTemp = new StartupActionScriptManager.DeleteCommand(
                tempFile);
        StartupActionScriptManager.addActionCommand(deleteTemp);

        UpdateSettings.getInstance().forceCheckForUpdateAfterRestart();

        String key = ApplicationManager.getApplication().isRestartCapable()
                ? "message.settings.imported.successfully.restart"
                : "message.settings.imported.successfully";
        final int ret = Messages.showOkCancelDialog(
                IdeBundle.message(key, ApplicationNamesInfo.getInstance().getProductName(),
                        ApplicationNamesInfo.getInstance().getFullProductName()),
                IdeBundle.message("title.restart.needed"), Messages.getQuestionIcon());
        if (ret == Messages.OK) {
            ((ApplicationEx) ApplicationManager.getApplication()).restart(true);
        }
    } catch (ZipException e1) {
        Messages.showErrorDialog(
                "Error reading file " + presentableFileName(saveFile) + ".\\nThere was " + e1.getMessage(),
                DIALOG_TITLE);
    } catch (IOException e1) {
        Messages.showErrorDialog(IdeBundle.message("error.reading.settings.file.2",
                presentableFileName(saveFile), e1.getMessage()), DIALOG_TITLE);
    } finally {
        try {
            if (saveZipFile != null) {
                saveZipFile.close();
            }
        } catch (IOException e1) {
            Messages.showErrorDialog(GctBundle.message("settings.error.closing.file",
                    presentableFileName(saveFile), e1.getMessage()), DIALOG_TITLE);
        }
    }
}