@Override public void mouseDragged(MouseEvent e) { if (!myDragging) return; MouseEvent event = SwingUtilities.convertMouseEvent(e.getComponent(), e, MyDivider.this); final ToolWindowAnchor anchor = myInfo.getAnchor(); final Point point = event.getPoint(); final Container windowPane = InternalDecorator.this.getParent(); myLastPoint = SwingUtilities.convertPoint(MyDivider.this, point, windowPane); myLastPoint.x = Math.min(Math.max(myLastPoint.x, 0), windowPane.getWidth()); myLastPoint.y = Math.min(Math.max(myLastPoint.y, 0), windowPane.getHeight()); final Rectangle bounds = InternalDecorator.this.getBounds(); if (anchor == ToolWindowAnchor.TOP) { InternalDecorator.this.setBounds(0, 0, bounds.width, myLastPoint.y); } else if (anchor == ToolWindowAnchor.LEFT) { InternalDecorator.this.setBounds(0, 0, myLastPoint.x, bounds.height); } else if (anchor == ToolWindowAnchor.BOTTOM) { InternalDecorator.this.setBounds( 0, myLastPoint.y, bounds.width, windowPane.getHeight() - myLastPoint.y); } else if (anchor == ToolWindowAnchor.RIGHT) { InternalDecorator.this.setBounds( myLastPoint.x, 0, windowPane.getWidth() - myLastPoint.x, bounds.height); } InternalDecorator.this.validate(); e.consume(); }
public void cancel(InputEvent e) { if (isDisposed()) return; if (myPopup != null) { if (!canClose()) { 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) { myFocusTrackback.setForcedRestore(!myOk && myFocusable); myFocusTrackback.restoreFocus(); } disposePopup(); if (myListeners != null) { for (JBPopupListener each : myListeners) { each.onClosed(new LightweightWindowEvent(this, myOk)); } } } Disposer.dispose(this, false); }