From 9f3e313f54af33957bfb85e1b50b4aae465de303 Mon Sep 17 00:00:00 2001 From: villberg Date: Sat, 18 Oct 2014 18:57:58 +0000 Subject: [PATCH] (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 --- .../ui/browser/actions/drop/ChartDropAction.java | 2 +- .../ui/browser/childrules/VariableChildRule.java | 2 +- .../sysdyn/ui/browser/contributions/Configuration.java | 10 +++++----- .../ui/browser/imagerules/VariableImageRule.java | 3 +-- 4 files changed, 8 insertions(+), 9 deletions(-) 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); -- 2.47.1