Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc) » [ECP] Recommended way to observe for new objects added to projects
[ECP] Recommended way to observe for new objects added to projects [message #1719613] |
Sun, 10 January 2016 00:30 |
|
Hello,
I'm very new to Eclipse, EMF, Xcore, and ECP. I'm using an Xcore model to generate an edit plugin. Using ECP, I can create a new project and add new elements to it. So far so good.
Given ECP, I want to know when a specific EClass instance is available (newly created on a project or opened from an existing project). My naive approach is to call ECPUtil.getECPProjectManager().getProjects(), iterate on each project and call its getContents(). This exposes individual root presumably EObjects, which could have EContentAdapters added to them. However, adding adding EContentAdapters to possibly large containment trees doesn't seem like a good idea according to EclipseSource's Dos and Don'ts #8. (I can't link to the article directly since I don't have enough messages yet...)
Is this the recommended / preferred way to identify when a specific EClass instance is available when working with an ECP project? If not, what's a better idiom?
Cheers!
|
|
|
Re: [ECP] Recommended way to observe for new objects added to projects [message #1719754 is a reply to message #1719613] |
Mon, 11 January 2016 19:48 |
Jonas Helming Messages: 699 Registered: July 2009 |
Senior Member |
|
|
Hi,
what exactly means "available". Do you want to listen to the event if a
new EObject is added to a project?
best regards
Jonas
Am 10.01.2016 um 01:30 schrieb Jon Passki:
> Hello,
>
> I'm very new to Eclipse, EMF, Xcore, and ECP. I'm using an Xcore model
> to generate an edit plugin. Using ECP, I can create a new project and
> add new elements to it. So far so good.
>
> Given ECP, I want to know when a specific EClass instance is available
> (newly created on a project or opened from an existing project). My
> naive approach is to call
> http://download.eclipse.org/ecp/releases/javadoc/org/eclipse/emf/ecp/core/util/ECPUtil.html#getECPProjectManager().http://download.eclipse.org/ecp/releases/javadoc/org/eclipse/emf/ecp/core/ECPProjectManager.html#getProjects(),
> iterate on each project and call its
> http://download.eclipse.org/ecp/releases/javadoc/org/eclipse/emf/ecp/core/ECPProject.html#getContents().
> This exposes individual root presumably EObjects, which could have
> http://download.eclipse.org/modeling/emf/emf/javadoc/2.11/org/eclipse/emf/ecore/util/EContentAdapter.html
> added to them. However, adding adding EContentAdapters to possibly large
> containment trees doesn't seem like a good idea according to
> EclipseSource's Dos and Don'ts #8. (I can't link to the article directly
> since I don't have enough messages yet...)
>
> Is this the recommended / preferred way to identify when a specific
> EClass instance is available when working with an ECP project? If not,
> what's a better idiom?
>
> Cheers!
--
--
Jonas Helming
Get professional Eclipse developer support:
http://eclipsesource.com/en/services/developer-support/
|
|
|
Re: [ECP] Recommended way to observe for new objects added to projects [message #1719758 is a reply to message #1719754] |
Mon, 11 January 2016 20:12 |
|
Jonas Helming wrote on Mon, 11 January 2016 19:48Hi,
what exactly means "available". Do you want to listen to the event if a
new EObject is added to a project?
When a project is created or opened, I want to know if instances of some EObject are available. I then want use these instances to populate some dynamic context menus. When a user selects one of these menus then I want to modify that EObject instance by updating it.
|
|
| |
Re: [ECP] Recommended way to observe for new objects added to projects [message #1719866 is a reply to message #1719790] |
Tue, 12 January 2016 17:28 |
|
Jonas Helming wrote on Tue, 12 January 2016 05:44Hi,
have you had a look at this:
[EMF Client Platform Core API]
(both sections)
Yes, I've looked at that page a handful of times, more so the "Listening to EMF Client Platform Events" section. Re-reading the first section of the tutorial, I wouldn't need to implement a NotificationProvider, since it seems that would be already handled by my use of EMFStore and the ECPNotificationProvider, correct? I should then inject ChangeBroker and call subscribeToEClass with a custom ChangeObserver, correct?
Cheers!
|
|
|
Re: [ECP] Recommended way to observe for new objects added to projects [message #1720066 is a reply to message #1719866] |
Thu, 14 January 2016 08:34 |
Jonas Helming Messages: 699 Registered: July 2009 |
Senior Member |
|
|
Hi,
yes, you only need to ensure that the ECPNotificationProvider is in you
run config.
Best regards
Jonas
Am 12.01.2016 um 18:28 schrieb Jon Passki:
> Jonas Helming wrote on Tue, 12 January 2016 05:44
>> Hi,
>>
>> have you had a look at this:
>> [EMF Client Platform Core API]
>> (both sections)
>
>
> Yes, I've looked at that page a handful of times, more so the "Listening
> to EMF Client Platform Events" section. Re-reading the first section of
> the tutorial, I wouldn't need to implement a NotificationProvider, since
> it seems that would be already handled by my use of EMFStore and the
> ECPNotificationProvider, correct? I should then inject
> http://download.eclipse.org/ecp/releases/javadoc/org/eclipse/emf/ecp/changebroker/spi/ChangeBroker.html
> and call subscribeToEClass with a custom
> http://download.eclipse.org/ecp/releases/javadoc/org/eclipse/emf/ecp/changebroker/spi/ChangeObserver.html,
> correct?
>
> Cheers!
>
--
--
Jonas Helming
Get professional Eclipse developer support:
http://eclipsesource.com/en/services/developer-support/
|
|
| |
Goto Forum:
Current Time: Thu Apr 25 11:54:37 GMT 2024
Powered by FUDForum. Page generated in 0.02768 seconds
|