import org.eclipse.ui.commands.ICommandService;\r
import org.simantics.sysdyn.manager.SysdynModel;\r
import org.simantics.sysdyn.manager.SysdynModelManager;\r
+import org.simantics.sysdyn.ui.editor.SysdynDiagramEditor;\r
import org.simantics.ui.SimanticsUI;\r
import org.simantics.ui.workbench.ResourceEditorInput;\r
\r
state.setValue(value);\r
// If turned back on, simulate to apply any changes\r
if(value) {\r
- IEditorPart editor = \r
+ IEditorPart editor =\r
PlatformUI.getWorkbench()\r
.getActiveWorkbenchWindow().getActivePage().getActiveEditor();\r
- IEditorInput input = editor.getEditorInput();\r
- ResourceEditorInput rei = (ResourceEditorInput) input;\r
- SysdynModelManager sdm = SysdynModelManager.getInstance(SimanticsUI.getSession());\r
- SysdynModel model = sdm.getModel(rei.getResource());\r
- model.domainModified();\r
+ if (editor instanceof SysdynDiagramEditor) {\r
+ IEditorInput input = editor.getEditorInput();\r
+ ResourceEditorInput rei = (ResourceEditorInput) input;\r
+ SysdynModelManager sdm = SysdynModelManager.getInstance(SimanticsUI.getSession());\r
+ SysdynModel model = sdm.getModel(rei.getResource());\r
+ model.domainModified();\r
+ }\r
}\r
return null;\r
}\r