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

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

Introduction

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

Prototype

public int getExitCode() 

Source Link

Usage

From source file:com.intellij.ide.navigationToolbar.NavBarListener.java

License:Apache License

@Override
public void focusLost(final FocusEvent e) {
    if (myPanel.getProject().isDisposed()) {
        myPanel.setContextComponent(null);
        myPanel.hideHint();/*from w  w w. ja  va  2 s .  co m*/
        return;
    }
    final DialogWrapper dialog = DialogWrapper.findInstance(e.getOppositeComponent());
    shouldFocusEditor = dialog != null;
    if (dialog != null) {
        Disposer.register(dialog.getDisposable(), new Disposable() {
            @Override
            public void dispose() {
                if (dialog.getExitCode() == DialogWrapper.CANCEL_EXIT_CODE) {
                    shouldFocusEditor = false;
                }
            }
        });
    }

    // required invokeLater since in current call sequence KeyboardFocusManager is not initialized yet
    // but future focused component
    //noinspection SSBasedInspection
    SwingUtilities.invokeLater(new Runnable() {
        @Override
        public void run() {
            processFocusLost(e);
        }
    });
}