Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » Strange behaviour of EContentAdapter
Strange behaviour of EContentAdapter [message #716943] Thu, 18 August 2011 21:07 Go to next message
Georg G. is currently offline Georg G.Friend
Messages: 4
Registered: August 2011
Junior Member
Hello,

I have a weird problem concerning the registration of adapters.
I do as follows:
In a GEF EditPart I add:
private final EContentAdapter adapter = new EContentAdapter() {
		public void notifyChanged(Notification notification) {
		System.out.println("Notfication received from the data model. Data model has changed!!!");
		}
	};


then I add the two methods to register the adapter which it actually does (I debugged it):
        /** {@inheritDoc} */
	@Override
	public void activate() {
		super.activate();
		signal.eAdapters().add(adapter);
	}

	/** {@inheritDoc} */
	@Override
	public void deactivate() {
		super.activate();
		signal.eAdapters().remove(adapter);
	}


In a properties view I then edit the model via binding:
bindingContext.bindValue(
				WidgetProperties.text(SWT.Modify).observe(control),
				EMFProperties.value(feature).observe(observable));

The model is indeed changed because if I close the editor with the editPart and reopen it the values have changed. BUT the notifyChange method is never invoked. WHY????

Any help is appreciated!
Re: Strange behaviour of EContentAdapter [message #716983 is a reply to message #716943] Thu, 18 August 2011 23:42 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Georg,

Comments below.

On 18/08/2011 2:07 PM, Georg G. wrote:
> Hello,
>
> I have a weird problem concerning the registration of adapters.
> I do as follows:
> In a GEF EditPart I add:
> private final EContentAdapter adapter = new EContentAdapter() {
> public void notifyChanged(Notification notification) {
> System.out.println("Notfication received from the data model.
> Data model has changed!!!");
You're not calling super and that's really important for the content
adapter to adapt to changes made to the content.
> }
> };
>
> then I add the two methods to register the adapter which it actually
> does (I debugged it):
>
> /** {@inheritDoc} */
> @Override
> public void activate() {
> super.activate();
> signal.eAdapters().add(adapter);
> }
>
> /** {@inheritDoc} */
> @Override
> public void deactivate() {
> super.activate();
> signal.eAdapters().remove(adapter);
> }
>
> In a properties view I then edit the model via binding:
> bindingContext.bindValue(
> WidgetProperties.text(SWT.Modify).observe(control),
> EMFProperties.value(feature).observe(observable));
> The model is indeed changed because if I close the editor with the
> editPart and reopen it the values have changed. BUT the notifyChange
> method is never invoked. WHY????
Is signal the root container of all objects involved?
>
> Any help is appreciated!


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:Get started with EMF Facet
Next Topic:[Texo] Questions on Data Generator Feature
Goto Forum:
  


Current Time: Thu Apr 25 14:15:24 GMT 2024

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

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

Back to the top