import org.simantics.sysdyn.manager.SysdynExperiment;\r
import org.simantics.sysdyn.manager.SysdynExperiments;\r
import org.simantics.sysdyn.ui.utils.HandlerUtils;\r
-import org.simantics.ui.SimanticsUI;\r
\r
public class SaveICHandler extends AbstractHandler {\r
\r
HandlerUtils.saveBeforeExperimentRun(event);\r
\r
IExperimentManager manager = \r
- SimanticsUI.getProject().getHint(IExperimentManager.KEY_EXPERIMENT_MANAGER);\r
+ Simantics.getProject().getHint(IExperimentManager.KEY_EXPERIMENT_MANAGER);\r
IExperiment experiment = manager.getActiveExperiment();\r
if(experiment instanceof SysdynExperiment) {\r
final SysdynExperiment exp = (SysdynExperiment)experiment;\r
@Override\r
public void perform(WriteGraph graph) throws DatabaseException {\r
Variable v = Variables.getVariable(graph, exp.getResource());\r
- SysdynExperiments.saveIC(graph, v, "IC");\r
+ SysdynExperiments.saveIC(graph, v);\r
}\r
\r
});\r
import org.simantics.db.Resource;\r
import org.simantics.db.WriteGraph;\r
import org.simantics.db.common.request.ObjectsWithType;\r
+import org.simantics.db.common.utils.NameUtils;\r
import org.simantics.db.exception.DatabaseException;\r
import org.simantics.db.layer0.util.Layer0Utils;\r
import org.simantics.db.layer0.util.RemoverUtil;\r
}\r
}\r
}\r
+ \r
+ public static Resource saveIC(WriteGraph graph, Variable input) throws DatabaseException {\r
+ Layer0 L0 = Layer0.getInstance(graph);\r
+ Resource model = Variables.getModel(graph, input);\r
+ String name = NameUtils.findFreshName(graph, "IC", model, L0.ConsistsOf);\r
+ return saveIC(graph, input, name);\r
+ }\r
\r
public static Resource saveIC(WriteGraph graph, Variable input, String name) throws DatabaseException {\r
graph.markUndoPoint();\r