diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesBrowserBase.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesBrowserBase.java index 420bfcc41c96..51a8a825d7c2 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesBrowserBase.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesBrowserBase.java @@ -66,7 +66,7 @@ public abstract class ChangesBrowserBase extends JPanel implements DataProvider myViewer = createTreeList(project, showCheckboxes, highlightProblems); myToolbar = ActionManager.getInstance().createActionToolbar("ChangesBrowser", myToolBarGroup, true); - myToolbar.setTargetComponent(this); + myToolbar.setTargetComponent(myViewer); myToolbarAnchor = getToolbarAnchor(); myToolbar.setOrientation(isVerticalToolbar() ? SwingConstants.VERTICAL : SwingConstants.HORIZONTAL); @@ -116,13 +116,8 @@ public abstract class ChangesBrowserBase extends JPanel implements DataProvider } if (isVerticalToolbar()) { - List treeActions = TreeActionsToolbarPanel.createTreeActions(myViewer); - boolean hasTreeActions = ContainerUtil.exists( - treeActions, action -> NewActionGroup.anyActionFromGroupMatches(myToolBarGroup, true, Predicate.isEqual(action))); - if (!hasTreeActions) { - myToolBarGroup.addSeparator(); - myToolBarGroup.addAll(treeActions); - } + myToolBarGroup.addSeparator(); + myToolBarGroup.addAll(TreeActionsToolbarPanel.createTreeActions()); } myShowDiffAction.registerCustomShortcutSet(this, null); diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesTree.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesTree.java index 4dc98601e8b9..ae599927e05f 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesTree.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesTree.java @@ -644,7 +644,11 @@ public abstract class ChangesTree extends Tree implements DataProvider { myTreeExpander = expander; } + /** + * @deprecated Prefer using {@link IdeActions#ACTION_EXPAND_ALL} + */ @NotNull + @Deprecated public AnAction createExpandAllAction(boolean headerAction) { if (headerAction) { return CommonActionsManager.getInstance().createExpandAllHeaderAction(myTreeExpander, this); @@ -654,7 +658,11 @@ public abstract class ChangesTree extends Tree implements DataProvider { } } + /** + * @deprecated Prefer using {@link IdeActions#ACTION_COLLAPSE_ALL} + */ @NotNull + @Deprecated public AnAction createCollapseAllAction(boolean headerAction) { if (headerAction) { return CommonActionsManager.getInstance().createCollapseAllHeaderAction(myTreeExpander, this); diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/TreeActionsToolbarPanel.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/TreeActionsToolbarPanel.java index 50895f035afa..6cbd9302e7bf 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/TreeActionsToolbarPanel.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/TreeActionsToolbarPanel.java @@ -23,7 +23,7 @@ public class TreeActionsToolbarPanel extends JPanel { } public TreeActionsToolbarPanel(@NotNull Component toolbarComponent, @NotNull ChangesTree tree) { - this(toolbarComponent, new DefaultActionGroup(createTreeActions(tree)), tree); + this(toolbarComponent, new DefaultActionGroup(createTreeActions()), tree); } public TreeActionsToolbarPanel(@NotNull Component toolbarComponent, @NotNull ActionGroup group, @Nullable JComponent targetComponent) { @@ -37,6 +37,12 @@ public class TreeActionsToolbarPanel extends JPanel { add(additionalToolbar.getComponent(), BorderLayout.EAST); } + @NotNull + public static List createTreeActions() { + return Arrays.asList(ActionManager.getInstance().getAction(IdeActions.ACTION_EXPAND_ALL), + ActionManager.getInstance().getAction(IdeActions.ACTION_COLLAPSE_ALL)); + } + @NotNull public static List createTreeActions(@NotNull ChangesTree tree) { return Arrays.asList(tree.createExpandAllAction(true), diff --git a/plugins/git4idea/src/git4idea/index/ui/GitStagePanel.kt b/plugins/git4idea/src/git4idea/index/ui/GitStagePanel.kt index fda9f8155fff..a97caa2e9f51 100644 --- a/plugins/git4idea/src/git4idea/index/ui/GitStagePanel.kt +++ b/plugins/git4idea/src/git4idea/index/ui/GitStagePanel.kt @@ -113,7 +113,7 @@ internal class GitStagePanel(private val tracker: GitStageTracker, val toolbarGroup = DefaultActionGroup() toolbarGroup.add(ActionManager.getInstance().getAction("Git.Stage.Toolbar")) - toolbarGroup.addAll(TreeActionsToolbarPanel.createTreeActions(tree)) + toolbarGroup.addAll(TreeActionsToolbarPanel.createTreeActions()) toolbar = ActionManager.getInstance().createActionToolbar(GIT_STAGE_PANEL_PLACE, toolbarGroup, true) toolbar.targetComponent = tree