protected final void showProgress(String message) { myProgressMessage.setText(message); if (myProgressPanel.getParent() == null) { myGlassLayer.setEnabled(false); myProgressIcon.resume(); myLayeredPane.add(myProgressPanel, LAYER_PROGRESS); myLayeredPane.repaint(); } }
private void finishDragging() { if (!isDraggingNow()) return; myDragPane.remove(myDragButtonImage); myDragButtonImage = null; myPane.stopDrag(); myDragPane.repaint(); setVisible(true); if (myLastStripe != null) { myLastStripe.finishDrop(); myLastStripe = null; } if (myDragKeyEventDispatcher != null) { KeyboardFocusManager.getCurrentKeyboardFocusManager() .removeKeyEventDispatcher(myDragKeyEventDispatcher); myDragKeyEventDispatcher = null; } }
private void manageSearchPopup(@Nullable SearchPopup searchPopup) { final Project project; if (ApplicationManager.getApplication() != null && !ApplicationManager.getApplication().isDisposed()) { project = PlatformDataKeys.PROJECT.getData(DataManager.getInstance().getDataContext(myComponent)); } else { project = null; } if (mySearchPopup != null) { myPopupLayeredPane.remove(mySearchPopup); myPopupLayeredPane.validate(); myPopupLayeredPane.repaint(); myPopupLayeredPane = null; if (project != null) { ((ToolWindowManagerEx) ToolWindowManager.getInstance(project)) .removeToolWindowManagerListener(myWindowManagerListener); } } else if (searchPopup != null) { FeatureUsageTracker.getInstance().triggerFeatureUsed("ui.tree.speedsearch"); } if (!myComponent.isShowing()) { mySearchPopup = null; } else { mySearchPopup = searchPopup; } fireStateChanged(); if (mySearchPopup == null || !myComponent.isDisplayable()) return; if (project != null) { ((ToolWindowManagerEx) ToolWindowManager.getInstance(project)) .addToolWindowManagerListener(myWindowManagerListener); } JRootPane rootPane = myComponent.getRootPane(); if (rootPane != null) { myPopupLayeredPane = rootPane.getLayeredPane(); } else { myPopupLayeredPane = null; } if (myPopupLayeredPane == null) { LOG.error(toString() + " in " + String.valueOf(myComponent)); return; } myPopupLayeredPane.add(mySearchPopup, JLayeredPane.POPUP_LAYER); if (myPopupLayeredPane == null) return; // See # 27482. Somewho it does happen... Point lPaneP = myPopupLayeredPane.getLocationOnScreen(); Point componentP = getComponentLocationOnScreen(); Rectangle r = getComponentVisibleRect(); Dimension prefSize = mySearchPopup.getPreferredSize(); Window window = (Window) SwingUtilities.getAncestorOfClass(Window.class, myComponent); Point windowP; if (window instanceof JDialog) { windowP = ((JDialog) window).getContentPane().getLocationOnScreen(); } else if (window instanceof JFrame) { windowP = ((JFrame) window).getContentPane().getLocationOnScreen(); } else { windowP = window.getLocationOnScreen(); } int y = r.y + componentP.y - lPaneP.y - prefSize.height; y = Math.max(y, windowP.y - lPaneP.y); mySearchPopup.setLocation(componentP.x - lPaneP.x + r.x, y); mySearchPopup.setSize(prefSize); mySearchPopup.setVisible(true); mySearchPopup.validate(); }