Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » EMF EditingDomain, Undo/Redo
EMF EditingDomain, Undo/Redo [message #742456] Thu, 20 October 2011 14:07 Go to next message
Dennis Melzer is currently offline Dennis MelzerFriend
Messages: 244
Registered: July 2009
Senior Member
Hello,

i want to use EMF undo/redo in e4.

In 3.x code
	CommandStack commandStack = new BasicCommandStack();
		EditingDomain domain = new AdapterFactoryEditingDomain(new E4AdapterFactory(), commandStack);
		
		bindingContext = new EMFDataBindingContext();


and in the toolbar the command
org.eclipse.ui.edit.undo


Do in e4 exist a undo/redo command? Or i have to create a own command + handler?

And can i inject the EditingDomain?
Re: EMF EditingDomain, Undo/Redo [message #742473 is a reply to message #742456] Thu, 20 October 2011 14:26 Go to previous message
Dennis Melzer is currently offline Dennis MelzerFriend
Messages: 244
Registered: July 2009
Senior Member
I create a UndoHandler. Does anybody know a better solution?Or is this solution ok?

public class UndoHandler {

	@CanExecute
	public boolean canExecute(@Named(IServiceConstants.ACTIVE_PART) MPart mPart) {
		if(mPart.getObject() instanceof IEditingDomainProvider){
			EditingDomain editingDomain = ((IEditingDomainProvider)mPart.getObject()).getEditingDomain();
			return editingDomain.getCommandStack().canUndo();
		}
		return false;
	}

	@Execute
	public void execute(@Named(IServiceConstants.ACTIVE_PART) MPart mPart) {
		System.out.println("execute");
		if(mPart.getObject() instanceof IEditingDomainProvider){
			EditingDomain editingDomain = ((IEditingDomainProvider)mPart.getObject()).getEditingDomain();
			editingDomain.getCommandStack().undo();
		}
	}

}
Previous Topic:HowTo Display Validaton Status ICONS in a Form
Next Topic:Double invocation of a Login Dialog using LifeCyleHandler
Goto Forum:
  


Current Time: Thu Apr 25 16:58:13 GMT 2024

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

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

Back to the top