Skip to main content



      Home
Home » Modeling » Papyrus » Register Listener on Editor Changes
Register Listener on Editor Changes [message #1499616] Fri, 05 December 2014 04:13 Go to next message
Eclipse UserFriend
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 #1499819 is a reply to message #1499616] Fri, 05 December 2014 07:40 Go to previous messageGo to next message
Eclipse UserFriend
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 #1503130 is a reply to message #1499819] Mon, 08 December 2014 02:25 Go to previous messageGo to next message
Eclipse UserFriend
Ideally, I would like to log changes on the diagrams.
That is, adding, removing, changing and moving of diagram elements.

That's why IContentChangedListener sounded good, as it has these change types defined.
Re: Register Listener on Editor Changes [message #1511856 is a reply to message #1503130] Mon, 15 December 2014 03:13 Go to previous messageGo to next message
Eclipse UserFriend
Anyone?
Re: Register Listener on Editor Changes [message #1550760 is a reply to message #1511856] Wed, 07 January 2015 02:54 Go to previous messageGo to next message
Eclipse UserFriend
Would be great if anyone could give me a pointer! Rolling Eyes
Re: Register Listener on Editor Changes [message #1552892 is a reply to message #1550760] Thu, 08 January 2015 06:31 Go to previous messageGo to next message
Eclipse UserFriend
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
Re: Register Listener on Editor Changes [message #1554424 is a reply to message #1552892] Fri, 09 January 2015 02:22 Go to previous message
Eclipse UserFriend
Thanks a lot, Patrick!
This looks reasonable. I will come back here once I've tried it Smile
Previous Topic:<<use>> not displayed
Next Topic:Changing icon in stereotype according to several attributes
Goto Forum:
  


Current Time: Sun Jul 27 09:20:09 EDT 2025

Powered by FUDForum. Page generated in 0.04202 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top