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

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

Introduction

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

Prototype

public static int showIdeaMessageDialog(@Nullable Project project, String message,
        @Nls(capitalization = Nls.Capitalization.Title) String title, String @NotNull [] options,
        int defaultOptionIndex, @Nullable Icon icon, @Nullable DialogWrapper.DoNotAskOption doNotAskOption) 

Source Link

Usage

From source file:com.android.tools.idea.updater.configure.SdkUpdaterConfigurable.java

License:Apache License

private static boolean confirmChange(HtmlBuilder message) {
    String[] options = { Messages.OK_BUTTON, Messages.CANCEL_BUTTON };
    Icon icon = AllIcons.General.Warning;

    // I would use showOkCancelDialog but Mac sheet panels do not gracefully handle long messages and their buttons can display offscreen
    return Messages.showIdeaMessageDialog(null, message.getHtml(), "Confirm Change", options, 0, icon,
            null) == Messages.OK;/*from   w w w. j  a v  a  2  s. co  m*/
}

From source file:com.android.tools.idea.welcome.wizard.AndroidStudioWelcomeScreenProvider.java

License:Apache License

@Nullable
private static ConnectionState promptUserForProxy() {
    int selection = Messages.showIdeaMessageDialog(null, "Unable to access Android SDK add-on list",
            "Android Studio First Run", new String[] { "Setup Proxy", "Cancel" }, 1, Messages.getErrorIcon(),
            null);//from   w  w w. j  a  v a2  s .c  o  m
    if (selection == 0) {
        //noinspection ConstantConditions
        HttpConfigurable.editConfigurable(null);
        return null;
    } else {
        return ConnectionState.NO_CONNECTION;
    }
}

From source file:io.flutter.FlutterMessages.java

License:Open Source License

public static int showDialog(@Nullable Project project, @NotNull String message,
        @NotNull @Nls(capitalization = Nls.Capitalization.Title) String title, @NotNull String[] options,
        int defaultOptionIndex) {
    return Messages.showIdeaMessageDialog(project, message, title, options, defaultOptionIndex,
            FlutterIcons.Flutter_2x, null);
}

From source file:org.jetbrains.idea.devkit.actions.ShowSerializedXmlAction.java

License:Apache License

private static void generateAndShowXml(final Module module, final String className) {
    final List<URL> urls = new ArrayList<URL>();
    final List<String> list = OrderEnumerator.orderEntries(module).recursively().runtimeOnly().getPathsList()
            .getPathList();/*  w w  w.j ava 2 s . c  om*/
    for (String path : list) {
        try {
            urls.add(new File(FileUtil.toSystemIndependentName(path)).toURI().toURL());
        } catch (MalformedURLException e1) {
            LOG.info(e1);
        }
    }

    final Project project = module.getProject();
    UrlClassLoader loader = UrlClassLoader.build().urls(urls).parent(XmlSerializer.class.getClassLoader())
            .get();
    final Class<?> aClass;
    try {
        aClass = Class.forName(className, true, loader);
    } catch (ClassNotFoundException e) {
        Messages.showErrorDialog(project, "Cannot find class '" + className + "'",
                CommonBundle.getErrorTitle());
        LOG.info(e);
        return;
    }

    final Object o;
    try {
        o = new SampleObjectGenerator().createValue(aClass, FList.<Type>emptyList());
    } catch (Exception e) {
        Messages.showErrorDialog(project, "Cannot generate class '" + className + "': " + e.getMessage(),
                CommonBundle.getErrorTitle());
        LOG.info(e);
        return;
    }

    final Element element = XmlSerializer.serialize(o);
    final String text = JDOMUtil.writeElement(element, "\n");
    Messages.showIdeaMessageDialog(project, text, "Serialized XML for '" + className + "'",
            new String[] { CommonBundle.getOkButtonText() }, 0, Messages.getInformationIcon(), null);
}

From source file:org.jetbrains.plugins.github.util.GithubSslSupport.java

License:Apache License

@CalledInAwt
public boolean askIfShouldProceed(final String host) {
    final String BACK_TO_SAFETY = "No, I don't trust";
    final String TRUST = "Proceed anyway";
    //int choice = Messages.showDialog("The security certificate of " + host + " is not trusted. Do you want to
    // proceed anyway?",
    //                               "Not Trusted Certificate", new String[] { BACK_TO_SAFETY, TRUST }, 0,
    // Messages.getErrorIcon());
    int choice = Messages.showIdeaMessageDialog(null,
            "The security certificate of " + host + " is not trusted. Do" + " you want to proceed anyway?",
            "Not Trusted Certificate", new String[] { BACK_TO_SAFETY, TRUST }, 0, Messages.getErrorIcon(),
            null);/*from w  w  w  . j a  va 2s  .c  om*/
    boolean trust = (choice == 1);
    if (trust) {
        saveToTrusted(host);
    }
    return trust;
}