mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
allow expandable items for popups
This commit is contained in:
@@ -18,6 +18,7 @@ package com.intellij.ui;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.ui.popup.AbstractPopup;
|
||||
import com.intellij.util.Alarm;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -213,7 +214,19 @@ abstract public class AbstractExpandableItemsHandler<KeyType, ComponentType exte
|
||||
|
||||
private boolean isPopup() {
|
||||
Window window = SwingUtilities.getWindowAncestor(myComponent);
|
||||
return window != null && !(window instanceof Dialog || window instanceof Frame);
|
||||
return window != null
|
||||
&& !(window instanceof Dialog || window instanceof Frame)
|
||||
&& !isHintsAllowed(window);
|
||||
}
|
||||
|
||||
private static boolean isHintsAllowed(Window window) {
|
||||
if (window instanceof RootPaneContainer) {
|
||||
final JRootPane pane = ((RootPaneContainer)window).getRootPane();
|
||||
if (pane != null) {
|
||||
return Boolean.TRUE.equals(pane.getClientProperty(AbstractPopup.SHOW_HINTS));
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private void hideHint() {
|
||||
|
||||
@@ -62,6 +62,7 @@ public class AbstractPopup implements JBPopup {
|
||||
|
||||
private static final Image ourMacCorner = ImageLoader.loadFromResource("/general/macCorner.png");
|
||||
private static final Object SUPPRESS_MAC_CORNER = new Object();
|
||||
public static final String SHOW_HINTS = "ShowHints";
|
||||
|
||||
private PopupComponent myPopup;
|
||||
private MyContentPanel myContent;
|
||||
@@ -322,6 +323,16 @@ public class AbstractPopup implements JBPopup {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void setShowHints(boolean show) {
|
||||
final Window ancestor = SwingUtilities.getWindowAncestor(myComponent);
|
||||
if (ancestor instanceof RootPaneContainer) {
|
||||
final JRootPane rootPane = ((RootPaneContainer)ancestor).getRootPane();
|
||||
if (rootPane != null) {
|
||||
rootPane.putClientProperty(SHOW_HINTS, Boolean.valueOf(show));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void suppressMacCornerFor(JComponent popupComponent) {
|
||||
popupComponent.putClientProperty(SUPPRESS_MAC_CORNER, Boolean.TRUE);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user