From 33a9757ad019f57a48ee77df1125987dcb1100cd Mon Sep 17 00:00:00 2001 From: Konstantin Kolosovsky Date: Tue, 13 Feb 2018 12:01:15 +0800 Subject: [PATCH] Extract common constant for "Group By" changes grouping action group --- .../com/intellij/openapi/vcs/changes/ChangesViewManager.java | 3 ++- .../intellij/openapi/vcs/changes/SpecificFilesViewDialog.java | 3 ++- .../src/com/intellij/openapi/vcs/changes/ui/ChangesTree.java | 4 +++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangesViewManager.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangesViewManager.java index 97e803f129e4..c44e0d23deb3 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangesViewManager.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangesViewManager.java @@ -62,6 +62,7 @@ import java.util.stream.Stream; import static com.intellij.openapi.vcs.changes.shelf.ShelveChangesManager.unshelveSilentlyWithDnd; import static com.intellij.openapi.vcs.changes.ui.ChangesTree.DEFAULT_GROUPING_KEYS; +import static com.intellij.openapi.vcs.changes.ui.ChangesTree.GROUP_BY_ACTION_GROUP; import static com.intellij.util.containers.ContainerUtil.newHashSet; import static com.intellij.util.containers.ContainerUtil.set; import static java.util.stream.Collectors.toList; @@ -181,7 +182,7 @@ public class ChangesViewManager implements ChangesViewI, ProjectComponent, Persi visualActionsGroup.add(CommonActionsManager.getInstance().createExpandAllAction(expander, panel)); visualActionsGroup.add(CommonActionsManager.getInstance().createCollapseAllAction(expander, panel)); - visualActionsGroup.add(ActionManager.getInstance().getAction("ChangesView.GroupBy")); + visualActionsGroup.add(ActionManager.getInstance().getAction(GROUP_BY_ACTION_GROUP)); visualActionsGroup.add(ActionManager.getInstance().getAction(IdeActions.ACTION_COPY)); visualActionsGroup.add(new ToggleShowIgnoredAction()); visualActionsGroup.add(new IgnoredSettingsAction()); diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/SpecificFilesViewDialog.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/SpecificFilesViewDialog.java index a21e3cc027ea..f739c96140cf 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/SpecificFilesViewDialog.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/SpecificFilesViewDialog.java @@ -28,6 +28,7 @@ import java.util.List; import java.util.stream.Stream; import static com.intellij.openapi.vcs.changes.ui.ChangesTree.DEFAULT_GROUPING_KEYS; +import static com.intellij.openapi.vcs.changes.ui.ChangesTree.GROUP_BY_ACTION_GROUP; import static com.intellij.util.containers.ContainerUtil.set; abstract class SpecificFilesViewDialog extends DialogWrapper { @@ -105,7 +106,7 @@ abstract class SpecificFilesViewDialog extends DialogWrapper { final CommonActionsManager cam = CommonActionsManager.getInstance(); final Expander expander = new Expander(); group.addSeparator(); - group.add(ActionManager.getInstance().getAction("ChangesView.GroupBy")); + group.add(ActionManager.getInstance().getAction(GROUP_BY_ACTION_GROUP)); group.add(cam.createExpandAllAction(expander, myView)); group.add(cam.createCollapseAllAction(expander, myView)); 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 60ec79c673ff..5563e9ed9f27 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 @@ -72,6 +72,8 @@ public abstract class ChangesTree extends Tree implements DataProvider { public static final String[] DEFAULT_GROUPING_KEYS = ar(DIRECTORY_GROUPING, MODULE_GROUPING); + @NonNls public static final String GROUP_BY_ACTION_GROUP = "ChangesView.GroupBy"; + @Nullable private Runnable myInclusionListener; @NotNull private final CopyProvider myTreeCopyProvider; private TreeState myDirectoryTreeState; @@ -470,7 +472,7 @@ public abstract class ChangesTree extends Tree implements DataProvider { e.getPresentation().setEnabledAndVisible(!myGroupingSupport.isNone() || !myIsModelFlat); } }; - AnAction[] actions = new AnAction[]{ActionManager.getInstance().getAction("ChangesView.GroupBy"), expandAllAction, collapseAllAction}; + AnAction[] actions = new AnAction[]{ActionManager.getInstance().getAction(GROUP_BY_ACTION_GROUP), expandAllAction, collapseAllAction}; expandAllAction.registerCustomShortcutSet(getActiveKeymapShortcuts(IdeActions.ACTION_EXPAND_ALL), this); collapseAllAction.registerCustomShortcutSet(getActiveKeymapShortcuts(IdeActions.ACTION_COLLAPSE_ALL), this); return actions;