]> gerrit.simantics Code Review - simantics/3d.git/blobdiff - org.simantics.g3d.vtk/src/org/simantics/g3d/vtk/action/vtkAction.java
Disable DB level undo, when model modifying actions are active
[simantics/3d.git] / org.simantics.g3d.vtk / src / org / simantics / g3d / vtk / action / vtkAction.java
index 01327c519cc577fdbb533992a13585c1bd959144..da9088049bcefd98f2a80458136b1efe4172e2f8 100644 (file)
@@ -1,9 +1,22 @@
 package org.simantics.g3d.vtk.action;
 
+import org.eclipse.core.commands.Command;
+import org.eclipse.core.commands.State;
 import org.eclipse.jface.action.Action;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.commands.ICommandService;
+import org.simantics.ui.states.TrackedTextState;
 
 public abstract class vtkAction extends Action{
 
        public abstract void attach();
        public abstract void deattach();
-}
+       
+       
+       protected void setDBUndo(boolean enabled) {
+           ICommandService service = (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class);
+        Command command = service.getCommand( TrackedTextState.COMMAND_ID );
+        State state = command.getState( TrackedTextState.STATE_ID );
+        state.setValue(enabled);
+       }
+ }