multiple diagrams and a shared model [message #213933] |
Thu, 18 December 2008 09:38  |
Eclipse User |
|
|
|
I want to do something is would have thought was pretty common, but i just
can't figure out how to get GMF to support it.
I have a simple EMF model, which i open in a CNF navigator and from there
i launch GMF diagram editors. The model has multiple "Design" nodes
(EObjects) which i open and edit using the diagram editors. However, each
of these "Designs" also reference other EObjects from a large set of
shared objects ("Notes").
I have many problems with this apparently simple arrangement!
1) I can't get the CNF navigator to update when i edit a "Design". I
eventually got it to share a TransactionalEditingDomain with the GMF
diagram editor, and this works until the editor closes the diagram. Then
the resource set seems to get unloaded and all the model objects that the
CNF navigator pointed to are left dangling. Am i supposed to listen for
this event and load it all up again? Can i stop the editor dumping it all
in the first place?
2) Am i right to think that i can't really just register a
TransactionalEditingDomain with an ID via an extension point and use
TransactionalEditingDomain.Registry.INSTANCE.getEditingDomai n( "myID")
since i can have several projects open at once and each must use a
different editing domain. Anyway, from the code i've seen, the
???DocumentProvider creates the editing domain and registers the ID - it
doesn't look it up.
3) If i share the single TransactionalEditingDomain between all the
editors then things quickly go wrong - dirty editors don't get marked as
such, saves don't work and changes i've made disappear. Is there a way to
make this system work?
4) I get the feeling i'm on the wrong track and i should have one domain
per editor, each with its own undo/redo. This would be fine for me - but
then how do i manage the shared resources and CNF navigator?
a) Can i get a GMF editor to load just its own model and not try and
load the shared resource model? (it is big and i don't want it loaded
multiple times)
b) How do i get to see the shared resource data that the "Design" i'm
editing is pointing to if i've not loaded it in this editing domain? How
do i make changes to it?
c) How can i get the CNF viewer to show a tree of the entire model if
it is in a separate domain?
I've REALLY struggled here - any help much appreciated.
|
|
|
|
Re: multiple diagrams and a shared model [message #214095 is a reply to message #213933] |
Mon, 22 December 2008 17:40  |
Eclipse User |
|
|
|
Originally posted by: jan.koehnlein.web.de
Maybe that will give you some hints:
http://code.google.com/p/gmftools/wiki/SharedEditingDomain
You can also use the same shared editing domain in for the CNF views.
Just follow the advices given on the page above, especially
- adapt the calls to EditingDomainFactory.create()
- remove the calls to EditingDomain.dispose()
Note that you might run into memory problems, as references to your
model elements are kept on the command stack, even though you close your
editors, keeping them from being garbage collected.
Regards
Jan
pv wrote:
> I want to do something is would have thought was pretty common, but i
> just can't figure out how to get GMF to support it.
>
> I have a simple EMF model, which i open in a CNF navigator and from
> there i launch GMF diagram editors. The model has multiple "Design"
> nodes (EObjects) which i open and edit using the diagram editors.
> However, each of these "Designs" also reference other EObjects from a
> large set of shared objects ("Notes").
>
> I have many problems with this apparently simple arrangement!
>
> 1) I can't get the CNF navigator to update when i edit a "Design". I
> eventually got it to share a TransactionalEditingDomain with the GMF
> diagram editor, and this works until the editor closes the diagram. Then
> the resource set seems to get unloaded and all the model objects that
> the CNF navigator pointed to are left dangling. Am i supposed to listen
> for this event and load it all up again? Can i stop the editor dumping
> it all in the first place?
>
> 2) Am i right to think that i can't really just register a
> TransactionalEditingDomain with an ID via an extension point and use
> TransactionalEditingDomain.Registry.INSTANCE.getEditingDomai n( "myID")
> since i can have several projects open at once and each must use a
> different editing domain. Anyway, from the code i've seen, the
> ???DocumentProvider creates the editing domain and registers the ID - it
> doesn't look it up.
>
> 3) If i share the single TransactionalEditingDomain between all the
> editors then things quickly go wrong - dirty editors don't get marked as
> such, saves don't work and changes i've made disappear. Is there a way
> to make this system work?
>
> 4) I get the feeling i'm on the wrong track and i should have one domain
> per editor, each with its own undo/redo. This would be fine for me - but
> then how do i manage the shared resources and CNF navigator?
> a) Can i get a GMF editor to load just its own model and not try and
> load the shared resource model? (it is big and i don't want it loaded
> multiple times)
> b) How do i get to see the shared resource data that the "Design" i'm
> editing is pointing to if i've not loaded it in this editing domain? How
> do i make changes to it?
> c) How can i get the CNF viewer to show a tree of the entire model if
> it is in a separate domain?
>
> I've REALLY struggled here - any help much appreciated.
>
|
|
|
Powered by
FUDForum. Page generated in 0.04033 seconds