From 1c16ea968938913e2cf684b374a5bb6676285783 Mon Sep 17 00:00:00 2001 From: lempinen Date: Fri, 18 Feb 2011 07:48:28 +0000 Subject: [PATCH] Enumeration properties work also in the modules-folder. changes do not update model results. git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@19799 ac1ea38d-2e2b-0410-8846-a27921b304fc --- .../sysdyn/ui/properties/EnumerationTab.java | 40 +++++++++---------- .../ResourceSelectionProcessor.java | 6 ++- 2 files changed, 25 insertions(+), 21 deletions(-) diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/EnumerationTab.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/EnumerationTab.java index 0b210465..f4cbd5ff 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/EnumerationTab.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/EnumerationTab.java @@ -98,15 +98,7 @@ public class EnumerationTab extends PropertyTabContributorImpl implements Widget SimanticsUI.getSession().asyncRequest(new ReadRequest() { @Override public void run(ReadGraph graph) throws DatabaseException { - Resource modelResource = Variables.getModel(graph, variable); - if(modelResource != null) { - Resource configuration = graph.getSingleObject( - modelResource, - SimulationResource.getInstance(graph).HasConfiguration); - SysdynModel model = SysdynModelManager.getInstance(graph.getSession()).getModel(graph, configuration); - // update results in graphs - model.resultChanged(); - } + updateModelResults(graph); } }); } @@ -327,17 +319,7 @@ public class EnumerationTab extends PropertyTabContributorImpl implements Widget } } - - Resource modelResource = Variables.getModel(graph, variable); - if(modelResource != null) { - Resource configuration = graph.getSingleObject( - modelResource, - SimulationResource.getInstance(graph).HasConfiguration); - SysdynModel model = SysdynModelManager.getInstance(graph.getSession()).getModel(graph, configuration); - // update results in graphs - model.resultChanged(); - } - + updateModelResults(graph); } }); } catch (DatabaseException e1) { @@ -353,6 +335,24 @@ public class EnumerationTab extends PropertyTabContributorImpl implements Widget } } + + private void updateModelResults(ReadGraph graph) { + try { + if(variable != null ) { + Resource modelResource = Variables.getModel(graph, variable); + if(modelResource != null) { + Resource configuration = graph.getSingleObject( + modelResource, + SimulationResource.getInstance(graph).HasConfiguration); + SysdynModel model = SysdynModelManager.getInstance(graph.getSession()).getModel(graph, configuration); + // update results in graphs + model.resultChanged(); + } + } + } catch (DatabaseException e) { + e.printStackTrace(); + } + } @Override public void setInput(ISessionContext context, Object input) { diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/ResourceSelectionProcessor.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/ResourceSelectionProcessor.java index b46e3d63..89668611 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/ResourceSelectionProcessor.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/ResourceSelectionProcessor.java @@ -146,10 +146,14 @@ public class ResourceSelectionProcessor implements SelectionProcessor