|
Re: Register Listener on Editor Changes [message #1499819 is a reply to message #1499616] |
Fri, 05 December 2014 12:40 |
|
Hi,
What kinds of changes do you want to listen for? Opening and closing
of diagram pages? Changes within the diagrams? Changes to the UML
model content?
There are different listener protocols for all of these:
IPageLifecycleEventsListener attached to the editor's
ISashWindowsContainer adapter, various GEF/GMF APIs, and various
EMF/EMF-Transaction APIs plus IPapyrusListener, respectively.
Cheers,
Christian
On 2014-12-05 09:13:40 +0000, Grischa Liebel said:
> Hi,
>
> how can I register a listener on changes of Papyrus Editor content?
>
> I found
> org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IContentChangedListener,
> which sounds suitable.
> However, I can't find out how to register it from an external plugin.
> I don't want to write a new Editor, I just want to have a logging
> plugin which registers a listener on the existing diagram editor(s).
|
|
|
|
|
|
Re: Register Listener on Editor Changes [message #1552892 is a reply to message #1550760] |
Thu, 08 January 2015 11:31 |
|
You can find example directly about a plug-in that is used to make a revision of model. org.eclipse.papyrus\extraplugins\revision\org.eclipse.papyrus.revisiontool.
In the directory doc you have, a developer doc, and a model with requirements ,use cases, and design
Some explanation:
In order to make this job, what do want to listen?
- deletion about semantic element as UML for example?
- change in the diagram, for example change of position of class in a class diagram?
To add a listener, do this:
- Create a org.eclipse.emf.transaction.ResourceSetListener that you can attach to domain editing domain example line 527 of org.eclipse.papyrus.revision.tool.core.ReviewResourceManager
- You will receive all notifications graphical and semantic.
- If you want to filter semantic notification, add a test like this:
" if( reviewResourceManager.getWorkingModel().eResource().equals(notifier.eResource())){ " line72 of org.eclipse.papyrus.revision.tool.core.AddingDiffListener
o You need to compare from which resource the notifications are send.
In order to get the UML resource
You can write
"modelSet = getCurrentModelSet();
UmlModel IUMLModel=(UmlModel)modelSet.getModel(UmlModel.MODEL_ID);"
Line 377 org.eclipse.papyrus.revision.tool.core.ReviewResourceManager
|
|
|
|
Powered by
FUDForum. Page generated in 0.03000 seconds