import org.eclipse.core.commands.ExecutionException;\r
import org.eclipse.jface.resource.ImageDescriptor;\r
import org.eclipse.jface.window.Window;\r
+import org.eclipse.swt.SWT;\r
+import org.eclipse.swt.widgets.Display;\r
+import org.eclipse.swt.widgets.MessageBox;\r
import org.eclipse.swt.widgets.Shell;\r
import org.eclipse.ui.PlatformUI;\r
import org.simantics.Simantics;\r
import org.simantics.sysdyn.manager.SysdynGameExperimentBase;\r
import org.simantics.sysdyn.manager.SysdynResult;\r
import org.simantics.sysdyn.ui.utils.HandlerUtils;\r
-import org.simantics.ui.SimanticsUI;\r
import org.simantics.utils.datastructures.Pair;\r
\r
public class SaveHistoryHandler extends AbstractHandler {\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 SysdynGameExperimentBase) {\r
final SysdynGameExperimentBase exp = (SysdynGameExperimentBase)experiment;\r
if(r instanceof MemoryResult) {\r
MemoryResult gr = (MemoryResult)r;\r
SimulationResult sr = gr.getSimulationResult();\r
+ if (sr == null) {\r
+ \r
+ MessageBox messageDialog = new MessageBox(Display.getCurrent().getActiveShell(), SWT.ICON_WARNING | SWT.OK);\r
+ messageDialog.setText("No Simulation History");\r
+ messageDialog.setMessage("There is no simulation history available, please simulate first!");\r
+\r
+ messageDialog.open();\r
+ return null;\r
+ }\r
for(DataSet ds : sr.getVariableDataSets()) {\r
map.put(ds, new Pair<String,ImageDescriptor>(ds.name, null));\r
}\r