Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Graphiti » Disable Unto/Redo in graphical editor context menu
Disable Unto/Redo in graphical editor context menu [message #1264465] Wed, 05 March 2014 08:41 Go to next message
Surya Kathayat is currently offline Surya KathayatFriend
Messages: 44
Registered: July 2012
Member
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
Re: Disable Unto/Redo in graphical editor context menu [message #1264481 is a reply to message #1264465] Wed, 05 March 2014 08:57 Go to previous message
Michael Wenz is currently offline Michael WenzFriend
Messages: 1931
Registered: July 2009
Location: Walldorf, Germany
Senior Member
Surya,

that looks too complicated: I just tried in the tutorial move feature for
EClasses to simply override canUndo() and return false (you don't need to
implement ICustomUndoableFeature, as canUndo is already part of the standard
feature API and without undo there is also no redo). After that undo did not
appear in the context menu of the editor and was grayed out in the main
menu.

Michael
Previous Topic:FreeFormConnection not starting at the tip of anchor at 100%zoom
Next Topic:Change the default anchor on a connection
Goto Forum:
  


Current Time: Thu Apr 25 13:19:39 GMT 2024

Powered by FUDForum. Page generated in 0.02649 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top