]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/SCLEditorBaseUndoHandler.java
6ac47e9fa69096b89f56d45fdc40618909cbd01e
[simantics/platform.git] / bundles / org.simantics.modeling.ui / src / org / simantics / modeling / ui / componentTypeEditor / SCLEditorBaseUndoHandler.java
1 package org.simantics.modeling.ui.componentTypeEditor;
2
3 import org.eclipse.core.commands.AbstractHandler;
4 import org.eclipse.core.commands.ExecutionEvent;
5 import org.eclipse.core.commands.ExecutionException;
6 import org.eclipse.ui.PlatformUI;
7
8 public class SCLEditorBaseUndoHandler extends AbstractHandler {
9
10     @Override
11     public Object execute(ExecutionEvent event) throws ExecutionException {
12         String id = event.getCommand().getId();
13         SCLEditorBase editor = (SCLEditorBase)PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
14         if(id.equals("org.eclipse.ui.edit.undo")) { //$NON-NLS-1$
15             editor.editor.getUndoManager().undo();
16         }
17         else {
18             editor.editor.getUndoManager().redo();
19         }
20         return null;
21     }
22
23 }