]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
(refs #7452) Added PreferredDiagramEditorID to Modeling.graph 92/892/1
authorHannu Niemistö <hannu.niemisto@semantum.fi>
Sun, 27 Aug 2017 09:03:37 +0000 (12:03 +0300)
committerHannu Niemistö <hannu.niemisto@semantum.fi>
Sun, 27 Aug 2017 09:03:37 +0000 (12:03 +0300)
Change-Id: I8e3ea28f814ecc7b28182bc47f5f4fde18fb7b3e

bundles/org.simantics.modeling.ontology/graph/Modeling.pgraph
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/OpenDiagramFromIssue.java

index fe566684dc1a183c7f00c7aa021ec26961f17c9a..f337ab602de2fa93677000393c2903eaa3e66260 100644 (file)
@@ -517,4 +517,8 @@ MOD.SVGTabContribution : SEL.SCLTabContribution
 
 MOD.SymbolCodeStyle : DIA.Style
 
-MOD.IssueDecorationStyle : DIA.Style
\ No newline at end of file
+MOD.IssueDecorationStyle : DIA.Style
+
+MOD.PreferredDiagramEditorID <R L0.HasProperty : L0.FunctionalRelation
+    L0.HasDomain STR.Composite
+    L0.HasRange  L0.String
\ No newline at end of file
index 7fd13bbdddcbb023573651eee62b30bb9eddaa14..9214082f24079d2ced9ffcbe8bf355172d47e9e0 100644 (file)
@@ -51,8 +51,13 @@ public class OpenDiagramFromIssue extends AbstractResourceEditorAdapter {
         super("Open Diagram Containing Referenced Component", Activator.COMPOSITE_ICON);
     }
 
-    protected String getEditorId() {
-        return EDITOR_ID;
+    protected String getEditorId(ReadGraph g, Resource diagram) throws DatabaseException {
+        ModelingResources MOD = ModelingResources.getInstance(g);
+        String preferredEditorId = g.getPossibleRelatedValue(diagram, MOD.PreferredDiagramEditorID);
+        if(preferredEditorId != null)
+            return preferredEditorId;
+        else
+            return EDITOR_ID;
     }
 
     @Override
@@ -67,7 +72,7 @@ public class OpenDiagramFromIssue extends AbstractResourceEditorAdapter {
             public void run(ReadGraph g) throws DatabaseException {
                 Pair<Resource, Collection<Object>> data = extractContext(g, input);
                 if (data != null)
-                    OpenDiagramFromConfigurationAdapter.openEditor(g, data.first, getEditorId(), data.second);
+                    OpenDiagramFromConfigurationAdapter.openEditor(g, data.first, getEditorId(g, data.first), data.second);
             }
         });
     }