From 49e648c8157ff516200a0db9ba8595eccf5dcedd Mon Sep 17 00:00:00 2001 From: Konstantin Aleev Date: Tue, 29 May 2018 19:32:10 +0300 Subject: [PATCH] RunDashboard: use extension order for grouping rules --- .../dashboard/RunDashboardGroupingRule.java | 21 +------------------ .../dashboard/RunDashboardManagerImpl.java | 1 - ...onfigurationTypeDashboardGroupingRule.java | 5 ----- .../tree/FolderDashboardGroupingRule.java | 5 ----- ...RunConfigurationDashboardGroupingRule.java | 5 ----- .../tree/StatusDashboardGroupingRule.java | 5 ----- .../src/META-INF/LangExtensions.xml | 12 +++++++---- 7 files changed, 9 insertions(+), 45 deletions(-) diff --git a/platform/lang-api/src/com/intellij/execution/dashboard/RunDashboardGroupingRule.java b/platform/lang-api/src/com/intellij/execution/dashboard/RunDashboardGroupingRule.java index 163d5ca983b3..a40c3367575f 100644 --- a/platform/lang-api/src/com/intellij/execution/dashboard/RunDashboardGroupingRule.java +++ b/platform/lang-api/src/com/intellij/execution/dashboard/RunDashboardGroupingRule.java @@ -24,27 +24,15 @@ import java.util.Comparator; /** * Action for grouping items in a run dashboard tree. + * Grouping rules are applied to dashboard nodes according to their order defined in plug-in configuration. * * @author konstantin.aleev */ public interface RunDashboardGroupingRule extends TreeAction { ExtensionPointName EP_NAME = ExtensionPointName.create("com.intellij.runDashboardGroupingRule"); - Comparator PRIORITY_COMPARATOR = (o1, o2) -> { - final int res = o2.getPriority() - o1.getPriority(); - return res != 0 ? res : (o1.getName().compareTo(o2.getName())); - }; - Comparator GROUP_NAME_COMPARATOR = Comparator.comparing(RunDashboardGroup::getName); - /** - * Grouping rules are ordered and applied to dashboard nodes according to their priority. - * The higher the priority, the higher groups produced by this rule are presented in the dashboard tree. - * - * @return rule's priority. - */ - int getPriority(); - /** * @return {@code true} if grouping rule should always be applied to dashboard nodes. */ @@ -65,11 +53,4 @@ public interface RunDashboardGroupingRule extends TreeAction { default Comparator getGroupComparator() { return GROUP_NAME_COMPARATOR; } - - interface Priorities { - int BY_RUN_CONFIG = 200; - int BY_FOLDER = 400; - int BY_STATUS = 800; - int BY_TYPE = 1000; - } } diff --git a/platform/lang-impl/src/com/intellij/execution/dashboard/RunDashboardManagerImpl.java b/platform/lang-impl/src/com/intellij/execution/dashboard/RunDashboardManagerImpl.java index 7421ccc45f38..8ee5aa1e0e36 100644 --- a/platform/lang-impl/src/com/intellij/execution/dashboard/RunDashboardManagerImpl.java +++ b/platform/lang-impl/src/com/intellij/execution/dashboard/RunDashboardManagerImpl.java @@ -81,7 +81,6 @@ public class RunDashboardManagerImpl implements RunDashboardManager, PersistentS myReuseCondition = this::canReuseContent; myGroupers = Arrays.stream(RunDashboardGroupingRule.EP_NAME.getExtensions()) - .sorted(RunDashboardGroupingRule.PRIORITY_COMPARATOR) .map(RunDashboardGrouper::new) .collect(Collectors.toList()); } diff --git a/platform/lang-impl/src/com/intellij/execution/dashboard/tree/ConfigurationTypeDashboardGroupingRule.java b/platform/lang-impl/src/com/intellij/execution/dashboard/tree/ConfigurationTypeDashboardGroupingRule.java index bdd300485f46..61eb550781c5 100644 --- a/platform/lang-impl/src/com/intellij/execution/dashboard/tree/ConfigurationTypeDashboardGroupingRule.java +++ b/platform/lang-impl/src/com/intellij/execution/dashboard/tree/ConfigurationTypeDashboardGroupingRule.java @@ -49,11 +49,6 @@ public class ConfigurationTypeDashboardGroupingRule implements RunDashboardGroup AllIcons.Actions.GroupByFile); } - @Override - public int getPriority() { - return Priorities.BY_TYPE; - } - @Override public boolean isAlwaysEnabled() { return false; diff --git a/platform/lang-impl/src/com/intellij/execution/dashboard/tree/FolderDashboardGroupingRule.java b/platform/lang-impl/src/com/intellij/execution/dashboard/tree/FolderDashboardGroupingRule.java index 5eed4268fe30..514b3cb0d6b3 100644 --- a/platform/lang-impl/src/com/intellij/execution/dashboard/tree/FolderDashboardGroupingRule.java +++ b/platform/lang-impl/src/com/intellij/execution/dashboard/tree/FolderDashboardGroupingRule.java @@ -50,11 +50,6 @@ public class FolderDashboardGroupingRule implements RunDashboardGroupingRule { AllIcons.Actions.GroupByPackage); } - @Override - public int getPriority() { - return Priorities.BY_FOLDER; - } - @Override public boolean isAlwaysEnabled() { return true; diff --git a/platform/lang-impl/src/com/intellij/execution/dashboard/tree/RunConfigurationDashboardGroupingRule.java b/platform/lang-impl/src/com/intellij/execution/dashboard/tree/RunConfigurationDashboardGroupingRule.java index 10d2f5bcecdf..70f4de571925 100644 --- a/platform/lang-impl/src/com/intellij/execution/dashboard/tree/RunConfigurationDashboardGroupingRule.java +++ b/platform/lang-impl/src/com/intellij/execution/dashboard/tree/RunConfigurationDashboardGroupingRule.java @@ -41,11 +41,6 @@ public class RunConfigurationDashboardGroupingRule implements RunDashboardGroupi return "RunConfigurationDashboardGroupingRule"; } - @Override - public int getPriority() { - return Priorities.BY_RUN_CONFIG; - } - @Override public boolean isAlwaysEnabled() { return true; diff --git a/platform/lang-impl/src/com/intellij/execution/dashboard/tree/StatusDashboardGroupingRule.java b/platform/lang-impl/src/com/intellij/execution/dashboard/tree/StatusDashboardGroupingRule.java index 721821d47434..fa77bbce596a 100644 --- a/platform/lang-impl/src/com/intellij/execution/dashboard/tree/StatusDashboardGroupingRule.java +++ b/platform/lang-impl/src/com/intellij/execution/dashboard/tree/StatusDashboardGroupingRule.java @@ -47,11 +47,6 @@ public class StatusDashboardGroupingRule implements RunDashboardGroupingRule { AllIcons.Actions.GroupByPrefix); // TODO [konstantin.aleev] provide new icon } - @Override - public int getPriority() { - return Priorities.BY_STATUS; - } - @Override public boolean isAlwaysEnabled() { return false; diff --git a/platform/platform-resources/src/META-INF/LangExtensions.xml b/platform/platform-resources/src/META-INF/LangExtensions.xml index cfbc1704a368..96046aec0f9b 100644 --- a/platform/platform-resources/src/META-INF/LangExtensions.xml +++ b/platform/platform-resources/src/META-INF/LangExtensions.xml @@ -1025,10 +1025,14 @@ - - - - + + + +