Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » Undo/Redo functionality with EMF resources
Undo/Redo functionality with EMF resources [message #1010797] Mon, 18 February 2013 04:02 Go to previous message
Bastian Wagenfeld is currently offline Bastian Wagenfeld
Messages: 88
Registered: January 2013
Member
Hi,

I'm not sure, whether this is the right forum or the EMF forum is the better choice. But I thought, this could be more of an Eclipse 4 topic.
I'm creating a Eclipse 4 RCP that uses EMF resources as input. Now I want to implement undo/redo functionality. In Eclipse 3.x the EMF generated editor used an EditingDomain that includes a CommandStack. I thought maybe I could use this EditingDomain in the Eclipse 4 RCP, too. So I created the EditingDomain like in the EMF Editor:
adapterFactory = new ComposedAdapterFactory(
				ComposedAdapterFactory.Descriptor.Registry.INSTANCE);
		adapterFactory
				.addAdapterFactory(new ResourceItemProviderAdapterFactory());
		adapterFactory
				.addAdapterFactory(new IdentifiableItemProviderAdapterFactory());
		adapterFactory
				.addAdapterFactory(new ReflectiveItemProviderAdapterFactory());

		BasicCommandStack commandStack = new BasicCommandStack();
		commandStack.addCommandStackListener(new CommandStackListener() {

			@Override
			public void commandStackChanged(EventObject event) {
				eventBroker.post(UIEvents.Dirtyable.DIRTY, dirtyable);

			}
		});

		editingDomain = new AdapterFactoryEditingDomain(adapterFactory,
				commandStack, new HashMap<Resource, Boolean>());
		editingDomain.getResourceSet().getResources().add(resource);


Unfortunately the CommandStack is always empty. Does anabody have an idea what else I have to do, to get the CommandStack filled, if an action on the resource is permormed?

Best regards
Bastian
 
Read Message
Read Message
Read Message
Read Message
Previous Topic:Hide View Tab
Next Topic:Problems with CompatibilityView
Goto Forum:
  


Current Time: Wed May 22 02:59:52 EDT 2013

Powered by FUDForum. Page generated in 0.04602 seconds