From: Antti Villberg Date: Fri, 10 Mar 2017 08:56:00 +0000 (+0200) Subject: Sort editor adapters by default X-Git-Tag: v1.28.0~65 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=15d8500282b7bc9f54e561c88564a10a7def44fb;p=simantics%2Fplatform.git Sort editor adapters by default refs #7076 Change-Id: I320fea43416d53bc48ce8044f517815dad4c6952 --- 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())