GMF + EMF + commandstack [message #212570] |
Tue, 02 December 2008 13:27  |
Eclipse User |
|
|
|
Hello,
I have followed the tutorial to integrate EMF and GMF generated editors.
Now, I run into this is issue that when I edit in the diagram editor,
the domain is not "dirty" so saving etc.. is not possible. (Although
elements get added to the domain model). On the other hand when I edit
in the EMF editor, the model is set "dirty" and therefor can be saved.
(and all other facilities).
I have looked into this issue, to track the problem, and I think the
following snippet in DiagramEditor is the culprit.
[DiagramEditor]
if (editDomain != null) {
CommandStack stack = editDomain.getCommandStack();
if (stack != null) {
// dispose the old stack
stack.dispose();
}
// create and assign the new stack
DiagramCommandStack diagramStack = new DiagramCommandStack(
getDiagramEditDomain());
....
Now, as you can see a new commandstack is installed, while the command
stack listener which sets the "dirty" property is added on a command
stack installed earlier (In initializedEditingDomain in the EMF Editor).
So this explains my issue.
[MyEMFEditor]
domain.getCommandStack().addCommandStackListener(cmdListener );
The question now is, how to solve this. This issue is not new, as I see
some posts here and there. One posts suggests defining the editing
domain in the EMF editor. I am not sure how this will solve the problem.
I guess, I could install the cmd listener after the new CommandStack is
installed?, But what puzzles me, is why would the GMF code allow an
auxillary editing domain, and then throwing away it's command stack?
Perhaps, some sort of command stack registry, would be a good solution
to have a unique commandstack for EMF and GMF editors respectively?
(This would likely also address the issue of undo/redo accross different
editor types).
Some guidance is most welcome.
Thank You, Christophe Bouhier
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03729 seconds