Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » How to listen to emf model
How to listen to emf model [message #211415] Fri, 10 March 2006 12:46 Go to next message
Eclipse UserFriend
Originally posted by: shruthi.cn.in.bosch.com

Hello everybody,

I want to use EMF model for developing a GEF editor.

In the GEF sample "org.eclipse.gef.examples.shapes_3.1.0", the model and
the editparts uses java.beans.PropertyChangeListener and
java.beans.PropertyChangeSupport for notification on changes in the
property.

Now, in the generated EMF model and EMF.Edit framework classes, i saw that
EMF model also notifies using EMF's eNotify and notifyChanged.
notifyChanged, in turn fires event using fireNotifyChanged method. I also
saw that there is a function addListeners in
XXXXXItemProviderAdapterFactory.java in EMF.Edit framework inside the
providers package.

How can i make the EditParts listen to emf model?

Could anybody give a sample code for this. May be some links for EMF-GEF
working together would also help me. But sample code would be the best.

Thank you very much
Best Regards
Shruthi
Re: How to listen to emf model [message #211424 is a reply to message #211415] Fri, 10 March 2006 12:51 Go to previous messageGo to next message
Richard Gronback is currently offline Richard GronbackFriend
Messages: 605
Registered: July 2009
Senior Member
Hello Shruthi,

Why not take a look at GMF? http://www.eclipse.org/gmf

- Rich

> Hello everybody,
>
> I want to use EMF model for developing a GEF editor.
>
> In the GEF sample "org.eclipse.gef.examples.shapes_3.1.0", the model
> and the editparts uses java.beans.PropertyChangeListener and
> java.beans.PropertyChangeSupport for notification on changes in the
> property.
>
> Now, in the generated EMF model and EMF.Edit framework classes, i saw
> that EMF model also notifies using EMF's eNotify and notifyChanged.
> notifyChanged, in turn fires event using fireNotifyChanged method. I
> also saw that there is a function addListeners in
> XXXXXItemProviderAdapterFactory.java in EMF.Edit framework inside the
> providers package.
>
> How can i make the EditParts listen to emf model?
>
> Could anybody give a sample code for this. May be some links for
> EMF-GEF working together would also help me. But sample code would be
> the best.
>
> Thank you very much
> Best Regards
> Shruthi
Re: How to listen to emf model [message #211696 is a reply to message #211415] Wed, 15 March 2006 11:51 Go to previous message
Thomas Maier is currently offline Thomas MaierFriend
Messages: 117
Registered: July 2009
Senior Member
Hi Shruthi,

probably a question for the emf group but I was glad that somebody
answered when I posted to the uml2 group :), so here are some hints for
you (but beware I am also a newbie trying to find things out):

Your listener must implement org.eclipse.emf.common.notify.Adapter

In Adapter, there is "public void notifyChanged(Notification n)". This
gets called when something changes. There you can switch on the feature id:
switch (n.getFeatureID(Classifier.class))
{
case UML2Package.PROPERTY__NAME:
refreshVisuals();
break;
... etc ...
}
(This example is specific to the uml2 stuff.)

Notification has methods to find out what has changed and the old and
new values.

You register your listener like this:
eobject.eAdapters().add(listener);

To remove it, call
eobject.eAdapters().remove(listener);

Hope that gets you going, Thomas.


Shruthi schrieb:
> Hello everybody,
>
> I want to use EMF model for developing a GEF editor.
> In the GEF sample "org.eclipse.gef.examples.shapes_3.1.0", the model and
> the editparts uses java.beans.PropertyChangeListener and
> java.beans.PropertyChangeSupport for notification on changes in the
> property.
>
> Now, in the generated EMF model and EMF.Edit framework classes, i saw
> that EMF model also notifies using EMF's eNotify and notifyChanged.
> notifyChanged, in turn fires event using fireNotifyChanged method. I
> also saw that there is a function addListeners in
> XXXXXItemProviderAdapterFactory.java in EMF.Edit framework inside the
> providers package.
>
> How can i make the EditParts listen to emf model?
> Could anybody give a sample code for this. May be some links for EMF-GEF
> working together would also help me. But sample code would be the best.
>
> Thank you very much
> Best Regards
> Shruthi
>
>
Previous Topic:right mouse click, mouse position
Next Topic:Does a Form with TableWrapLayout allow child FigureCanvas?
Goto Forum:
  


Current Time: Thu Dec 01 15:05:03 GMT 2022

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

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

Back to the top