Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » EObject does not send Notification.SET
EObject does not send Notification.SET [message #1770485] Sat, 12 August 2017 13:47 Go to next message
Ralph Soika is currently offline Ralph SoikaFriend
Messages: 192
Registered: July 2009
Senior Member
Hi,

I have implemented a custom value object where the content of a Value EObject will be wrapped into a CDATA element. My class extends the MinimalEObjectImpl.Container.

It works fine. But my problem is, that my object did not send any Notifications if the value changed.
So as a result my other classes (Part of Eclipse BPMN2) will not receive a Notification.SET event if the value is changed. So I guess I have missed something in my implementation. I am not too familiar with EMF so I can't see where the problem is located.
Did I need to register my class for notifications?

The Code of the setValue() method looks like this:
....
	@Override
	public void setValue(String newValue) {
		
		// do not allow null values!
		if (newValue==null) {
			newValue="";
		}
		
		getMixed().clear();

		FeatureMap.Entry cdata = null;

		// try to get the container Item EObject to determine the type
		Item item = (Item) this.eContainer;
		if (item != null && "xs:boolean".equals(item.getType())) {
			cdata = FeatureMapUtil.createTextEntry(newValue);
		} else {
			// default will wrap the value into a CDATA entry
			cdata = FeatureMapUtil.createCDATAEntry(newValue);
		}
		getMixed().add(cdata);
	}
	@Override
	public void eSet(int featureID, Object newValue) {
		
		switch (featureID) {
		case ModelPackage.VALUE__MIXED:
			((FeatureMap.Internal) getMixed()).set(newValue);
			return;
		case ModelPackage.VALUE__VALUE:
			setValue((String) newValue);
			return;
		}
		super.eSet(featureID, newValue);
	}
.....


The complete class can be seen here:

https://github.com/imixs/imixs-bpmn/blob/master/org.imixs.eclipse.bpmn2.plugin/src/org/imixs/bpmn/model/impl/ValueImpl.java

Thanks for any help in advance.

===
Ralph
Re: EObject does not send Notification.SET [message #1770491 is a reply to message #1770485] Sat, 12 August 2017 16:37 Go to previous message
Ralph Soika is currently offline Ralph SoikaFriend
Messages: 192
Registered: July 2009
Senior Member
It looks like the problem was my Adapter Class. I extended my Adapter from 'org.eclipse.emf.common.notify.impl.AdapterImpl'
After I changed this base class to 'org.eclipse.emf.ecore.util.EContentAdapter' all notifications about changes in my model occur! :-)
Previous Topic:EAnnotation usage in ecore
Next Topic:Derived unions and subsetted properties in UML to Ecore converter
Goto Forum:
  


Current Time: Thu Apr 25 20:06:15 GMT 2024

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

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

Back to the top