Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [gmf-dev] Is it necessary to use shared instance ofMEditingDomain?

Hi, Christian!
    My idea was to use own instance of MEditingDomain for each GMF diagram exactly to simplify resource-related code. For example, easily save all the resources associated with the current diagram just by saving all the resources loaded into the current MEditingDomain. But, once I tried to create diagram with new instance of MEditingDomain I found a problems with toolbar tools (you've mentioned as possible "snag" ;-)).
    So, my question is: do you think it is reasonable to create own instance of MEditingDomain for each diagram (not only to solve my problems, but due to some other possible problems with undo, etc)? In case you agree with me, I can try to switch GMF to use one editing domain per diagram and submit corresponding requests to runtime. If not, I'll probably try to solve my problems in another way and ask you some more questions about another aspects of MEditingDomain + resources in it.
 
______________
Alex Shatalin
 


From: gmf-dev-bounces@xxxxxxxxxxx [mailto:gmf-dev-bounces@xxxxxxxxxxx] On Behalf Of Christian Damus
Sent: Thursday, October 20, 2005 3:49 PM
To: GMF Project developer discussions.
Subject: Re: [gmf-dev] Is it necessary to use shared instance ofMEditingDomain?


Hi, Alex,

The intent of the MEditingDomain is that you can create any number of instances to manage resources independently of other diagrams, editors, applications, whatever.  This works at the basic level of programmatic manipulation of EMF resources.  You will run into snags, however, in other areas of the GMF run-time such as the AbstractModelCommand and some of the diagram code, which assume that all work is done in the shared MEditingDomain.  I think that some people have managed to work around this to some degree, but I do not know the details.

For now, perhaps it is best to code defensively, without assuming a shared instance, and to apply that assumption externally to your code.  We have plans afoot to make it easier to use multiple MEditingDomains, and when that's done you should be able to re-work your code with little effort.

Cheers,

Christian



Christian W. Damus
Aurora Core Model Services
IBM Rational Software
Tel: (613) 591-7937
-- If at first you do succeed, try to hide your astonishment.



"Alexander Shatalin" <Alexander.Shatalin@xxxxxxxxxxx>
Sent by: gmf-dev-bounces@xxxxxxxxxxx

10/20/2005 07:21 AM

Please respond to
"GMF Project developer discussions."

To
<gmf-dev@xxxxxxxxxxx>
cc
Subject
[gmf-dev] Is it necessary to use shared instance of MEditingDomain?





Hi!
                I'm sorry for probably stupid question, but I've just started
with IBM runtime, so I'm not a guru in this area. ;-)
                During an implementation of possibility to store user domain
model instances in a separate resource, I came to the question: is it
necessary to share single instance of MEditingDomain across all the
diagrams? I suppose, that it was intentionally implemented this way, and
probably, somebody from IBM team could enumerate an arguments for it.

______________
Alex Shatalin
_______________________________________________
gmf-dev mailing list
gmf-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/gmf-dev


Back to the top