Java Code Examples for com.intellij.openapi.ui.Messages#showIdeaMessageDialog()

The following examples show how to use com.intellij.openapi.ui.Messages#showIdeaMessageDialog() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RNUpgradeAction.java    From react-native-console with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public boolean beforeAction() {
    String exePath = RNPathUtil.getExecuteFileFullPath(EXEC);

    if (exePath == null || EXEC.equals(RNPathUtil.getExecuteFileFullPath(EXEC))) {
        int options = Messages.showIdeaMessageDialog(getProject(),
                "Would you like to install " + EXEC + " globally now?\n" +
                        "This might take one or two minutes without any console update, please wait for the final result.\n" +
                        "After that, you'll need to click this button again.",
                "Can Not Found " + EXEC, new String[]{"Yes", "No"}, 0,
                AllIcons.General.QuestionDialog, new DialogWrapper.DoNotAskOption.Adapter() {
                    @Override
                    public void rememberChoice(boolean b, int i) {

                    }
                });
        if (options == 0) {
            cmd = INSTALL_CMD;
            return true;
        } else {
            RNConsole consoleView = terminal.getRNConsole(getText(), getIcon());

            if (consoleView != null) {
                consoleView.clear();
                consoleView.print(
                        "Can't found " + EXEC + ", if you were first running this command, make sure you have " + EXEC + " installed globally.\n" +
                                "To install, please run in terminal with command: \n" +
                                INSTALL_CMD +
                                "\n\n",
                        ConsoleViewContentType.ERROR_OUTPUT);

            }
            return false;
        }

    }

    cmd = EXEC;
    return true;
}
 
Example 2
Source File: ReactDevToolsAction.java    From react-native-console with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
    public boolean beforeAction() {
        String exePath = RNPathUtil.getExecuteFileFullPath(EXEC);
        if (exePath == null || EXEC.equals(RNPathUtil.getExecuteFileFullPath(EXEC))) {
//            GlobalPropertyBasedDoNotAskOption dontAsk = new GlobalPropertyBasedDoNotAskOption("react-devtools.to.show"); // TODO no use so far
            int options = Messages.showIdeaMessageDialog(getProject(),
                    "Would you like to install react-devtools globally now?\n" +
                            "This might take one or two minutes without any console update, please wait for the final result.\n" +
                            "After that, you'll need to click this button again.",
                    "Can Not Found React-Devtools", new String[]{"Yes", "No"}, 0,
                    AllIcons.General.QuestionDialog, new DialogWrapper.DoNotAskOption.Adapter() {
                        @Override
                        public void rememberChoice(boolean b, int i) {

                        }
                    });
            if (options == 0) {
                cmd = "npm install -g react-devtools";
                return true;
            } else {
                RNConsole consoleView = terminal.getRNConsole(getText(), getIcon());

                if (consoleView != null) {
                    consoleView.clear();
                    consoleView.print(
                            "Can't found " + EXEC + ", if you were first running this command, make sure you have react-devtools installed globally.\n" +
                                    "To install by yourself, please run in terminal with command: \n" +
                                    "npm install -g react-devtools\n\n",
                            ConsoleViewContentType.ERROR_OUTPUT);

                }
                return false;
            }

        }

        cmd = EXEC;
        return true;
    }
 
Example 3
Source File: FlutterMessages.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public static int showDialog(@Nullable Project project,
                             @NotNull String message,
                             @NotNull @Nls String title,
                             @NotNull String[] options,
                             int defaultOptionIndex) {
  return Messages.showIdeaMessageDialog(project, message, title,
                                        options, defaultOptionIndex,
                                        FlutterIcons.Flutter_2x, null);
}
 
Example 4
Source File: FlutterMessages.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public static int showDialog(@Nullable Project project,
                             @NotNull String message,
                             @NotNull @Nls String title,
                             @NotNull String[] options,
                             int defaultOptionIndex) {
  return Messages.showIdeaMessageDialog(project, message, title,
                                        options, defaultOptionIndex,
                                        FlutterIcons.Flutter_2x, null);
}
 
Example 5
Source File: RunIOSDeviceAction.java    From react-native-console with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
    public boolean beforeAction() {
        String exePath = RNPathUtil.getExecuteFileFullPath(IOS_DEPLOY);

        if (exePath == null || IOS_DEPLOY.equals(RNPathUtil.getExecuteFileFullPath(IOS_DEPLOY))) {
//            GlobalPropertyBasedDoNotAskOption dontAsk = new GlobalPropertyBasedDoNotAskOption("react-devtools.to.show"); // TODO no use so far
            int options = Messages.showIdeaMessageDialog(getProject(),
                    "Would you like to install ios-deploy globally now?\n" +
                            "This might take one or two minutes without any console update, please wait for the final result.\n" +
                            "After that, you'll need to click this button again.",
                    "Can Not Found Ios-Deploy", new String[]{"Yes", "No"}, 0,
                    AllIcons.General.QuestionDialog, new DialogWrapper.DoNotAskOption.Adapter() {
                        @Override
                        public void rememberChoice(boolean b, int i) {

                        }
                    });
            if (options == 0) {
                cmd = "npm install -g ios-deploy";
                return true;
            } else {
                RNConsole consoleView = terminal.getRNConsole(getText(), getIcon());

                if (consoleView != null) {
                    consoleView.clear();
                    consoleView.print(
                            "Can't found " + IOS_DEPLOY + ", if you were first running this command, make sure you have ios-deploy installed globally.\n" +
                                    "To install, please run in terminal with command: \n" +
                                    "npm install -g ios-deploy\n" +
                                    "And now please connect your iPhone to USB and enable developer mode.\n\n",
                            ConsoleViewContentType.ERROR_OUTPUT);

                }
                return false;
            }

        }

        cmd = EXEC;
        return true;
    }