Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Why Notification.getOldValue() don't contains any children
Why Notification.getOldValue() don't contains any children [message #208027] Wed, 08 October 2008 09:28 Go to next message
Feng(Marvin) Wang is currently offline Feng(Marvin) WangFriend
Messages: 3
Registered: July 2009
Junior Member
Hi gmf guys,

I would like to ask a question. please see the following code:

public class MyEditPart extends DiagramEditPart {
.......
@Override
protected void handleNotificationEvent(Notification event) {
Component component = (Component) event.getOldValue();
//why list.size=0? infact the component contains some children
EList<Component> list=component.getChildern();
}
}

When I delete a EObject (that is Component) from the generated diagram
editor, why cannot I retrive any children of the EObject?

Thanks in advance.
Feng
Re: Why Notification.getOldValue() don't contains any children [message #208089 is a reply to message #208027] Wed, 08 October 2008 12:50 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cdamus.zeligsoft.com

Hi, Feng,

When GMF deletes an object from the model, it doesn't just remove its
sub-tree of EObjects from its container, but applies that process
recursively. The Delete{EObject,Element}Command completely
disaggregates the the deleted object and removes all cross-references,
even those within the deleted sub-tree.

So, your deleted object's children must be found by scanning the
Notifications for events indicating objects removed from it. These
*were* its children.

HTH,

Christian

Feng(Marvin) Wang wrote:
> Hi gmf guys,
>
> I would like to ask a question. please see the following code:
>
> public class MyEditPart extends DiagramEditPart {
> ......
> @Override
> protected void handleNotificationEvent(Notification event) {
> Component component = (Component) event.getOldValue();
> //why list.size=0? infact the component contains some children
> EList<Component> list=component.getChildern();
> }
> }
>
> When I delete a EObject (that is Component) from the generated diagram
> editor, why cannot I retrive any children of the EObject?
>
> Thanks in advance.
> Feng
>
>
Re: Why Notification.getOldValue() don't contains any children [message #208128 is a reply to message #208089] Thu, 09 October 2008 02:29 Go to previous messageGo to next message
Feng(Marvin) Wang is currently offline Feng(Marvin) WangFriend
Messages: 3
Registered: July 2009
Junior Member
Hi Christian,

Thank you for you kindly answer. How can I get ResourceSetChangeEvent and
scanning it? My scenario is that, when I delete a model in the diagram
editor, I will do something in the handleNotificationEvent method of the
according EditPart.

@Override

protected void handleNotificationEvent(Notification notification) {

super.handleNotificationEvent(notification);

.

}



But if I delete a parent model, its children's EditPart will not be
notified.

I find that DiagramEventBroker will not fireNotification if the model is
deleted by deleting its parent model.



Thanks,

Feng


"Christian W. Damus" <cdamus@zeligsoft.com> wrote in message
news:gcia9t$1k2$1@build.eclipse.org...
> Hi, Feng,
>
> When GMF deletes an object from the model, it doesn't just remove its
> sub-tree of EObjects from its container, but applies that process
> recursively. The Delete{EObject,Element}Command completely disaggregates
> the the deleted object and removes all cross-references, even those within
> the deleted sub-tree.
>
> So, your deleted object's children must be found by scanning the
> Notifications for events indicating objects removed from it. These *were*
> its children.
>
> HTH,
>
> Christian
>
> Feng(Marvin) Wang wrote:
>> Hi gmf guys,
>>
>> I would like to ask a question. please see the following code:
>>
>> public class MyEditPart extends DiagramEditPart {
>> ......
>> @Override
>> protected void handleNotificationEvent(Notification event) {
>> Component component = (Component) event.getOldValue();
>> //why list.size=0? infact the component contains some children
>> EList<Component> list=component.getChildern();
>> }
>> }
>>
>> When I delete a EObject (that is Component) from the generated diagram
>> editor, why cannot I retrive any children of the EObject?
>>
>> Thanks in advance.
>> Feng
Re: Why Notification.getOldValue() don't contains any children [message #208173 is a reply to message #208128] Thu, 09 October 2008 14:56 Go to previous message
Eclipse UserFriend
Originally posted by: cdamus.zeligsoft.com

Hi, Feng,

Sorry, I'm not sufficiently familiar with the diagram framework's
handling of events to be able to answer usefully.

Perhaps an expert from the GMF run-time team will respond.

Cheers,

Christian

Feng(Marvin) Wang wrote:
> Hi Christian,
>
> Thank you for you kindly answer. How can I get ResourceSetChangeEvent and
> scanning it? My scenario is that, when I delete a model in the diagram
> editor, I will do something in the handleNotificationEvent method of the
> according EditPart.
>
> @Override
>
> protected void handleNotificationEvent(Notification notification) {
>
> super.handleNotificationEvent(notification);
>
> .
>
> }
>
>
>
> But if I delete a parent model, its children's EditPart will not be
> notified.
>
> I find that DiagramEventBroker will not fireNotification if the model is
> deleted by deleting its parent model.
>
>
>
> Thanks,
>
> Feng
>
>
> "Christian W. Damus" <cdamus@zeligsoft.com> wrote in message
> news:gcia9t$1k2$1@build.eclipse.org...
>> Hi, Feng,
>>
>> When GMF deletes an object from the model, it doesn't just remove its
>> sub-tree of EObjects from its container, but applies that process
>> recursively. The Delete{EObject,Element}Command completely disaggregates
>> the the deleted object and removes all cross-references, even those within
>> the deleted sub-tree.
>>
>> So, your deleted object's children must be found by scanning the
>> Notifications for events indicating objects removed from it. These *were*
>> its children.
>>
>> HTH,
>>
>> Christian
>>
>> Feng(Marvin) Wang wrote:
>>> Hi gmf guys,
>>>
>>> I would like to ask a question. please see the following code:
>>>
>>> public class MyEditPart extends DiagramEditPart {
>>> ......
>>> @Override
>>> protected void handleNotificationEvent(Notification event) {
>>> Component component = (Component) event.getOldValue();
>>> //why list.size=0? infact the component contains some children
>>> EList<Component> list=component.getChildern();
>>> }
>>> }
>>>
>>> When I delete a EObject (that is Component) from the generated diagram
>>> editor, why cannot I retrive any children of the EObject?
>>>
>>> Thanks in advance.
>>> Feng
>
>
Previous Topic:Selection Listener
Next Topic:Multiple Column
Goto Forum:
  


Current Time: Tue Apr 16 14:38:30 GMT 2024

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

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

Back to the top