Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Papyrus » Register Listener on Editor Changes
Register Listener on Editor Changes [message #1499616] Fri, 05 December 2014 09:13 Go to next message
Grischa Liebel is currently offline Grischa LiebelFriend
Messages: 14
Registered: October 2014
Junior Member
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 12:40 Go to previous messageGo to next message
Christian Damus is currently offline Christian DamusFriend
Messages: 1207
Registered: July 2009
Location: Canada
Senior Member

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 07:25 Go to previous messageGo to next message
Grischa Liebel is currently offline Grischa LiebelFriend
Messages: 14
Registered: October 2014
Junior Member
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 08:13 Go to previous messageGo to next message
Grischa Liebel is currently offline Grischa LiebelFriend
Messages: 14
Registered: October 2014
Junior Member
Anyone?
Re: Register Listener on Editor Changes [message #1550760 is a reply to message #1511856] Wed, 07 January 2015 07:54 Go to previous messageGo to next message
Grischa Liebel is currently offline Grischa LiebelFriend
Messages: 14
Registered: October 2014
Junior Member
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 11:31 Go to previous messageGo to next message
Patrick Tessier is currently offline Patrick TessierFriend
Messages: 246
Registered: July 2009
Location: Paris Saclay, France
Senior Member
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 07:22 Go to previous message
Grischa Liebel is currently offline Grischa LiebelFriend
Messages: 14
Registered: October 2014
Junior Member
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: Mon Aug 10 20:06:50 GMT 2020

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

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

Back to the top