From: villberg Date: Sat, 18 Oct 2014 18:57:58 +0000 (+0000) Subject: (refs #5417) Standard variable performance optimization and API refinement X-Git-Tag: v1.29.0~162 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=9f3e313f54af33957bfb85e1b50b4aae465de303;p=simantics%2Fsysdyn.git (refs #5417) Standard variable performance optimization and API refinement git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@30449 ac1ea38d-2e2b-0410-8846-a27921b304fc --- diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/actions/drop/ChartDropAction.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/actions/drop/ChartDropAction.java index e5e308ac..72d6a34d 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/actions/drop/ChartDropAction.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/actions/drop/ChartDropAction.java @@ -69,7 +69,7 @@ public class ChartDropAction implements DropActionFactory { if(variable == null) continue; - Resource represents = (Resource)variable.getPropertyValue(graph, Variables.REPRESENTS); + Resource represents = (Resource)variable.getRepresents(graph); if(represents == null || !(graph.isInstanceOf(represents, sr.IndependentVariable) || graph.isInstanceOf(represents, sr.Input))) diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/childrules/VariableChildRule.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/childrules/VariableChildRule.java index 270ad228..783961af 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/childrules/VariableChildRule.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/childrules/VariableChildRule.java @@ -59,7 +59,7 @@ public class VariableChildRule implements ChildRule { ArrayList variables = new ArrayList(); for(Variable child : variable.getChildren(graph)) { - Resource represents = (Resource)child.getPropertyValue(graph, Variables.REPRESENTS); + Resource represents = child.getRepresents(graph); if(graph.isInstanceOf(represents, sr.IndependentVariable)) { variables.add(child); } else if (graph.isInstanceOf(represents, sr.Input)) { diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/Configuration.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/Configuration.java index fdb9ee0b..659f63f2 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/Configuration.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/Configuration.java @@ -52,7 +52,7 @@ public class Configuration extends ViewpointContributor(v, represents)); } for (String s : inputs.keySet()) { Variable v = inputs.get(s); - Resource represents = (Resource)v.getPropertyValue(graph, Variables.REPRESENTS); + Resource represents = v.getRepresents(graph); result.add(new InputNode(v, represents)); } for (String s : modules.keySet()) { Variable v = modules.get(s); - Resource represents = (Resource)v.getPropertyValue(graph, Variables.REPRESENTS); + Resource represents = v.getRepresents(graph); result.add(new ModuleNode(v, represents)); } for (String s : enumerations.keySet()) { Variable v = enumerations.get(s); - Resource represents = (Resource)v.getPropertyValue(graph, Variables.REPRESENTS); + Resource represents = v.getRepresents(graph); result.add(new EnumerationNode(v, represents)); } diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/imagerules/VariableImageRule.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/imagerules/VariableImageRule.java index ba780a64..7c1b5779 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/imagerules/VariableImageRule.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/imagerules/VariableImageRule.java @@ -21,7 +21,6 @@ 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.layer0.Layer0; import org.simantics.sysdyn.SysdynResource; import org.simantics.sysdyn.ui.Activator; @@ -40,7 +39,7 @@ public class VariableImageRule implements ImageRule { String image = "icons/brick.png"; - Resource r = (Resource)var.getPropertyValue(graph, Variables.REPRESENTS); + Resource r = var.getRepresents(graph); if(r != null) { Layer0 L0 = Layer0.getInstance(graph); SysdynResource sr = SysdynResource.getInstance(graph);