Example usage for com.intellij.openapi.ui.popup StackingPopupDispatcher getInstance

List of usage examples for com.intellij.openapi.ui.popup StackingPopupDispatcher getInstance

Introduction

In this page you can find the example usage for com.intellij.openapi.ui.popup StackingPopupDispatcher getInstance.

Prototype

public static StackingPopupDispatcher getInstance() 

Source Link

Usage

From source file:com.intellij.ui.popup.AbstractPopup.java

License:Apache License

@Override
public void cancel(InputEvent e) {
    if (myState == State.CANCEL || myState == State.DISPOSE) {
        return;//from w  ww.j ava 2s  .c  om
    }
    debugState("cancel popup", State.SHOWN);
    myState = State.CANCEL;

    if (isDisposed())
        return;

    if (myPopup != null) {
        if (!canClose()) {
            debugState("cannot cancel popup", State.CANCEL);
            myState = State.SHOWN;
            return;
        }
        storeDimensionSize(myContent.getSize());
        if (myUseDimServiceForXYLocation) {
            final JRootPane root = myComponent.getRootPane();
            if (root != null) {
                final Container popupWindow = root.getParent();
                if (popupWindow != null && popupWindow.isShowing()) {
                    storeLocation(popupWindow.getLocationOnScreen());
                }
            }
        }

        if (e instanceof MouseEvent) {
            IdeEventQueue.getInstance().blockNextEvents((MouseEvent) e);
        }

        myPopup.hide(false);

        if (ApplicationManagerEx.getApplicationEx() != null) {
            StackingPopupDispatcher.getInstance().onPopupHidden(this);
        }

        if (myInStack) {
            if (myFocusTrackback != null) {
                myFocusTrackback.setForcedRestore(!myOk && myFocusable);
                myFocusTrackback.restoreFocus();
            } else if (LOG.isDebugEnabled()) {
                LOG.debug("cancel before show @ " + Thread.currentThread());
            }
        }

        disposePopup();

        if (myListeners != null) {
            for (JBPopupListener each : myListeners) {
                each.onClosed(new LightweightWindowEvent(this, myOk));
            }
        }
    }

    Disposer.dispose(this, false);
    if (myProjectDisposable != null) {
        Disposer.dispose(myProjectDisposable);
    }
}

From source file:com.intellij.ui.popup.AbstractPopup.java

License:Apache License

protected boolean beforeShow() {
    if (ApplicationManagerEx.getApplicationEx() == null)
        return true;
    StackingPopupDispatcher.getInstance().onPopupShown(this, myInStack);
    return true;//from w w w.  j a  v a 2 s. com
}