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

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

Introduction

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

Prototype

@NotNull
    public final Disposable getDisposable() 

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();/*  w  w w.j ava2s  . c  o 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);
        }
    });
}