From d4fc220e79a57e6fd4debe6f1ef1c1850863d16c Mon Sep 17 00:00:00 2001 From: lempinen Date: Wed, 20 Apr 2011 10:12:40 +0000 Subject: [PATCH] Changed ChildVariable to extend AbstractChildVariable instead of StandardGraphChildVariable. URIs were not functioning correctly because Standard-implementation relied on resources and their URIs. git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@20544 ac1ea38d-2e2b-0410-8846-a27921b304fc --- .../actions/ShowInstantiatedModuleAction.java | 9 +- .../SysdynComponentCopyAdvisor.java | 2 +- .../sysdyn/ui/elements2/InputFactory.java | 52 +++++---- .../sysdyn/ui/handlers/ShowModuleHandler.java | 10 +- .../arrays/ReplaceableEnumerations.java | 6 +- .../SysdynDatasetSelectionListener.java | 18 +-- .../sysdyn/adapter/ChildVariable.java | 105 +++++++++++++----- .../sysdyn/adapter/ChildVariableAdapter.java | 11 ++ .../sysdyn/adapter/ConfigurationVariable.java | 11 ++ .../sysdyn/adapter/HistoryVariable.java | 59 +--------- .../sysdyn/adapter/ModuleVariable.java | 18 ++- .../simantics/sysdyn/adapter/RunVariable.java | 13 ++- 12 files changed, 174 insertions(+), 140 deletions(-) diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/actions/ShowInstantiatedModuleAction.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/actions/ShowInstantiatedModuleAction.java index e66d38d7..83c993de 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/actions/ShowInstantiatedModuleAction.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/actions/ShowInstantiatedModuleAction.java @@ -24,7 +24,6 @@ import org.simantics.layer0.Layer0; import org.simantics.modeling.ModelingResources; import org.simantics.structural.stubs.StructuralResource2; import org.simantics.sysdyn.SysdynResource; -import org.simantics.sysdyn.adapter.ChildVariable; import org.simantics.sysdyn.ui.browser.BrowserSelection; import org.simantics.sysdyn.ui.browser.nodes.ModuleNode; import org.simantics.ui.DoubleClickEvent; @@ -56,8 +55,8 @@ public class ShowInstantiatedModuleAction implements IDoubleClickAction { StructuralResource2 sr2 = StructuralResource2.getInstance(g); if(g.isInheritedFrom(instanceOf, sr.Module)) { configuration = g.getSingleObject(instanceOf, sr2.IsDefinedBy); - ChildVariable variable = (ChildVariable) bs.getAdapter(Variable.class); - String rvi = variable.getRvi(g); + Variable variable = (Variable) bs.getAdapter(Variable.class); + String rvi = Variables.getRVI(g, variable).substring(1); Resource model = Variables.getModel(g, variable); addShowModuleAction(e, getResourceEditorInput(g, model, configuration, rvi)); } @@ -71,8 +70,8 @@ public class ShowInstantiatedModuleAction implements IDoubleClickAction { String rvi; if(moduleNode.getVariable() != null) { model = Variables.getModel(g, moduleNode.getVariable()); - ChildVariable var = (ChildVariable)moduleNode.getVariable(); - rvi = var.getRvi(g); + Variable var = moduleNode.getVariable(); + rvi = Variables.getRVI(g, var).substring(1); } else { rvi = (String)g.getRelatedValue(moduleNode.data, Layer0.getInstance(g).HasName); model = g.getSingleObject(moduleNode.data, l0.PartOf); diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/editor/participant/SysdynComponentCopyAdvisor.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/editor/participant/SysdynComponentCopyAdvisor.java index 22e08f62..170d02de 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/editor/participant/SysdynComponentCopyAdvisor.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/editor/participant/SysdynComponentCopyAdvisor.java @@ -27,7 +27,7 @@ public class SysdynComponentCopyAdvisor extends ComponentCopyAdvisor{ @Override public Object copy(ISynchronizationContext context, WriteGraph graph, Resource source, Resource sourceContainer, Resource targetContainer) throws DatabaseException { - + BinaryFunction tester = new BinaryFunction() { @Override diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements2/InputFactory.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements2/InputFactory.java index 2812961b..9cee6cb4 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements2/InputFactory.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements2/InputFactory.java @@ -22,7 +22,9 @@ import java.util.Collection; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; +import org.simantics.db.common.utils.NameUtils; import org.simantics.db.exception.DatabaseException; +import org.simantics.db.layer0.exception.MissingVariableException; import org.simantics.db.layer0.variable.Variable; import org.simantics.db.layer0.variable.Variables; import org.simantics.diagram.elements.TextNode; @@ -56,7 +58,6 @@ import org.simantics.scenegraph.g2d.G2DParentNode; import org.simantics.sysdyn.SysdynResource; import org.simantics.sysdyn.adapter.ChildVariable; import org.simantics.sysdyn.adapter.ConfigurationVariable; -import org.simantics.sysdyn.adapter.HistoryVariable; import org.simantics.sysdyn.adapter.RunVariable; import org.simantics.utils.datastructures.hints.IHintContext.Key; @@ -124,30 +125,39 @@ public class InputFactory extends SysdynElementFactory { } } else { Resource runtime = diagram.getHint((DiagramModelHints.KEY_DIAGRAM_RUNTIME_RESOURCE)); + for(Resource r : graph.getPredicates(runtime)) { + System.out.println(NameUtils.getSafeName(graph, r) + " " + graph.getPossibleRelatedValue(runtime, r)); + } DiagramResource dr = DiagramResource.getInstance(graph); String variable = (String)graph.getPossibleRelatedValue(runtime, dr.HasVariable); if(variable == null) return; - Variable v = Variables.getVariable(graph, variable); - module = graph.getResource(v.getURI(graph)); - if(module != null) - for(Resource dep : graph.getObjects(module, sr.IsHeadOf)) { - Resource reference = graph.getPossibleObject(dep, sr.RefersTo); - if(reference!= null && reference.equals(component)) { - refersTo = graph.getSingleObject(dep, sr.HasTail); - referenceName = (String) graph.getPossibleRelatedValue(refersTo, l0.HasName); - Variable parent = null; - if(v instanceof HistoryVariable) - parent = ((HistoryVariable)v).getParent(graph); - else if(v instanceof ChildVariable) - parent = ((ChildVariable)v).getParent(graph); - if(parent != null && !(parent instanceof RunVariable) && !(parent instanceof ConfigurationVariable)) { - String parentURI = parent.getURI(graph); - moduleName = (String) graph.getPossibleRelatedValue(graph.getResource(parentURI), l0.HasName); - } - break; - } - } + + + try { + Variable v = Variables.getVariable(graph, variable); + if(v instanceof ChildVariable) { + module = ((ChildVariable)v).getRepresents(graph); + } + if(module != null) + for(Resource dep : graph.getObjects(module, sr.IsHeadOf)) { + Resource reference = graph.getPossibleObject(dep, sr.RefersTo); + if(reference!= null && reference.equals(component)) { + refersTo = graph.getSingleObject(dep, sr.HasTail); + referenceName = (String) graph.getPossibleRelatedValue(refersTo, l0.HasName); + Variable parent = null; + if(v instanceof ChildVariable) + parent = ((ChildVariable)v).getParent(graph); + if(parent != null && !(parent instanceof RunVariable) && !(parent instanceof ConfigurationVariable)) { + String parentURI = parent.getURI(graph); + moduleName = (String) graph.getPossibleRelatedValue(graph.getResource(parentURI), l0.HasName); + } + break; + } + } + } catch (MissingVariableException mve) { + // DO nothing. + } } String inputReference = null; diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/ShowModuleHandler.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/ShowModuleHandler.java index 89e485e0..67732e3a 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/ShowModuleHandler.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/ShowModuleHandler.java @@ -30,8 +30,6 @@ import org.simantics.modeling.ComponentUtils; import org.simantics.modeling.ModelingResources; import org.simantics.structural.stubs.StructuralResource2; import org.simantics.sysdyn.SysdynResource; -import org.simantics.sysdyn.adapter.ChildVariable; -import org.simantics.sysdyn.adapter.HistoryVariable; import org.simantics.sysdyn.ui.editor.DiagramViewer; import org.simantics.ui.SimanticsUI; import org.simantics.ui.utils.ResourceAdaptionUtils; @@ -74,13 +72,7 @@ public class ShowModuleHandler extends AbstractHandler { final Resource diagram = ComponentUtils.getPossibleCompositeDiagram(graph, configuration); Variable variable = parent.browsePossible(graph, component); - String rvi = ""; - if(variable instanceof HistoryVariable) - rvi = "/" + ((HistoryVariable)variable).getRvi(graph); - else if (variable instanceof ChildVariable) - rvi = "/" + ((ChildVariable)variable).getRvi(graph); - - final String finalRvi = rvi; + final String finalRvi = Variables.getRVI(graph, variable); PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() { diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/arrays/ReplaceableEnumerations.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/arrays/ReplaceableEnumerations.java index 91afda93..2f715045 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/arrays/ReplaceableEnumerations.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/arrays/ReplaceableEnumerations.java @@ -28,6 +28,10 @@ public class ReplaceableEnumerations extends ViewpointContributorImpl @Override public Collection getContribution(ReadGraph graph, Resource input) throws DatabaseException { + ArrayList result = new ArrayList(); + if(input == null) + return result; + SysdynResource sr = SysdynResource.getInstance(graph); Layer0 l0 = Layer0.getInstance(graph); StructuralResource2 sr2 = StructuralResource2.getInstance(graph); @@ -35,8 +39,6 @@ public class ReplaceableEnumerations extends ViewpointContributorImpl Resource moduleType = graph.getSingleObject(input, l0.InstanceOf); Resource configuration = graph.getSingleObject(moduleType, sr2.IsDefinedBy); - ArrayList result = new ArrayList(); - for(Resource r : graph.syncRequest(new ObjectsWithType(configuration, l0.ConsistsOf, sr.Enumeration))) { if(Boolean.TRUE.equals(graph.getRelatedValue(r, sr.IsReplaceable))) result.add(new RedeclarationNode(graph, input, r)); diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/viewUtils/SysdynDatasetSelectionListener.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/viewUtils/SysdynDatasetSelectionListener.java index 57043d2e..a26c3121 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/viewUtils/SysdynDatasetSelectionListener.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/viewUtils/SysdynDatasetSelectionListener.java @@ -39,8 +39,6 @@ import org.simantics.layer0.Layer0; import org.simantics.modeling.ModelingUtils; import org.simantics.simulation.ontology.SimulationResource; import org.simantics.sysdyn.SysdynResource; -import org.simantics.sysdyn.adapter.ChildVariable; -import org.simantics.sysdyn.adapter.HistoryVariable; import org.simantics.sysdyn.manager.SysdynDataSet; import org.simantics.sysdyn.manager.SysdynModel; import org.simantics.sysdyn.manager.SysdynModelManager; @@ -104,6 +102,7 @@ public abstract class SysdynDatasetSelectionListener implements ISelectionListen HashSet models = new HashSet(); for(Variable variable : variables) { Resource model = Variables.getModel(graph, variable); + System.out.println("MODEL: " + model); if(model != null) { models.add(getSysdynModel(graph, model)); } @@ -149,18 +148,7 @@ public abstract class SysdynDatasetSelectionListener implements ISelectionListen ArrayList dataSets = new ArrayList(); HashMap rvis = new HashMap(); - String rvi; - if(variable instanceof ChildVariable) { - ChildVariable var = (ChildVariable)variable; - rvi = var.getRvi(g); - } else if(variable instanceof HistoryVariable) { - HistoryVariable var = (HistoryVariable)variable; - rvi = var.getRvi(g); - } else { - return dataSets; - } - - rvi = rvi.replace("/", "."); + String rvi = Variables.getRVI(g, variable).substring(1).replace("/", "."); Resource r = variable.getPropertyValue(g, Variables.REPRESENTS); @@ -266,8 +254,8 @@ public abstract class SysdynDatasetSelectionListener implements ISelectionListen Resource resource = ModelingUtils.getPossibleElementCorrespondendence(g, element); if(resource == null || !g.isInstanceOf(resource, sr.Variable)) return null; String variableURI = g.getPossibleRelatedValue(runtime, dr.HasVariable); - Variable compositeVariable = Variables.getVariable(g, variableURI); try { + Variable compositeVariable = Variables.getVariable(g, variableURI); return compositeVariable.browsePossible(g, resource); } catch (MissingVariableException e) { return null; diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/ChildVariable.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/ChildVariable.java index 033dfce2..ffd4a0a5 100644 --- a/org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/ChildVariable.java +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/ChildVariable.java @@ -1,3 +1,14 @@ +/******************************************************************************* + * Copyright (c) 2007, 2011 Association for Decentralized Information Management in + * Industry THTH ry. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * VTT Technical Research Centre of Finland - initial API and implementation + *******************************************************************************/ package org.simantics.sysdyn.adapter; import java.util.List; @@ -6,27 +17,25 @@ import org.simantics.databoard.Bindings; import org.simantics.databoard.Datatypes; import org.simantics.databoard.binding.Binding; import org.simantics.databoard.type.Datatype; +import org.simantics.databoard.util.ObjectUtils; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.WriteGraph; import org.simantics.db.common.utils.OrderedSetUtils; import org.simantics.db.exception.DatabaseException; -import org.simantics.db.layer0.variable.StandardGraphChildVariable; +import org.simantics.db.layer0.variable.AbstractChildVariable; import org.simantics.db.layer0.variable.Variable; +import org.simantics.layer0.Layer0; import org.simantics.sysdyn.SysdynResource; -public class ChildVariable extends StandardGraphChildVariable { +public class ChildVariable extends AbstractChildVariable { - final private Variable parent; + protected Variable parent; + protected Resource resource; public ChildVariable(Variable parent, Resource resource) { - super(resource); this.parent = parent; - } - - @Override - public Variable getParent(ReadGraph graph) throws DatabaseException { - return parent; + this.resource = resource; } // FIXME: Support properties! This is just for the system to work like it used to. @@ -71,23 +80,69 @@ public class ChildVariable extends StandardGraphChildVariable { return super.getInterface(graph, clazz); } - public String getVariableURI(ReadGraph graph) throws DatabaseException { - Variable parent = getParent(graph); - if(parent instanceof ChildVariable) { - ChildVariable p = (ChildVariable)parent; - return p.getVariableURI(graph) + "/" + this.getName(graph); - } else - return parent.getURI(graph) + "/" + this.getName(graph); - } + /* + * + * + */ - public String getRvi(ReadGraph graph) throws DatabaseException { - Variable parent = getParent(graph); - if(parent instanceof ChildVariable) { - ChildVariable p = (ChildVariable)parent; - return p.getRvi(graph) + "/" + this.getName(graph); - } else { - return this.getName(graph); - } + + @Override + public Variable getParent(ReadGraph graph) throws DatabaseException { + if(parent == null) + return null; // TODO is this correct thing to do? + else + return parent; + } + + @Override + public Resource getRepresents(ReadGraph graph) throws DatabaseException { + Layer0 L0 = Layer0.getInstance(graph); + Resource represents = graph.getPossibleObject(resource, L0.Represents); + if(represents != null) return represents; + else return resource; + } + + @Override + public String getName(ReadGraph graph) throws DatabaseException { + return graph.getRelatedValue(resource, graph.getService(Layer0.class).HasName, Bindings.STRING); } + + @Override + public String getSerialized(ReadGraph graph) throws DatabaseException { + return getURI(graph); + } + + @Override + public String getURI(ReadGraph graph) throws DatabaseException { + if(parent == null) + return getName(graph); + else + return parent.getURI(graph) + "/" + encodeString(getName(graph)); + } + + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + resource.hashCode(); + result = prime * result + ObjectUtils.hashCode(parent); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + ChildVariable other = (ChildVariable) obj; + if (!resource.equals(other.resource)) + return false; + return ObjectUtils.objectEquals(parent, other.parent); + } + } diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/ChildVariableAdapter.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/ChildVariableAdapter.java index d5341d23..593c3b84 100644 --- a/org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/ChildVariableAdapter.java +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/ChildVariableAdapter.java @@ -1,3 +1,14 @@ +/******************************************************************************* + * Copyright (c) 2007, 2011 Association for Decentralized Information Management in + * Industry THTH ry. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * VTT Technical Research Centre of Finland - initial API and implementation + *******************************************************************************/ package org.simantics.sysdyn.adapter; import org.simantics.db.ReadGraph; diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/ConfigurationVariable.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/ConfigurationVariable.java index 244afb73..2b08d71e 100644 --- a/org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/ConfigurationVariable.java +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/ConfigurationVariable.java @@ -1,3 +1,14 @@ +/******************************************************************************* + * Copyright (c) 2007, 2011 Association for Decentralized Information Management in + * Industry THTH ry. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * VTT Technical Research Centre of Finland - initial API and implementation + *******************************************************************************/ package org.simantics.sysdyn.adapter; import java.util.ArrayList; diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/HistoryVariable.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/HistoryVariable.java index 58cdfab6..fdde1806 100644 --- a/org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/HistoryVariable.java +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/HistoryVariable.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010 Association for Decentralized Information Management in + * Copyright (c) 2007, 2011 Association for Decentralized Information Management in * Industry THTH ry. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 @@ -28,7 +28,6 @@ import org.simantics.db.common.uri.UnescapedChildMapOfResource; import org.simantics.db.common.utils.NameUtils; import org.simantics.db.exception.DatabaseException; import org.simantics.db.layer0.exception.MissingVariableException; -import org.simantics.db.layer0.variable.ResourceVariable; import org.simantics.db.layer0.variable.Variable; import org.simantics.db.layer0.variable.Variables; import org.simantics.layer0.Layer0; @@ -40,41 +39,12 @@ import org.simantics.sysdyn.manager.SysdynModel; import org.simantics.sysdyn.manager.SysdynModelManager; import org.simantics.sysdyn.manager.SysdynResult; -public class HistoryVariable extends ResourceVariable { +public class HistoryVariable extends ChildVariable { - final private Variable parent; - public HistoryVariable(Variable parent, Resource resource) { - super(resource); - this.parent = parent; + super(parent, resource); } -// @Override -// public T getInterface(ReadGraph graph, Class clazz) throws DatabaseException { -// if(Accessor.class.equals(clazz)) { -// -// SimulationResource SIMU = SimulationResource.getInstance(graph); -// Resource model = Variables.getModel(graph, this); -// Resource configuration = graph.getPossibleObject(model, SIMU.HasConfiguration); -// SysdynModel sm = SysdynModelManager.getInstance(graph.getSession()).getModel(graph, configuration); -// SysdynResult sr = sm.getSysdynResult(); -// String rvi = Variables.getRVI(graph, this); -// System.out.println("HistoryVariable rvi='" + rvi + "'"); -// rvi = rvi.substring(1).replace("/", "."); -// SysdynDataSet ds = sr.getDataSet(rvi); -// -// try { -// return (T)Accessors.getAccessor(Bindings.getBindingUnchecked(SysdynDataSet.class), ds); -// } catch (RuntimeBindingConstructionException e) { -// e.printStackTrace(); -// } catch (AccessorConstructionException e) { -// e.printStackTrace(); -// } -// return null; -// -// } -// return super.getInterface(graph, clazz); -// } @SuppressWarnings("unchecked") @Override @@ -165,26 +135,5 @@ public class HistoryVariable extends ResourceVariable { } else { return super.browseChildren(graph); } - } - - - @Override - public Variable getParent(ReadGraph graph) throws DatabaseException { - return parent; - } - - public String getRvi(ReadGraph graph) throws DatabaseException { - Variable parent = getParent(graph); - if(parent instanceof HistoryVariable) { - HistoryVariable p = (HistoryVariable)parent; - return p.getRvi(graph) + "/" + this.getName(graph); - } else { - return this.getName(graph); - } - } - - final public String getName(ReadGraph graph) throws DatabaseException { - return graph.getRelatedValue(resource, graph.getService(Layer0.class).HasName, Bindings.STRING); - } - + } } diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/ModuleVariable.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/ModuleVariable.java index edcb78dc..c5e21968 100644 --- a/org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/ModuleVariable.java +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/ModuleVariable.java @@ -1,3 +1,14 @@ +/******************************************************************************* + * Copyright (c) 2007, 2011 Association for Decentralized Information Management in + * Industry THTH ry. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * VTT Technical Research Centre of Finland - initial API and implementation + *******************************************************************************/ package org.simantics.sysdyn.adapter; import java.util.ArrayList; @@ -32,10 +43,7 @@ public class ModuleVariable extends ChildVariable { throw new MissingVariableException("No configuration for " + NameUtils.getSafeName(graph, instanceOf)); Map children = graph.syncRequest(new UnescapedChildMapOfResource(configuration)); Resource child = children.get(name); - if(child == null) { - return getPossibleSpecialChild(graph, name); - } - else return graph.adaptContextual(child, this, Variable.class, Variable.class); + return graph.adaptContextual(child, this, Variable.class, Variable.class); } @@ -54,7 +62,7 @@ public class ModuleVariable extends ChildVariable { for(Resource child : graph.syncRequest(new UnescapedChildMapOfResource(configuration)).values()) result.add(graph.adaptContextual(child, this, Variable.class, Variable.class)); - collectSpecialChildren(graph, result); + return result; } diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/RunVariable.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/RunVariable.java index aab21ce3..c847527b 100644 --- a/org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/RunVariable.java +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/RunVariable.java @@ -1,3 +1,14 @@ +/******************************************************************************* + * Copyright (c) 2007, 2011 Association for Decentralized Information Management in + * Industry THTH ry. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * VTT Technical Research Centre of Finland - initial API and implementation + *******************************************************************************/ package org.simantics.sysdyn.adapter; import java.util.ArrayList; @@ -6,10 +17,8 @@ import java.util.Map; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; -import org.simantics.db.common.request.PropertyMapOfResource; import org.simantics.db.common.uri.UnescapedChildMapOfResource; import org.simantics.db.exception.DatabaseException; -import org.simantics.db.layer0.variable.GraphPropertyFactory; import org.simantics.db.layer0.variable.StandardGraphChildVariable; import org.simantics.db.layer0.variable.Variable; import org.simantics.layer0.Layer0; -- 2.47.1