]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
Sort editor adapters by default 54/354/2
authorAntti Villberg <antti.villberg@semantum.fi>
Fri, 10 Mar 2017 08:56:00 +0000 (10:56 +0200)
committerAntti Villberg <antti.villberg@semantum.fi>
Fri, 10 Mar 2017 10:40:40 +0000 (12:40 +0200)
refs #7076

Change-Id: I320fea43416d53bc48ce8044f517815dad4c6952

bundles/org.simantics.ui/src/org/simantics/ui/workbench/editor/EditorRegistry.java

index b952966e493509ad5e11e6b8897b29273c52deaa..9fdfbb4ddd2463dc0763a365e65a3ecd6079a638 100644 (file)
@@ -17,6 +17,7 @@ import java.net.URL;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
+import java.util.Comparator;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
@@ -105,7 +106,8 @@ public final class EditorRegistry implements IExtensionChangeHandler, IEditorReg
 
     private static final String ATTR_ID              = "id";
 
-
+    private static final Comparator<EditorAdapter> ADAPTER_COMPARATOR = (o1, o2) -> -(o1.getPriority() - o2.getPriority());
+    
     private static class Group {
         public final String id;
         public final List<EditorAdapterDescriptor> adapters;
@@ -558,6 +560,9 @@ public final class EditorRegistry implements IExtensionChangeHandler, IEditorReg
         }
         
         result = gatherAdapterResult(l);
+        
+        Arrays.sort(result, ADAPTER_COMPARATOR);
+        
         updateCache(r, result);
 
         if (status != null && !status.isOK())