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

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

Introduction

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

Prototype

public static boolean canShowMacSheetPanel() 

Source Link

Usage

From source file:com.android.tools.idea.tests.gui.framework.fixture.MessagesFixture.java

License:Apache License

@NotNull
public static MessagesFixture findByTitle(@NotNull Robot robot, @NotNull String title) {
    if (Messages.canShowMacSheetPanel()) {
        JPanelFixture panelFixture = findMacSheetByTitle(robot, title);
        JDialog dialog = (JDialog) SwingUtilities.getWindowAncestor(panelFixture.target());
        return new MessagesFixture(panelFixture, dialog);
    }/*from   w  ww. ja  v a 2  s  .co m*/
    MessageDialogFixture dialog = MessageDialogFixture.findByTitle(robot, title);
    return new MessagesFixture(dialog, dialog.target());
}

From source file:com.intellij.ide.actions.InvalidateCachesAction.java

License:Apache License

public void actionPerformed(AnActionEvent e) {
    final Application app = ApplicationManager.getApplication();
    final boolean mac = Messages.canShowMacSheetPanel();
    String[] options = new String[3];
    options[0] = app.isRestartCapable() ? "Invalidate and Restart" : "Invalidate and Exit";
    options[1] = mac ? "Cancel" : "Invalidate";
    options[2] = mac ? "Invalidate" : "Cancel";

    int result = Messages.showYesNoCancelDialog(e.getData(CommonDataKeys.PROJECT),
            "The caches will be invalidated and rebuilt on the next startup.\n"
                    + "WARNING: Local History will be also cleared.\n\n" + "Would you like to continue?\n\n",
            "Invalidate Caches", options[0], options[1], options[2], Messages.getWarningIcon());

    if (result == -1 || result == (mac ? 1 : 2)) {
        return;//from   w  ww .  j  a va  2 s .  c o m
    }
    FSRecords.invalidateCaches();
    if (result == 0)
        app.restart();
}