List of usage examples for com.intellij.openapi.ui.popup LightweightWindowEvent LightweightWindowEvent
public LightweightWindowEvent(@NotNull LightweightWindow window, boolean isOk)
From source file:com.intellij.ui.BalloonImpl.java
License:Apache License
private void hideAndDispose(final boolean ok) { if (myDisposed) return;/*from www. j a va2 s . c o m*/ myDisposed = true; final Runnable disposeRunnable = new Runnable() { @Override public void run() { myFadedOut = true; for (JBPopupListener each : myListeners) { each.onClosed(new LightweightWindowEvent(BalloonImpl.this, ok)); } Disposer.dispose(BalloonImpl.this); onDisposed(); } }; Toolkit.getDefaultToolkit().removeAWTEventListener(myAwtActivityListener); if (myLayeredPane != null) { myLayeredPane.removeComponentListener(myComponentListener); Disposer.register(ApplicationManager.getApplication(), this); // to be safe if Application suddenly exits and animation wouldn't have a chance to complete runAnimation(false, myLayeredPane, new Runnable() { @Override public void run() { disposeRunnable.run(); } }); } else { disposeRunnable.run(); } myVisible = false; myTracker = null; }
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 w w.j ava2 s .c o m } 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); } }