From: Antti Villberg Date: Tue, 18 Apr 2017 13:14:34 +0000 (+0300) Subject: Contributed profile entries X-Git-Tag: v1.29.0~105 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=e3e8b94b13a1b7491644c58dc0e726181c20fb3c;p=simantics%2Fplatform.git Contributed profile entries refs #7148 Change-Id: I9fe9a7f6a3d6eb2d2bf3122d7960e220895cba63 --- diff --git a/bundles/org.simantics.diagram.ontology/graph.tg b/bundles/org.simantics.diagram.ontology/graph.tg index 45f65af26..af8d84f41 100644 Binary files a/bundles/org.simantics.diagram.ontology/graph.tg and b/bundles/org.simantics.diagram.ontology/graph.tg differ diff --git a/bundles/org.simantics.diagram.ontology/graph/Diagram.pgraph b/bundles/org.simantics.diagram.ontology/graph/Diagram.pgraph index 687e9ddbc..9e006381d 100644 --- a/bundles/org.simantics.diagram.ontology/graph/Diagram.pgraph +++ b/bundles/org.simantics.diagram.ontology/graph/Diagram.pgraph @@ -125,3 +125,7 @@ DIA.diagramActivityCondition : L0.Template DIA.DiagramActivityCondition.test _ : STR.SCLValue L0.SCLValue.expression %expression L0.HasValueType "Resource -> String" + +DIA.ProfileEntryContribution DIA.ProfileEntryContribution.HasEntry --> DIA.ProfileEntry >{ + + protected ProfileEntryContributions(Resource runtimeDiagram) { + super(runtimeDiagram); + } + + @Override + public Collection perform(ReadGraph graph) throws DatabaseException { + + DiagramResource DIA = DiagramResource.getInstance(graph); + + String indexURI = graph.getPossibleRelatedValue(resource, DIA.RuntimeDiagram_HasModelURI); + if (indexURI == null) + return Collections.emptyList(); + + Resource index = graph.getPossibleResource(indexURI); + if (index == null) + return Collections.emptyList(); + + Instances query = graph.adapt(DIA.ProfileEntryContribution, Instances.class); + + ArrayList result = new ArrayList<>(); + for(Resource contribution : query.find(graph, index)) { + result.add(graph.getSingleObject(contribution, DIA.ProfileEntryContribution_HasEntry)); + } + + return result; + + } + +} \ No newline at end of file diff --git a/bundles/org.simantics.scenegraph.profile/src/org/simantics/scenegraph/profile/request/RuntimeProfileActiveEntryResources.java b/bundles/org.simantics.scenegraph.profile/src/org/simantics/scenegraph/profile/request/RuntimeProfileActiveEntryResources.java index 5686024b0..5c438533d 100644 --- a/bundles/org.simantics.scenegraph.profile/src/org/simantics/scenegraph/profile/request/RuntimeProfileActiveEntryResources.java +++ b/bundles/org.simantics.scenegraph.profile/src/org/simantics/scenegraph/profile/request/RuntimeProfileActiveEntryResources.java @@ -36,6 +36,9 @@ public class RuntimeProfileActiveEntryResources extends ResourceRead result = new ArrayList(); + + result.addAll(graph.syncRequest(new ProfileEntryContributions(resource))); + Resource activeProfile = graph.getPossibleObject(resource, DIA.RuntimeDiagram_HasRuntimeProfile); if (activeProfile == null) { @@ -45,12 +48,14 @@ public class RuntimeProfileActiveEntryResources extends ResourceRead