]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
Initial version of SCL tab contributions 59/159/4
authorAntti Villberg <antti.villberg@semantum.fi>
Tue, 22 Nov 2016 11:47:55 +0000 (13:47 +0200)
committerTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Tue, 22 Nov 2016 12:05:10 +0000 (15:05 +0300)
refs #6824

Change-Id: I677f82bc7a0cd5ec03937384d9a130c00ddefa9b

bundles/org.simantics.selectionview.ontology/graph.tg
bundles/org.simantics.selectionview.ontology/graph/Selectionview.pgraph
bundles/org.simantics.selectionview.ontology/src/org/simantics/selectionview/SelectionViewResources.java
bundles/org.simantics.selectionview/scl/Simantics/SelectionView.scl
bundles/org.simantics.selectionview/src/org/simantics/selectionview/SCLTabContribution.java [new file with mode: 0644]

index 49a3f113fe75e9b05e284fbbc135154403e939a8..724deb153af635e054d7f73ad28e8991e96f162b 100644 (file)
Binary files a/bundles/org.simantics.selectionview.ontology/graph.tg and b/bundles/org.simantics.selectionview.ontology/graph.tg differ
index 8905c6252b17685e34b4857ebe21bc46662d7189..58eba84710132a5ab488f22f38be866ada848eef 100644 (file)
@@ -32,6 +32,9 @@ SEL.AbstractTypedVariableTabContribution <T SEL.AbstractVariableTabContribution
 SEL.AbstractTypedResourceTabContribution <T SEL.AbstractResourceTabContribution
   >-- SEL.AbstractTypedResourceTabContribution.HasType --> L0.Type <R L0.DependsOn
 
+SEL.SCLTabContribution <T SEL.TabContribution
+  >-- SEL.SCLTabContribution.instantiate ==> "() -> <Proc> TabContribution" <R L0.HasProperty
+
 SEL.VariableTabContribution <T SEL.TabContribution
   >-- SEL.VariableTabContribution.HasTest <R L0.DependsOn
   >-- SEL.VariableTabContribution.transformation ==> "Variable -> <ReadGraph> Variable" <R L0.HasProperty
index c497214d7c80bbe7285a6fd57af736e9d1915bd8..0e6e2becab390a9ad99ce331d4acc9b96f384ce4 100644 (file)
@@ -69,6 +69,9 @@ public class SelectionViewResources {
     public final Resource HasStandardPropertyInfo;\r
     public final Resource HasStandardPropertyInfo_Inverse;\r
     public final Resource IsShownUnder;\r
+    public final Resource SCLTabContribution;\r
+    public final Resource SCLTabContribution_instantiate;\r
+    public final Resource SCLTabContribution_instantiate_Inverse;\r
     public final Resource SelectionTransformation;\r
     public final Resource SortingName;\r
     public final Resource SortingName_Inverse;\r
@@ -160,6 +163,9 @@ public class SelectionViewResources {
         public static final String HasStandardPropertyInfo = "http://www.simantics.org/SelectionView-1.2/HasStandardPropertyInfo";\r
         public static final String HasStandardPropertyInfo_Inverse = "http://www.simantics.org/SelectionView-1.2/HasStandardPropertyInfo/Inverse";\r
         public static final String IsShownUnder = "http://www.simantics.org/SelectionView-1.2/IsShownUnder";\r
+        public static final String SCLTabContribution = "http://www.simantics.org/SelectionView-1.2/SCLTabContribution";\r
+        public static final String SCLTabContribution_instantiate = "http://www.simantics.org/SelectionView-1.2/SCLTabContribution/instantiate";\r
+        public static final String SCLTabContribution_instantiate_Inverse = "http://www.simantics.org/SelectionView-1.2/SCLTabContribution/instantiate/Inverse";\r
         public static final String SelectionTransformation = "http://www.simantics.org/SelectionView-1.2/SelectionTransformation";\r
         public static final String SortingName = "http://www.simantics.org/SelectionView-1.2/SortingName";\r
         public static final String SortingName_Inverse = "http://www.simantics.org/SelectionView-1.2/SortingName/Inverse";\r
@@ -261,6 +267,9 @@ public class SelectionViewResources {
         HasStandardPropertyInfo = getResourceOrNull(graph, URIs.HasStandardPropertyInfo);\r
         HasStandardPropertyInfo_Inverse = getResourceOrNull(graph, URIs.HasStandardPropertyInfo_Inverse);\r
         IsShownUnder = getResourceOrNull(graph, URIs.IsShownUnder);\r
+        SCLTabContribution = getResourceOrNull(graph, URIs.SCLTabContribution);\r
+        SCLTabContribution_instantiate = getResourceOrNull(graph, URIs.SCLTabContribution_instantiate);\r
+        SCLTabContribution_instantiate_Inverse = getResourceOrNull(graph, URIs.SCLTabContribution_instantiate_Inverse);\r
         SelectionTransformation = getResourceOrNull(graph, URIs.SelectionTransformation);\r
         SortingName = getResourceOrNull(graph, URIs.SortingName);\r
         SortingName_Inverse = getResourceOrNull(graph, URIs.SortingName_Inverse);\r
index 9d9cfd6b3af56c2edce38346a3acdf97f0246ec6..7aa9dd831fb9089e3e6cace15f72b1ddac212a68 100644 (file)
@@ -7,3 +7,7 @@ importJava "org.simantics.selectionview.DisplayValueVariableAdapter" where
     standardSetDisplayValue2 :: Variable -> a -> <WriteGraph> ()\r
     standardSetDisplayValue3 :: Variable -> a -> Binding a -> <WriteGraph> ()\r
     standardGetDisplayValueDatatype :: Variable -> <ReadGraph> Datatype\r
+\r
+importJava "org.simantics.selectionview.TabContribution" where\r
+    data TabContribution\r
+    
\ No newline at end of file
diff --git a/bundles/org.simantics.selectionview/src/org/simantics/selectionview/SCLTabContribution.java b/bundles/org.simantics.selectionview/src/org/simantics/selectionview/SCLTabContribution.java
new file mode 100644 (file)
index 0000000..61921dd
--- /dev/null
@@ -0,0 +1,34 @@
+package org.simantics.selectionview;\r
+\r
+import java.util.Collection;\r
+\r
+import org.simantics.db.ReadGraph;\r
+import org.simantics.db.Resource;\r
+import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.db.layer0.variable.Variable;\r
+import org.simantics.db.layer0.variable.Variables;\r
+import org.simantics.scl.runtime.function.Function1;\r
+import org.simantics.scl.runtime.tuple.Tuple0;\r
+\r
+public class SCLTabContribution implements TabContribution<Object> {\r
+\r
+       final private TabContribution<Object> contribution;\r
+       \r
+       public SCLTabContribution(ReadGraph graph, Resource configuration) throws DatabaseException {\r
+               Variable var = Variables.getVariable(graph, configuration);\r
+               Function1<Object, TabContribution<Object>> function = var.getPropertyValue(graph, "instantiate");\r
+               contribution = function.apply(Tuple0.INSTANCE);\r
+       }\r
+\r
+       @Override\r
+       public boolean accept(ReadGraph graph, Object input) throws DatabaseException {\r
+               return contribution.accept(graph, input);\r
+       }\r
+\r
+       @Override\r
+       public void contribute(ReadGraph graph, Object selection, Collection<ComparableTabContributor> result)\r
+                       throws DatabaseException {\r
+               contribution.contribute(graph, selection, result);\r
+       }\r
+\r
+}\r