Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
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 Go to next message
Jon Passki is currently offline Jon PasskiFriend
Messages: 31
Registered: November 2015
Member

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 Go to previous messageGo to next message
Jonas Helming is currently offline Jonas HelmingFriend
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 Go to previous messageGo to next message
Jon Passki is currently offline Jon PasskiFriend
Messages: 31
Registered: November 2015
Member

Jonas Helming wrote on Mon, 11 January 2016 19:48
Hi,

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 #1719790 is a reply to message #1719758] Tue, 12 January 2016 05:44 Go to previous messageGo to next message
Jonas Helming is currently offline Jonas HelmingFriend
Messages: 699
Registered: July 2009
Senior Member
Hi,

have you had a look at this:
http://eclipsesource.com/blogs/tutorials/emf-client-platform-core-api
(both sections)

Best regards

Jonas

Am 11.01.2016 um 21:12 schrieb Jon Passki:
> Jonas Helming wrote on Mon, 11 January 2016 19:48
>> Hi,
>>
>> 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.


--
--

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 #1719866 is a reply to message #1719790] Tue, 12 January 2016 17:28 Go to previous messageGo to next message
Jon Passki is currently offline Jon PasskiFriend
Messages: 31
Registered: November 2015
Member

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 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 Go to previous messageGo to next message
Jonas Helming is currently offline Jonas HelmingFriend
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/
Re: [ECP] Recommended way to observe for new objects added to projects [message #1720188 is a reply to message #1720066] Fri, 15 January 2016 05:50 Go to previous message
Jon Passki is currently offline Jon PasskiFriend
Messages: 31
Registered: November 2015
Member

Jonas Helming wrote on Thu, 14 January 2016 08:34
Hi,

yes, you only need to ensure that the ECPNotificationProvider is in you
run config.

Best regards



Thank you for the help and recommendations!
Previous Topic:[EMFStore] Versioning example
Next Topic:XSD1.1 to EMF : How could i simulate XSD Conditional Type Assignment
Goto Forum:
  


Current Time: Thu Apr 18 08:02:24 GMT 2024

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

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

Back to the top