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] |
Sat, 09 January 2016 19:30  |
Eclipse User |
|
|
|
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 14:48   |
Eclipse User |
|
|
|
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 #1720066 is a reply to message #1719866] |
Thu, 14 January 2016 03:34   |
Eclipse User |
|
|
|
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: Wed Jul 23 14:23:47 EDT 2025
Powered by FUDForum. Page generated in 0.05010 seconds
|