Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » EMF Forms notification in e4
EMF Forms notification in e4 [message #1704914] Mon, 10 August 2015 17:18 Go to next message
Alexander Zavodnikov is currently offline Alexander ZavodnikovFriend
Messages: 14
Registered: August 2015
Junior Member
Hi

I wonder how we can subscribe to notification in EMF Forms (or just EMF) - do we need to write adapters and add them to everey EObject like this: eObj.eAdapters().add(myLsitener)?

How to use e4 eventing system, so the handler execution will be triggered? Or what is the recommended way to be notified of model changes coming from EMF Froms part in my custom part?

is it to much for EMF Forms community to provide working CRUD sample? Always I only find snippets and have no idea o the big picture... How can I get this? All the books all outdated, the frameworks docs are incomplete - do I need to join some confidential alliance to get this?

Thanks in advance



Re: EMF Forms notification in e4 [message #1704938 is a reply to message #1704914] Tue, 11 August 2015 00:32 Go to previous messageGo to next message
Alexander Zavodnikov is currently offline Alexander ZavodnikovFriend
Messages: 14
Registered: August 2015
Junior Member
I answer my own question which was way unrelaxed...

No EMF does not propagate events to e4 brokers.
Probably it is not to complex to setup on top of EMF if you want.

CRUD sample is provided, just search for org.eclipse.example.bowling.tutorial in web
Re: EMF Forms notification in e4 [message #1705003 is a reply to message #1704938] Tue, 11 August 2015 11:39 Go to previous messageGo to next message
Jonas Helming is currently offline Jonas HelmingFriend
Messages: 699
Registered: July 2009
Senior Member
Hi,

I would rather not publish domain model changes using the default event
bus. The EMF Client Platform provides a EMF specific change broker,
which allows to get notified about changes in a more comfortable way
than implementing Adapters.

Best regards

Jonas

Am 11.08.2015 um 02:32 schrieb Alexander Zavodnikov:
> I answer my own question which was way unrelaxed...
>
> No EMF does not propagate events to e4 brokers.
> Probably it is not to complex to setup on top of EMF if you want.
>
> CRUD sample is provided, just search for
> org.eclipse.example.bowling.tutorial in web
>


--
--

Jonas Helming

Get professional Eclipse developer support:

http://eclipsesource.com/en/services/developer-support/
Re: EMF Forms notification in e4 [message #1705015 is a reply to message #1705003] Tue, 11 August 2015 12:43 Go to previous messageGo to next message
Alexander Zavodnikov is currently offline Alexander ZavodnikovFriend
Messages: 14
Registered: August 2015
Junior Member
Many thanks for pointing, Jonas!

Are you talking about ECPObservers?
I downloaded the latest Eclipse Modeling Package. It includes EMF Forms which is based on ECP (or it is not?) and there are no ECPObserver classes. So I tought it is deprecated stuff...
What bundle does provide the classes?

Or do you mean something different?

Anyway, please provide a line of code demonstrating how to subscribe for those events.

Best regards
Alexander

[Updated on: Tue, 11 August 2015 12:46]

Report message to a moderator

Re: EMF Forms notification in e4 [message #1705027 is a reply to message #1705015] Tue, 11 August 2015 13:55 Go to previous messageGo to next message
Alexander Zavodnikov is currently offline Alexander ZavodnikovFriend
Messages: 14
Registered: August 2015
Junior Member
I found the bundle and added following code at the bottom of ModelEditor.init(IEditorSite, IEditorInput):

ECPUtil.getECPObserverBus().register(new ECPProjectContentChangedObserver() {
@Override
public Collection<Object> objectsChanged(ECPProject project, Collection<Object> objects) {
return null;
}
});

The registering works, the observer goes into the map of ECPObserverBus.
But the callback method gets never called if I change the model .
No errors or warnings... do I miss something?

[Updated on: Tue, 11 August 2015 16:19]

Report message to a moderator

Re: EMF Forms notification in e4 [message #1705106 is a reply to message #1705015] Wed, 12 August 2015 07:34 Go to previous messageGo to next message
Jonas Helming is currently offline Jonas HelmingFriend
Messages: 699
Registered: July 2009
Senior Member
Hi,

the component is not yet part of our SDK and therefore not part of the
Mars release. It is hosted at our target update site
(http://www.eclipse.org/ecp/emfforms/download.html)

The name of the bus itself is ChangeBroker, it is registered as an OSGi
service.

To make the broker work, it needs a running instance of an
NotificationProvider, which pushes all notfications to the broker. See
the existing implementations for examples. I will probably blog about
this component, soon.

Best regards

Jonas


Am 11.08.2015 um 14:43 schrieb Alexander Zavodnikov:
> Many thanks for pointing, Jonas!
>
> Are you talking about ECPObservers?
> I downloaded the latest Eclipse Modeling Package. It includes EMF Forms
> which is based on ECP (or it is not?) and there are no ECPObserver
> classes. So I tought it is deprecated stuff...
>
> Or do yout mean something different?
>
> Anyway, please provide a line of code demonstrating how to subscribe to
> those events.
>
> Best regards
> Alexander
>
>


--
--

Jonas Helming

Get professional Eclipse developer support:

http://eclipsesource.com/en/services/developer-support/
Re: EMF Forms notification in e4 [message #1705152 is a reply to message #1705106] Wed, 12 August 2015 13:23 Go to previous messageGo to next message
Alexander Zavodnikov is currently offline Alexander ZavodnikovFriend
Messages: 14
Registered: August 2015
Junior Member
Hi Jonas

do you mean this blog? http://eclipsesource.com/blogs/author/jhelming/

please post here a short once you are done

Is org.eclipse.emf.ecp.changebroker plugin the only thing needed to provide functionality without EMFStore?

[Updated on: Wed, 12 August 2015 17:03]

Report message to a moderator

Re: EMF Forms notification in e4 [message #1705242 is a reply to message #1705152] Thu, 13 August 2015 08:38 Go to previous messageGo to next message
Jonas Helming is currently offline Jonas HelmingFriend
Messages: 699
Registered: July 2009
Senior Member
Hi,

are you sure, you are using the "target platform" update site?

Should be under "EMF Client Platform Features"

Best regards

Jonas

Am 12.08.2015 um 15:23 schrieb Alexander Zavodnikov:
> Hi Jonas
>
> thank you, please post URL of your blog here when you are done with
> this article.
> I can't find org.eclipse.emf.ecp.changebroker feature in 1.6.1 downloads.
> Are you sure it is there, maybe it is planned for 1.7 release?
>
> Best regards
> Alexander


--
--

Jonas Helming

Get professional Eclipse developer support:

http://eclipsesource.com/en/services/developer-support/
Re: EMF Forms notification in e4 [message #1708931 is a reply to message #1705242] Tue, 22 September 2015 14:29 Go to previous messageGo to next message
Alexander Zavodnikov is currently offline Alexander ZavodnikovFriend
Messages: 14
Registered: August 2015
Junior Member
You suggest to use some undocumented things (maybe they're experimental and disappear in next minor release). I don't think developers having to deliver reliable solutions go this way.

...anyway, setting adapter on each and every object is sappy for large object graphs, which are not uncommon for industry-level applications.

Anybody another suggestion?

[Updated on: Tue, 22 September 2015 18:58]

Report message to a moderator

Re: EMF Forms notification in e4 [message #1709015 is a reply to message #1708931] Wed, 23 September 2015 10:14 Go to previous messageGo to next message
Jonas Helming is currently offline Jonas HelmingFriend
Messages: 699
Registered: July 2009
Senior Member
Hi Alexander,

You had a question about EMF notifications initially and about a good
way of dealing with them. So if you want to listen to all changes in a
model instance, you can use a EContentAdapter (provided by EMF). An
alternative would be the ChangeBroker I mentioned. The broker uses the
EContentAdapter to retrieve notifications internally anyways, so it is
basically just another more comfortable API to do the same thing. As an
example, it allows for filtering the event you want to be notified about
already during the registration.

As I also mentioned, the Changebroker is not yet part of the EMF Client
Platform SDK, so we do not consider this to be a core feature yet. That
is why we did not blog about it yet. As I also mentioned, I will
probably blog about it soon as part of introducing the 1.7.0 release,
but I do not have a defined date for that blog post, yet.

You answer sounds pretty angry. Insulting people, who work on a
framework that you might use completely for free and being angry at
people who try to help you in a support forum without charging for that
does usually not help you getting better support. Sorry to say that so
clear.

If you need guaranteed support with defined response times, you need to
get professional support. If you need a new feature to be available in a
certain release, you should consider sponsored development. We and most
other companies active in this forum offer this as a service.

As you might have noticed, you also get help, if you do not pay for
that, as for example all questions in this forum are usually answered
within a single day. Also most committer teams fix critical bugs without
charging for that and even develop new features. However, that is really
on a voluntary basis.

I hope I could help.

Best regards

Jonas

Am 22.09.2015 um 16:29 schrieb Alexander Zavodnikov:
> ..nothing - no blog and no other docs.. are you dammin serious?
> What is your hope regarding user acceptance for EMF Forms? You suggest
> to use some undocumented, maybe experimental things, which may
> disappear in next minor release...
> Do you really think that developers, which have do deliver reliable
> solutions go this way? ...laughable


--
--

Jonas Helming

Get professional Eclipse developer support:

http://eclipsesource.com/en/services/developer-support/
Re: EMF Forms notification in e4 [message #1709020 is a reply to message #1709015] Wed, 23 September 2015 11:16 Go to previous message
Alexander Zavodnikov is currently offline Alexander ZavodnikovFriend
Messages: 14
Registered: August 2015
Junior Member
...thanks for answering

I noticed well, that it's all for free... but there are other frameworks for free, too. And somehow they do most things better. Again, it's only my opinion. Please don't take my negativity into account, It's my own problem... and for the record: up to now i donated 30€ to Eclipse, so I am not that kind of people...

...the solution is simple:

       private AdapterImpl changeListener = new AdapterImpl() {
		@Override
		public void notifyChanged(final Notification msg) {
			// react on changes
		}
	};
	
	private void addChangeListener(EObject eObj) {
		eObj.eAdapters().add(changeListener);
		for (EObject e : eObj.eContents()) {
			addChangeListener(e);
		}
	}

then you can do:

addChangeListener(root);

[Updated on: Sat, 26 September 2015 16:06]

Report message to a moderator

Previous Topic:EMF Import project/child from an XML file
Next Topic:[CDO/Net4j] OutOfMemoryError: Direct buffer memory
Goto Forum:
  


Current Time: Thu Apr 25 07:33:59 GMT 2024

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

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

Back to the top