SimanticsUI.getSession().asyncRequest(new ReadRequest() {\r
@Override\r
public void run(ReadGraph graph) throws DatabaseException {\r
- Resource modelResource = Variables.getModel(graph, variable);\r
- if(modelResource != null) {\r
- Resource configuration = graph.getSingleObject(\r
- modelResource, \r
- SimulationResource.getInstance(graph).HasConfiguration);\r
- SysdynModel model = SysdynModelManager.getInstance(graph.getSession()).getModel(graph, configuration);\r
- // update results in graphs\r
- model.resultChanged();\r
- }\r
+ updateModelResults(graph);\r
}\r
});\r
}\r
}\r
}\r
\r
- \r
- Resource modelResource = Variables.getModel(graph, variable);\r
- if(modelResource != null) {\r
- Resource configuration = graph.getSingleObject(\r
- modelResource, \r
- SimulationResource.getInstance(graph).HasConfiguration);\r
- SysdynModel model = SysdynModelManager.getInstance(graph.getSession()).getModel(graph, configuration);\r
- // update results in graphs\r
- model.resultChanged();\r
- }\r
-\r
+ updateModelResults(graph);\r
}\r
});\r
} catch (DatabaseException e1) {\r
}\r
\r
}\r
+ \r
+ private void updateModelResults(ReadGraph graph) {\r
+ try {\r
+ if(variable != null ) {\r
+ Resource modelResource = Variables.getModel(graph, variable);\r
+ if(modelResource != null) {\r
+ Resource configuration = graph.getSingleObject(\r
+ modelResource, \r
+ SimulationResource.getInstance(graph).HasConfiguration);\r
+ SysdynModel model = SysdynModelManager.getInstance(graph.getSession()).getModel(graph, configuration);\r
+ // update results in graphs\r
+ model.resultChanged();\r
+ }\r
+ }\r
+ } catch (DatabaseException e) {\r
+ e.printStackTrace();\r
+ }\r
+ }\r
\r
@Override\r
public void setInput(ISessionContext context, Object input) {\r
return tabs;\r
}\r
if (backend.isInstanceOf(r, sr.Enumeration)) {\r
+ Object s = AdaptionUtils.adaptToSingle(selection, ISelection.class);\r
+ if(s == null)\r
+ s = r;\r
+ // give either variable or the actual resource\r
return Collections.singleton(new ComparableTabContributor(\r
new EnumerationTab(),\r
2,\r
- AdaptionUtils.adaptToSingle(selection, ISelection.class),\r
+ s,\r
"Enumeration"));\r
}\r
if ( backend.isInstanceOf(r, sr.Configuration) || backend.isInstanceOf(r, sr.SysdynModel)) {\r