]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/SCLEditorBaseUndoHandler.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.modeling.ui / src / org / simantics / modeling / ui / componentTypeEditor / SCLEditorBaseUndoHandler.java
diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/SCLEditorBaseUndoHandler.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/SCLEditorBaseUndoHandler.java
new file mode 100644 (file)
index 0000000..119650b
--- /dev/null
@@ -0,0 +1,23 @@
+package org.simantics.modeling.ui.componentTypeEditor;\r
+\r
+import org.eclipse.core.commands.AbstractHandler;\r
+import org.eclipse.core.commands.ExecutionEvent;\r
+import org.eclipse.core.commands.ExecutionException;\r
+import org.eclipse.ui.PlatformUI;\r
+\r
+public class SCLEditorBaseUndoHandler extends AbstractHandler {\r
+\r
+    @Override\r
+    public Object execute(ExecutionEvent event) throws ExecutionException {\r
+        String id = event.getCommand().getId();\r
+        SCLEditorBase editor = (SCLEditorBase)PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();\r
+        if(id.equals("org.eclipse.ui.edit.undo")) {\r
+            editor.editor.getUndoManager().undo();\r
+        }\r
+        else {\r
+            editor.editor.getUndoManager().redo();\r
+        }\r
+        return null;\r
+    }\r
+\r
+}\r