From 15d8500282b7bc9f54e561c88564a10a7def44fb Mon Sep 17 00:00:00 2001 From: Antti Villberg Date: Fri, 10 Mar 2017 10:56:00 +0200 Subject: [PATCH] Sort editor adapters by default refs #7076 Change-Id: I320fea43416d53bc48ce8044f517815dad4c6952 --- .../org/simantics/ui/workbench/editor/EditorRegistry.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bundles/org.simantics.ui/src/org/simantics/ui/workbench/editor/EditorRegistry.java b/bundles/org.simantics.ui/src/org/simantics/ui/workbench/editor/EditorRegistry.java index b952966e4..9fdfbb4dd 100644 --- a/bundles/org.simantics.ui/src/org/simantics/ui/workbench/editor/EditorRegistry.java +++ b/bundles/org.simantics.ui/src/org/simantics/ui/workbench/editor/EditorRegistry.java @@ -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 ADAPTER_COMPARATOR = (o1, o2) -> -(o1.getPriority() - o2.getPriority()); + private static class Group { public final String id; public final List 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()) -- 2.47.1