From: Antti Villberg Date: Tue, 22 Nov 2016 11:47:55 +0000 (+0200) Subject: Initial version of SCL tab contributions X-Git-Tag: v1.25.0~38 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F59%2F159%2F4;p=simantics%2Fplatform.git Initial version of SCL tab contributions refs #6824 Change-Id: I677f82bc7a0cd5ec03937384d9a130c00ddefa9b --- diff --git a/bundles/org.simantics.selectionview.ontology/graph.tg b/bundles/org.simantics.selectionview.ontology/graph.tg index 49a3f113f..724deb153 100644 Binary files a/bundles/org.simantics.selectionview.ontology/graph.tg and b/bundles/org.simantics.selectionview.ontology/graph.tg differ diff --git a/bundles/org.simantics.selectionview.ontology/graph/Selectionview.pgraph b/bundles/org.simantics.selectionview.ontology/graph/Selectionview.pgraph index 8905c6252..58eba8471 100644 --- a/bundles/org.simantics.selectionview.ontology/graph/Selectionview.pgraph +++ b/bundles/org.simantics.selectionview.ontology/graph/Selectionview.pgraph @@ -32,6 +32,9 @@ SEL.AbstractTypedVariableTabContribution -- SEL.AbstractTypedResourceTabContribution.HasType --> L0.Type -- SEL.SCLTabContribution.instantiate ==> "() -> TabContribution" -- SEL.VariableTabContribution.HasTest -- SEL.VariableTabContribution.transformation ==> "Variable -> Variable" a -> () standardSetDisplayValue3 :: Variable -> a -> Binding a -> () standardGetDisplayValueDatatype :: Variable -> Datatype + +importJava "org.simantics.selectionview.TabContribution" where + data TabContribution + \ 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 index 000000000..61921dd27 --- /dev/null +++ b/bundles/org.simantics.selectionview/src/org/simantics/selectionview/SCLTabContribution.java @@ -0,0 +1,34 @@ +package org.simantics.selectionview; + +import java.util.Collection; + +import org.simantics.db.ReadGraph; +import org.simantics.db.Resource; +import org.simantics.db.exception.DatabaseException; +import org.simantics.db.layer0.variable.Variable; +import org.simantics.db.layer0.variable.Variables; +import org.simantics.scl.runtime.function.Function1; +import org.simantics.scl.runtime.tuple.Tuple0; + +public class SCLTabContribution implements TabContribution { + + final private TabContribution contribution; + + public SCLTabContribution(ReadGraph graph, Resource configuration) throws DatabaseException { + Variable var = Variables.getVariable(graph, configuration); + Function1> function = var.getPropertyValue(graph, "instantiate"); + contribution = function.apply(Tuple0.INSTANCE); + } + + @Override + public boolean accept(ReadGraph graph, Object input) throws DatabaseException { + return contribution.accept(graph, input); + } + + @Override + public void contribute(ReadGraph graph, Object selection, Collection result) + throws DatabaseException { + contribution.contribute(graph, selection, result); + } + +}