[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
|
[news.eclipse.tools.gef] Re: Undo/Redo
|
cristina wrote:
Hi Georg!
I read your interesting question and I wonder if you ever got the answer to connect a GEF editor with RCP.
Please let me know.
Kind regards
Cristina
my email!! cmvp@xxxxxxxxxxxx
Hi Christina,
I didn't get an answer but here is my solution. In my GraphicalEditor in
createPartControl I hooked into the global redo/undo actions like this:
@Override
public void createPartControl(Composite parent) {
super.createPartControl(parent);
IActionBars actionBars = getEditorSite().getActionBars();
actionBars.setGlobalActionHandler(ActionFactory.UNDO.getId(),
new Action() {
@Override
public void run() {
if (getEditDomain().getCommandStack().canUndo()) {
getEditDomain().getCommandStack().undo();
}
}
});
actionBars.setGlobalActionHandler(ActionFactory.REDO.getId(),
new Action() {
@Override
public void run() {
if (getEditDomain().getCommandStack().canRedo()) {
getEditDomain().getCommandStack().redo();
}
}
});
}
Kind regards,
Georg