Disabling Undo [message #654034] |
Sun, 13 February 2011 06:43  |
Eclipse User |
|
|
|
Hi,
I am trying to disable undo in my Graphiti editor. I have redefined canUndo() to return false in all features. Disregarding this, the Undo option in the default popup menu is still enabled and performing an undo. I see several types of undo: Undo Layout, Undo Update, Undo Add and Undo Do. I don't understand why Graphiti still assumes it can undo things.
Is there anything else that I can do to disable the undo command? I just want it to be removed from the standard popup menu.
Jos
|
|
|
|
|
|
|
|
|
|
|
|
Re: Disabling Undo [message #1259377 is a reply to message #1258649] |
Fri, 28 February 2014 05:10  |
Eclipse User |
|
|
|
Hi Michael,
I need to disable "undo and redo" context menus from diagram editor.
I tried the following two methods, and does not work in my case.
1. As mentioned in this tread, my features implement ICustomUndoableFeature, and canUndo() and canRedo() methods return false. Still, I can see Undo and Redo menus enabled in the diagram context menu!!
public class TaskMoveFeature extends DefaultMoveShapeFeature implements ICustomUndoableFeature {
@Override
public boolean canUndo(IContext context) {
return false;
}
@Override
public boolean canRedo(IContext context) {
return false;
}
2. I also tried to extend DiagramEditorContextMenuProvider and override addDefaultMenuGroupUndo method, which infact does nothing.
public class IdmTaskFlowEditorContextMenuProvider extends DiagramEditorContextMenuProvider {
public IdmTaskFlowEditorContextMenuProvider(EditPartViewer viewer,
ActionRegistry registry,
IConfigurationProvider configurationProvider) {
super(viewer, registry, configurationProvider);
}
@Override
protected void addDefaultMenuGroupUndo(IMenuManager manager) {
// do nothing
}
}
I am not sure if this will work but I tried to set the context menu from configureGraphicalViewer method of IdmDiagramEditor(extends DiagramEditor) as below, but how can I get IConfigurationProvider in parameter 3.
@Override
protected void configureGraphicalViewer() {
super.configureGraphicalViewer();
...
getGraphicalViewer().setContextMenu(new IdmTaskFlowEditorContextMenuProvider(getGraphicalViewer(),
getActionRegistry(), ???));
Any workaround will be appreciated.
Regards
Surya
[Updated on: Fri, 28 February 2014 07:55] by Moderator
|
|
|
Powered by
FUDForum. Page generated in 0.87085 seconds