Example usage for com.intellij.openapi.ui DialogWrapper DEFAULT_ACTION

List of usage examples for com.intellij.openapi.ui DialogWrapper DEFAULT_ACTION

Introduction

In this page you can find the example usage for com.intellij.openapi.ui DialogWrapper DEFAULT_ACTION.

Prototype

String DEFAULT_ACTION

To view the source code for com.intellij.openapi.ui DialogWrapper DEFAULT_ACTION.

Click Source Link

Document

If your action returned by createActions method has non null value for this key, then the button that corresponds to the action will be the default button for the dialog.

Usage

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

License:Apache License

public OutOfMemoryDialog(MemoryKind memoryKind) {
    super(false);
    myMemoryKind = memoryKind;/*  w w w .  j  a  va2 s .c om*/
    setTitle(DiagnosticBundle.message("diagnostic.out.of.memory.title"));

    myMessageLabel.setIcon(Messages.getErrorIcon());
    myMessageLabel.setText(DiagnosticBundle.message("diagnostic.out.of.memory.error",
            memoryKind == MemoryKind.HEAP ? VMOptions.XMX_OPTION_NAME
                    : memoryKind == MemoryKind.PERM_GEN ? VMOptions.PERM_GEN_OPTION_NAME
                            : VMOptions.CODE_CACHE_OPTION_NAME,
            ApplicationNamesInfo.getInstance().getProductName()));

    File file = VMOptions.getWriteFile();
    final String path = file != null ? file.getPath() : null;
    if (path != null) {
        mySettingsFileHintLabel
                .setText(DiagnosticBundle.message("diagnostic.out.of.memory.willBeSavedTo", path));
    } else {
        mySettingsFileHintLabel.setVisible(false);
    }

    myIgnoreAction = new AbstractAction(DiagnosticBundle.message("diagnostic.out.of.memory.ignore")) {
        public void actionPerformed(ActionEvent e) {
            save();
            close(0);
        }
    };

    myShutdownAction = new AbstractAction(DiagnosticBundle.message("diagnostic.out.of.memory.shutdown")) {
        public void actionPerformed(ActionEvent e) {
            save();
            System.exit(0);
        }
    };
    myShutdownAction.putValue(DialogWrapper.DEFAULT_ACTION, true);

    configControls(VMOptions.XMX_OPTION_NAME, VMOptions.readXmx(), memoryKind == MemoryKind.HEAP,
            myHeapSizeLabel, myHeapSizeField, myHeapUnitsLabel, myHeapCurrentValueLabel);

    configControls(VMOptions.PERM_GEN_OPTION_NAME, VMOptions.readMaxPermGen(),
            memoryKind == MemoryKind.PERM_GEN, myPermGenSizeLabel, myPermGenSizeField, myPermGenUnitsLabel,
            myPermGenCurrentValueLabel);

    configControls(VMOptions.CODE_CACHE_OPTION_NAME, VMOptions.readCodeCache(),
            memoryKind == MemoryKind.CODE_CACHE, myCodeCacheSizeLabel, myCodeCacheSizeField,
            myCodeCacheUnitsLabel, myCodeCacheCurrentValueLabel);

    init();
}

From source file:com.intellij.refactoring.safeDelete.UnsafeUsagesDialog.java

License:Apache License

@Override
@NotNull/*from   w ww  .  ja  v a  2  s.  c  o m*/
protected Action[] createActions() {
    final ViewUsagesAction viewUsagesAction = new ViewUsagesAction();

    final Action ignoreAction = getOKAction();
    ignoreAction.putValue(DialogWrapper.DEFAULT_ACTION, null);

    return new Action[] { viewUsagesAction, ignoreAction, new CancelAction() };
}