</activeWhen>\r
</handler>\r
<handler\r
- class="org.simantics.sysdyn.ui.ExpressionFieldUndoHandler"\r
+ class="org.simantics.sysdyn.ui.PropertyViewUndoHandler"\r
commandId="org.eclipse.ui.edit.undo">\r
<activeWhen>\r
<reference\r
</activeWhen>\r
</handler>\r
<handler\r
- class="org.simantics.sysdyn.ui.ExpressionFieldUndoHandler"\r
+ class="org.simantics.sysdyn.ui.PropertyViewUndoHandler"\r
commandId="org.eclipse.ui.edit.redo">\r
<activeWhen>\r
<reference\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.swt.custom.StyledText;\r
import org.eclipse.swt.widgets.Composite;\r
import org.eclipse.swt.widgets.Control;\r
import org.eclipse.swt.widgets.Event;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.db.layer0.util.Layer0Utils;\r
+import org.eclipse.swt.widgets.Widget;\r
+import org.simantics.browsing.ui.swt.widgets.TrackedText;\r
import org.simantics.sysdyn.ui.properties.widgets.expressions.ExpressionField;\r
+import org.simantics.ui.workbench.handler.SessionUndoHandler;\r
\r
-public class ExpressionFieldUndoHandler extends AbstractHandler {\r
+public class PropertyViewUndoHandler extends AbstractHandler {\r
\r
@Override\r
public Object execute(ExecutionEvent event) throws ExecutionException {\r
String id = event.getCommand().getId();\r
\r
+ Event e = (Event)event.getTrigger();\r
+ Widget w = e.widget;\r
+ Object data = w.getData(TrackedText.ID);\r
+ if (data != null) {\r
+ TrackedText text = (TrackedText) data;\r
+ if (id.equals("org.eclipse.ui.edit.undo"))\r
+ text.undo();\r
+ else\r
+ text.redo();\r
+ return null;\r
+ }\r
+ \r
+ \r
Composite c = ((Control)((Event)event.getTrigger()).widget).getParent();\r
if (c instanceof ExpressionField) {\r
ExpressionField f = (ExpressionField)c;\r
- if(id.equals("org.eclipse.ui.edit.undo")) {\r
+ if (id.equals("org.eclipse.ui.edit.undo")) {\r
f.getSourceViewer().getUndoManager().undo();\r
}\r
else {\r
f.getSourceViewer().getUndoManager().redo();\r
}\r
} else {\r
- try {\r
- Layer0Utils.undo();\r
- } catch (DatabaseException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- }\r
+ SessionUndoHandler suh = new SessionUndoHandler();\r
+ suh.execute(event);\r
+ //Layer0Utils.undo();\r
+ \r
}\r
return null;\r
}\r