Question about notification events [message #232704] |
Thu, 05 April 2007 12:25 |
Eclipse User |
|
|
|
Originally posted by: ayalandzhiev.sbnd.net
Hello I have a following problem for example there is an EditPart and
childs EditParts. My purpose is to catch when attribute of model for
child EditPart is changed one way is to add the method:
protected void handleNotificationEvent(Notification event) {
}
for every child EditPart but this solution is not good for me. I search
for way to catch this notification on ParentEditPart, that means is some
attribute of ChildEditPart model is changed to be able to manage it on
the ParentEditPart level.
Thanks in advance!
Regards,
Atanas.
|
|
|
Re: Question about notification events [message #232742 is a reply to message #232704] |
Fri, 06 April 2007 13:53 |
Eclipse User |
|
|
|
Originally posted by: ayalandzhiev.sbnd.net
I found the way if someone needs here is the code I have putted in the
parent EditPart code :
diagram = DiagramEventBroker.getInstance(getEditingDomain());
List list = getChildren();
Iterator iter = list.iterator();
GraphicalEditPart child = null;
while (iter.hasNext()) {
child = (GraphicalEditPart) iter.next();
MyListener lsitener = new MyListener();
EObject emfObject = (EObjectImpl) ((Node) child.getModel())
.getElement();
EStructuralFeature feature = emfObject.eClass()
.getEStructuralFeature("value");
diagram.addNotificationListener(emfObject, feature, lsitener);
After that lsitener is called on every change of attribute "value" for
child model of child's EditPart.
Atanas Yalandzhiev wrote:
> Hello I have a following problem for example there is an EditPart and
> childs EditParts. My purpose is to catch when attribute of model for
> child EditPart is changed one way is to add the method:
> protected void handleNotificationEvent(Notification event) {
> }
>
> for every child EditPart but this solution is not good for me. I search
> for way to catch this notification on ParentEditPart, that means is some
> attribute of ChildEditPart model is changed to be able to manage it on
> the ParentEditPart level.
>
> Thanks in advance!
>
> Regards,
> Atanas.
|
|
|
Powered by
FUDForum. Page generated in 0.04061 seconds