|Re: Getting a ServiceRegistry for an EMF Resource [message #1464032 is a reply to message #1457975]
||Fri, 07 November 2014 05:30
|| Christian Damus
Registered: July 2009
A ResourceSetListener is intended for reacting to changes in the UML
model, but it seems that you want to change the model according to
refactorings of Java code. So ResourceSetListener doesn't really enter
If you know which are the UML model resource that needs to be updated
for the Java refactoring, then you can (a) check whether there is
currently a Papyrus editor open on that resource and (b) if so, access
its service registry (the editor provides an adapter of type
ServicesRegistry via the IAdaptable protocol) or (c) if an editor is
not open, just load the resource in a simple ResourceSet and modify it.
No need for any TransactionalEditingDomains or editors in that case.
On 2014-10-31 22:54:26 +0000, Bérenger Bérenger said:
> Thank you for your answer.
> I have an UML model which elements are linked to Java elements. I try
> to propagate change applied on the model with JDT refactorings (mainly
> renaming). Initially the project used Eclipse UML2Tools which seems to
> be discontinued for years (I have been quite busy lately and my plugin
> needs to be refactored).
> I adapt my plugin to work with other editors. Papyrus by the way it the
> new editor supported by the Eclipse foundation. The best approach
> seems to be a ResourceSetListener. At first glance it seems to remove a
> direct dependency on the editor used on the model. For that I need the
> TransactionalEditDomain. Following
> I first thought that the TransactionalEditDomain should be available
> via the Registry (this seems to be the preferred web for sharing the
> edit domain with other applications).
> I noticed that modifications on the UML model in the UML2 tree editor
> propagates changes in the Papyrus class diagram editor, and vice-versa.
> I thought that changes where propagated by such a listener.
> But as I understand, this is not possible to get the
> TransactionalEditDomain without an access on the editor. The
> ServiceRegistry holds the TransactionalEditDomain and it is linked with
> the Papyrus editor.
> So I should generate programmatically the Papyrus diagram file from my
> UML model, open an editor and retrieve the TransactionalEditingDomain
> from that editor ? Is there no simpler way for getting it ? The process
> for generating the diagram file seems to be rather complex...
Powered by FUDForum
. Page generated in 0.02364 seconds