1 package org.simantics.modeling;
3 import org.simantics.databoard.adapter.AdaptException;
4 import org.simantics.databoard.binding.Binding;
5 import org.simantics.db.ReadGraph;
6 import org.simantics.db.Resource;
7 import org.simantics.db.exception.DatabaseException;
8 import org.simantics.db.layer0.variable.Variable;
10 public class VariableStructuralContext extends org.simantics.structural2.scl.VariableStructuralContext {
12 final private Variable selfVariable;
14 public VariableStructuralContext(ReadGraph graph, Variable selfVariable) throws DatabaseException {
15 super(graph, selfVariable);
16 this.selfVariable = selfVariable;
19 public VariableStructuralContext(Variable selfVariable, Variable variable) throws DatabaseException {
21 this.selfVariable = selfVariable;
25 public Object getValue(ReadGraph g, Resource attribute, Binding binding) throws DatabaseException, AdaptException {
26 ModelingResources MOD = ModelingResources.getInstance(g);
27 if(MOD.self.equals(attribute)) return selfVariable;
28 return super.getValue(g, attribute, binding);