|Re: Updating editor after modify an emf model programatically [message #509228 is a reply to message #508991]
||Thu, 21 January 2010 17:41
Registered: December 2009
Thanks!!, that´s it.|
In fact there isn´t so much information about this on the web apart from the API description, so I leave a small example below.
I have a hierarchy of EObjects (like the example about mindmaps and topics...) of a SolutionList with Solution elements, and more levels below.
I´m editing the model using the emf model editor generated from my genmodel...
Before using commands I was inserting all the objects like this...
resulting in a updated model, but the editor didn´t mark it as "modificated" (thus is, "Save As" button was disabled in my app)
do all the stuff the same but in the final object insertion (Solution into SolutionList) , instead using a Command:
EditingDomain domain = AdapterFactoryEditingDomain.getEditingDomainFor(model.getSolutionList());
Command command = AddCommand.create(domain, model.getSolutionList(), ModelPackage.Literals.SOLUTION_LIST__SOLUTIONS, sol);
This way the editor is marked as dirty, and as said before, Undo and Redo operations work as usual (undo removes all the operation)
Powered by FUDForum
. Page generated in 0.01953 seconds