From ceaa24debaa34d3a53f55772c77c596bb53eec7f Mon Sep 17 00:00:00 2001 From: "Vassiliy.Kudryashov" Date: Thu, 13 Jun 2019 22:36:01 +0300 Subject: [PATCH] IDEA-215905 Update 'Open in Find Tool Window' for Documentation pop-up GitOrigin-RevId: 3185a5c12b07d7c258ad2db2e7dc5a889e1ef59b --- .../documentation/DocumentationComponent.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/codeInsight/documentation/DocumentationComponent.java b/platform/lang-impl/src/com/intellij/codeInsight/documentation/DocumentationComponent.java index 581da668b1ab..d6cdf8dfe486 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/documentation/DocumentationComponent.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/documentation/DocumentationComponent.java @@ -51,6 +51,8 @@ import com.intellij.openapi.util.registry.Registry; import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.openapi.wm.IdeFocusManager; +import com.intellij.openapi.wm.ToolWindowId; +import com.intellij.openapi.wm.ex.ToolWindowManagerEx; import com.intellij.openapi.wm.ex.WindowManagerEx; import com.intellij.pom.Navigatable; import com.intellij.psi.PsiElement; @@ -516,7 +518,8 @@ public class DocumentationComponent extends JPanel implements Disposable, DataPr layeredPane.setLayer(myScrollPane, 0); DefaultActionGroup gearActions = new MyGearActionGroup(); - gearActions.add(new ShowAsToolwindowAction()); + ShowAsToolwindowAction showAsToolwindowAction = new ShowAsToolwindowAction(); + gearActions.add(showAsToolwindowAction); gearActions.add(new MyShowSettingsAction(false)); gearActions.add(new ShowToolbarAction()); gearActions.add(new RestoreDefaultSizeAction()); @@ -525,8 +528,14 @@ public class DocumentationComponent extends JPanel implements Disposable, DataPr Presentation presentation = new Presentation(); presentation.setIcon(AllIcons.Actions.More); presentation.putClientProperty(ActionButton.HIDE_DROPDOWN_ICON, Boolean.TRUE); - myCorner = new ActionButton(gearActions, presentation, ActionPlaces.UNKNOWN, new Dimension(20, 20)); + myCorner = new ActionButton(gearActions, presentation, ActionPlaces.UNKNOWN, new Dimension(20, 20)) { + @Override + protected DataContext getDataContext() { + return DataManager.getInstance().getDataContext(myCorner); + } + }; myCorner.setNoIconsInPopup(true); + showAsToolwindowAction.registerCustomShortcutSet(KeymapUtil.getActiveKeymapShortcuts("QuickJavaDoc"), myCorner); layeredPane.add(myCorner); layeredPane.setLayer(myCorner, JLayeredPane.POPUP_LAYER); add(layeredPane, BorderLayout.CENTER); @@ -1793,6 +1802,7 @@ public class DocumentationComponent extends JPanel implements Disposable, DataPr @Override public void update(@NotNull AnActionEvent e) { + e.getPresentation().setIcon(ToolWindowManagerEx.getInstanceEx(myManager.myProject).getLocationIcon(ToolWindowId.DOCUMENTATION, EmptyIcon.ICON_16)); e.getPresentation().setEnabledAndVisible(myToolwindowCallback != null); }