Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » DiagramUpdateCommand
DiagramUpdateCommand [message #190677] Tue, 03 June 2008 12:53 Go to next message
Eclipse UserFriend
Originally posted by: martinschmidt.83.web.de

In the previous post "Refresh all the diagram" i saw this:

Hello Matthias,

If you are trying to perform the same action as F5 does then you can have
a look on generated ???DiagramUpdateCommand.

-----------------
Alex Shatalin



Can somebody give me an code example how to use DiagramUpdateCommand?
I
Re: DiagramUpdateCommand [message #190693 is a reply to message #190677] Tue, 03 June 2008 13:39 Go to previous messageGo to next message
Richard Gronback is currently offline Richard GronbackFriend
Messages: 605
Registered: July 2009
Senior Member
You can try something like this:

@Override
protected void handleNotificationEvent(Notification notification) {
int type = notification.getEventType();
Object feature = notification.getFeature();
if (MindmapPackage.eINSTANCE.getTopic_Subtopics().equals(featur e) &&
(type == Notification.ADD || type == Notification.REMOVE)) {
CanonicalEditPolicy canonicalEditPolicy = (CanonicalEditPolicy)
getParent().getEditPolicy(EditPolicyRoles.CANONICAL_ROLE);
canonicalEditPolicy.refresh();
}
super.handleNotificationEvent(notification);
}

Best,
Rich


On 6/3/08 8:53 AM, in article g23esd$nh2$2@build.eclipse.org, "Martin
Schmidt" <martinschmidt.83@web.de> wrote:

> In the previous post "Refresh all the diagram" i saw this:
>
> Hello Matthias,
>
> If you are trying to perform the same action as F5 does then you can have
> a look on generated ???DiagramUpdateCommand.
>
> -----------------
> Alex Shatalin
>
>
>
> Can somebody give me an code example how to use DiagramUpdateCommand?
> I´m trying to update my whole diagram after i did some model changes when a
> reference of an element was changed. So i overwrite method
> "handleNotificationEvent" in my figures EditPart:
>
> @Override
>
> protected void handleNotificationEvent(Notification notification) {
>
>
> if (notification.getFeature() instanceof EReferenceImpl){
>
> if
>
(((EReferenceImpl)notification.getFeature()).getName().equal s( "reference_to"))>
{
>
> ..... // doing something with my model
>
> //here it want to update my diagram
>
>
> }
>
> }
>
>
> super.handleNotificationEvent(notification);
>
> }
>
>
>
> Thanks a lot in advance,
>
> Martin
>
>
>
Re: DiagramUpdateCommand [message #190701 is a reply to message #190693] Tue, 03 June 2008 14:14 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: martinschmidt.83.web.de

great. works fantastic!!! Thank You!!!
"Richard Gronback" <richard.gronback@borland.com> schrieb im Newsbeitrag
news:C46AC1EA.E3FF%richard.gronback@borland.com...
> You can try something like this:
>
> @Override
> protected void handleNotificationEvent(Notification notification) {
> int type = notification.getEventType();
> Object feature = notification.getFeature();
> if (MindmapPackage.eINSTANCE.getTopic_Subtopics().equals(featur e)
> &&
> (type == Notification.ADD || type == Notification.REMOVE)) {
> CanonicalEditPolicy canonicalEditPolicy = (CanonicalEditPolicy)
> getParent().getEditPolicy(EditPolicyRoles.CANONICAL_ROLE);
> canonicalEditPolicy.refresh();
> }
> super.handleNotificationEvent(notification);
> }
>
> Best,
> Rich
>
>
> On 6/3/08 8:53 AM, in article g23esd$nh2$2@build.eclipse.org, "Martin
> Schmidt" <martinschmidt.83@web.de> wrote:
>
>> In the previous post "Refresh all the diagram" i saw this:
>>
>> Hello Matthias,
>>
>> If you are trying to perform the same action as F5 does then you can have
>> a look on generated ???DiagramUpdateCommand.
>>
>> -----------------
>> Alex Shatalin
>>
>>
>>
>> Can somebody give me an code example how to use DiagramUpdateCommand?
>> I
Re: DiagramUpdateCommand [message #190744 is a reply to message #190701] Tue, 03 June 2008 16:26 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: matthias.schmidt.xactium.com

Hello,

I'm trying that as well at the minute and I got stuck.
Looks like MyPackage.eINSTANCE.getTopic_Subtopics().equals(feature)
doesn't work for me because the methode getTopic_Subtopics() doesn't
exist. Does anybody know, what I'm doing work here?

And another question. Does this approach provide me with full history
support? As refreshing the diagram the way I do it currently, leads to
exceptions when using the undo facility.

Cheers,
Matthias




Martin Schmidt wrote:
> great. works fantastic!!! Thank You!!!
> "Richard Gronback" <richard.gronback@borland.com> schrieb im Newsbeitrag
> news:C46AC1EA.E3FF%richard.gronback@borland.com...
>> You can try something like this:
>>
>> @Override
>> protected void handleNotificationEvent(Notification notification) {
>> int type = notification.getEventType();
>> Object feature = notification.getFeature();
>> if (MindmapPackage.eINSTANCE.getTopic_Subtopics().equals(featur e)
>> &&
>> (type == Notification.ADD || type == Notification.REMOVE)) {
>> CanonicalEditPolicy canonicalEditPolicy = (CanonicalEditPolicy)
>> getParent().getEditPolicy(EditPolicyRoles.CANONICAL_ROLE);
>> canonicalEditPolicy.refresh();
>> }
>> super.handleNotificationEvent(notification);
>> }
>>
>> Best,
>> Rich
>>
>>
>> On 6/3/08 8:53 AM, in article g23esd$nh2$2@build.eclipse.org, "Martin
>> Schmidt" <martinschmidt.83@web.de> wrote:
>>
>>> In the previous post "Refresh all the diagram" i saw this:
>>>
>>> Hello Matthias,
>>>
>>> If you are trying to perform the same action as F5 does then you can have
>>> a look on generated ???DiagramUpdateCommand.
>>>
>>> -----------------
>>> Alex Shatalin
>>>
>>>
>>>
>>> Can somebody give me an code example how to use DiagramUpdateCommand?
>>> I´m trying to update my whole diagram after i did some model changes when
>>> a
>>> reference of an element was changed. So i overwrite method
>>> "handleNotificationEvent" in my figures EditPart:
>>>
>>> @Override
>>>
>>> protected void handleNotificationEvent(Notification notification) {
>>>
>>>
>>> if (notification.getFeature() instanceof EReferenceImpl){
>>>
>>> if
>>>
>> (((EReferenceImpl)notification.getFeature()).getName().equal s( "reference_to"))>
>> {
>>> ..... // doing something with my model
>>>
>>> //here it want to update my diagram
>>>
>>>
>>> }
>>>
>>> }
>>>
>>>
>>> super.handleNotificationEvent(notification);
>>>
>>> }
>>>
>>>
>>>
>>> Thanks a lot in advance,
>>>
>>> Martin
>>>
>>>
>>>
>
>
Re: DiagramUpdateCommand [message #190751 is a reply to message #190744] Tue, 03 June 2008 16:39 Go to previous messageGo to next message
Richard Gronback is currently offline Richard GronbackFriend
Messages: 605
Registered: July 2009
Senior Member
You'll need to use a method from your model, that which returns the feature
you're interested in. The method getTopic_Subtopics() is from the mindmap
domain model.

I've never noticed any problems with undo following a diagram update.

Best,
Rich


On 6/3/08 12:26 PM, in article g23rc3$ht2$1@build.eclipse.org, "Matthias
Schmidt" <matthias.schmidt@xactium.com> wrote:

> Hello,
>
> I'm trying that as well at the minute and I got stuck.
> Looks like MyPackage.eINSTANCE.getTopic_Subtopics().equals(feature)
> doesn't work for me because the methode getTopic_Subtopics() doesn't
> exist. Does anybody know, what I'm doing work here?
>
> And another question. Does this approach provide me with full history
> support? As refreshing the diagram the way I do it currently, leads to
> exceptions when using the undo facility.
>
> Cheers,
> Matthias
>
>
>
>
> Martin Schmidt wrote:
>> great. works fantastic!!! Thank You!!!
>> "Richard Gronback" <richard.gronback@borland.com> schrieb im Newsbeitrag
>> news:C46AC1EA.E3FF%richard.gronback@borland.com...
>>> You can try something like this:
>>>
>>> @Override
>>> protected void handleNotificationEvent(Notification notification) {
>>> int type = notification.getEventType();
>>> Object feature = notification.getFeature();
>>> if (MindmapPackage.eINSTANCE.getTopic_Subtopics().equals(featur e)
>>> &&
>>> (type == Notification.ADD || type == Notification.REMOVE)) {
>>> CanonicalEditPolicy canonicalEditPolicy = (CanonicalEditPolicy)
>>> getParent().getEditPolicy(EditPolicyRoles.CANONICAL_ROLE);
>>> canonicalEditPolicy.refresh();
>>> }
>>> super.handleNotificationEvent(notification);
>>> }
>>>
>>> Best,
>>> Rich
>>>
>>>
>>> On 6/3/08 8:53 AM, in article g23esd$nh2$2@build.eclipse.org, "Martin
>>> Schmidt" <martinschmidt.83@web.de> wrote:
>>>
>>>> In the previous post "Refresh all the diagram" i saw this:
>>>>
>>>> Hello Matthias,
>>>>
>>>> If you are trying to perform the same action as F5 does then you can have
>>>> a look on generated ???DiagramUpdateCommand.
>>>>
>>>> -----------------
>>>> Alex Shatalin
>>>>
>>>>
>>>>
>>>> Can somebody give me an code example how to use DiagramUpdateCommand?
>>>> I´m trying to update my whole diagram after i did some model changes when
>>>> a
>>>> reference of an element was changed. So i overwrite method
>>>> "handleNotificationEvent" in my figures EditPart:
>>>>
>>>> @Override
>>>>
>>>> protected void handleNotificationEvent(Notification notification) {
>>>>
>>>>
>>>> if (notification.getFeature() instanceof EReferenceImpl){
>>>>
>>>> if
>>>>
>>> (((EReferenceImpl)notification.getFeature()).getName().equal s( "reference_to"
>>> ))>
>>> {
>>>> ..... // doing something with my model
>>>>
>>>> //here it want to update my diagram
>>>>
>>>>
>>>> }
>>>>
>>>> }
>>>>
>>>>
>>>> super.handleNotificationEvent(notification);
>>>>
>>>> }
>>>>
>>>>
>>>>
>>>> Thanks a lot in advance,
>>>>
>>>> Martin
>>>>
>>>>
>>>>
>>
>>
Re: DiagramUpdateCommand [message #190996 is a reply to message #190751] Wed, 04 June 2008 14:06 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: matthias.schmidt.xactium.com

Hello,

Thanks for your answer Rich. I do understand the code better now.

But my problem is slightly different to Martin's. I've created a plug-in
which adds an action to the right-click menu of my diagram shapes. This
action changes it's fields and after that the shape needs to be changed
if a certain field has a certain value.
Everything works fine. The fields get updated and the shape changes it's
style upon the specified constraint. But (besides the known bug, that
the shape jumps to a position near the middle of the diagram) there are
still history issues.

Let's say I use the undo facility. It seams that the refresh activity
doesn't get stored. That means that the shape style doesn't change back
when I roll back.

Here is what the action contains to refresh the diagram:

CanonicalEditPolicy canonicalEditPolicy = (CanonicalEditPolicy)
mySelectedViewElement.getParent().getEditPolicy(EditPolicyRo les.CANONICAL_ROLE);

canonicalEditPolicy.refresh();

While mySelectedViewElement stores the current shape's EditPart.


Any hints are welcome.
Thanks,

Matthias




Richard Gronback wrote:
> You'll need to use a method from your model, that which returns the feature
> you're interested in. The method getTopic_Subtopics() is from the mindmap
> domain model.
>
> I've never noticed any problems with undo following a diagram update.
>
> Best,
> Rich
>
>
> On 6/3/08 12:26 PM, in article g23rc3$ht2$1@build.eclipse.org, "Matthias
> Schmidt" <matthias.schmidt@xactium.com> wrote:
>
>> Hello,
>>
>> I'm trying that as well at the minute and I got stuck.
>> Looks like MyPackage.eINSTANCE.getTopic_Subtopics().equals(feature)
>> doesn't work for me because the methode getTopic_Subtopics() doesn't
>> exist. Does anybody know, what I'm doing work here?
>>
>> And another question. Does this approach provide me with full history
>> support? As refreshing the diagram the way I do it currently, leads to
>> exceptions when using the undo facility.
>>
>> Cheers,
>> Matthias
>>
>>
>>
>>
>> Martin Schmidt wrote:
>>> great. works fantastic!!! Thank You!!!
>>> "Richard Gronback" <richard.gronback@borland.com> schrieb im Newsbeitrag
>>> news:C46AC1EA.E3FF%richard.gronback@borland.com...
>>>> You can try something like this:
>>>>
>>>> @Override
>>>> protected void handleNotificationEvent(Notification notification) {
>>>> int type = notification.getEventType();
>>>> Object feature = notification.getFeature();
>>>> if (MindmapPackage.eINSTANCE.getTopic_Subtopics().equals(featur e)
>>>> &&
>>>> (type == Notification.ADD || type == Notification.REMOVE)) {
>>>> CanonicalEditPolicy canonicalEditPolicy = (CanonicalEditPolicy)
>>>> getParent().getEditPolicy(EditPolicyRoles.CANONICAL_ROLE);
>>>> canonicalEditPolicy.refresh();
>>>> }
>>>> super.handleNotificationEvent(notification);
>>>> }
>>>>
>>>> Best,
>>>> Rich
>>>>
>>>>
>>>> On 6/3/08 8:53 AM, in article g23esd$nh2$2@build.eclipse.org, "Martin
>>>> Schmidt" <martinschmidt.83@web.de> wrote:
>>>>
>>>>> In the previous post "Refresh all the diagram" i saw this:
>>>>>
>>>>> Hello Matthias,
>>>>>
>>>>> If you are trying to perform the same action as F5 does then you can have
>>>>> a look on generated ???DiagramUpdateCommand.
>>>>>
>>>>> -----------------
>>>>> Alex Shatalin
>>>>>
>>>>>
>>>>>
>>>>> Can somebody give me an code example how to use DiagramUpdateCommand?
>>>>> I´m trying to update my whole diagram after i did some model changes when
>>>>> a
>>>>> reference of an element was changed. So i overwrite method
>>>>> "handleNotificationEvent" in my figures EditPart:
>>>>>
>>>>> @Override
>>>>>
>>>>> protected void handleNotificationEvent(Notification notification) {
>>>>>
>>>>>
>>>>> if (notification.getFeature() instanceof EReferenceImpl){
>>>>>
>>>>> if
>>>>>
>>>> (((EReferenceImpl)notification.getFeature()).getName().equal s( "reference_to"
>>>> ))>
>>>> {
>>>>> ..... // doing something with my model
>>>>>
>>>>> //here it want to update my diagram
>>>>>
>>>>>
>>>>> }
>>>>>
>>>>> }
>>>>>
>>>>>
>>>>> super.handleNotificationEvent(notification);
>>>>>
>>>>> }
>>>>>
>>>>>
>>>>>
>>>>> Thanks a lot in advance,
>>>>>
>>>>> Martin
>>>>>
>>>>>
>>>>>
>>>
>
Re: DiagramUpdateCommand [message #191047 is a reply to message #190996] Wed, 04 June 2008 16:01 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: matthias.schmidt.xactium.com

Hello again,

I managed to implement your example, Rich.
But I really would like to add the refresh behaviour via a plug-in. I
assume, I'm not able to override this method "protected void
handleNotificationEvent(Notification notification)" via an extension
point - right? :)

The point is, that it doesn't effect only one EditPart but a big number
of ShapeNodeEditParts and I really would like xxx.diagram plug-in to
leave it as it is.

So can you give me a hint how to do that?
Cheers,

Matthias




Matthias Schmidt wrote:
> Hello,
>
> Thanks for your answer Rich. I do understand the code better now.
>
> But my problem is slightly different to Martin's. I've created a plug-in
> which adds an action to the right-click menu of my diagram shapes. This
> action changes it's fields and after that the shape needs to be changed
> if a certain field has a certain value.
> Everything works fine. The fields get updated and the shape changes it's
> style upon the specified constraint. But (besides the known bug, that
> the shape jumps to a position near the middle of the diagram) there are
> still history issues.
>
> Let's say I use the undo facility. It seams that the refresh activity
> doesn't get stored. That means that the shape style doesn't change back
> when I roll back.
>
> Here is what the action contains to refresh the diagram:
>
> CanonicalEditPolicy canonicalEditPolicy = (CanonicalEditPolicy)
> mySelectedViewElement.getParent().getEditPolicy(EditPolicyRo les.CANONICAL_ROLE);
>
> canonicalEditPolicy.refresh();
>
> While mySelectedViewElement stores the current shape's EditPart.
>
>
> Any hints are welcome.
> Thanks,
>
> Matthias
>
>
>
>
> Richard Gronback wrote:
>> You'll need to use a method from your model, that which returns the
>> feature
>> you're interested in. The method getTopic_Subtopics() is from the
>> mindmap
>> domain model.
>>
>> I've never noticed any problems with undo following a diagram update.
>>
>> Best,
>> Rich
>>
>>
>> On 6/3/08 12:26 PM, in article g23rc3$ht2$1@build.eclipse.org, "Matthias
>> Schmidt" <matthias.schmidt@xactium.com> wrote:
>>
>>> Hello,
>>>
>>> I'm trying that as well at the minute and I got stuck.
>>> Looks like MyPackage.eINSTANCE.getTopic_Subtopics().equals(feature)
>>> doesn't work for me because the methode getTopic_Subtopics() doesn't
>>> exist. Does anybody know, what I'm doing work here?
>>>
>>> And another question. Does this approach provide me with full history
>>> support? As refreshing the diagram the way I do it currently, leads to
>>> exceptions when using the undo facility.
>>>
>>> Cheers,
>>> Matthias
>>>
>>>
>>>
>>>
>>> Martin Schmidt wrote:
>>>> great. works fantastic!!! Thank You!!!
>>>> "Richard Gronback" <richard.gronback@borland.com> schrieb im
>>>> Newsbeitrag
>>>> news:C46AC1EA.E3FF%richard.gronback@borland.com...
>>>>> You can try something like this:
>>>>>
>>>>> @Override
>>>>> protected void handleNotificationEvent(Notification notification) {
>>>>> int type = notification.getEventType();
>>>>> Object feature = notification.getFeature();
>>>>> if
>>>>> (MindmapPackage.eINSTANCE.getTopic_Subtopics().equals(featur e)
>>>>> &&
>>>>> (type == Notification.ADD || type == Notification.REMOVE)) {
>>>>> CanonicalEditPolicy canonicalEditPolicy =
>>>>> (CanonicalEditPolicy)
>>>>> getParent().getEditPolicy(EditPolicyRoles.CANONICAL_ROLE);
>>>>> canonicalEditPolicy.refresh();
>>>>> }
>>>>> super.handleNotificationEvent(notification);
>>>>> }
>>>>>
>>>>> Best,
>>>>> Rich
>>>>>
>>>>>
>>>>> On 6/3/08 8:53 AM, in article g23esd$nh2$2@build.eclipse.org, "Martin
>>>>> Schmidt" <martinschmidt.83@web.de> wrote:
>>>>>
>>>>>> In the previous post "Refresh all the diagram" i saw this:
>>>>>>
>>>>>> Hello Matthias,
>>>>>>
>>>>>> If you are trying to perform the same action as F5 does then you
>>>>>> can have
>>>>>> a look on generated ???DiagramUpdateCommand.
>>>>>>
>>>>>> -----------------
>>>>>> Alex Shatalin
>>>>>>
>>>>>>
>>>>>>
>>>>>> Can somebody give me an code example how to use DiagramUpdateCommand?
>>>>>> I´m trying to update my whole diagram after i did some model
>>>>>> changes when
>>>>>> a
>>>>>> reference of an element was changed. So i overwrite method
>>>>>> "handleNotificationEvent" in my figures EditPart:
>>>>>>
>>>>>> @Override
>>>>>>
>>>>>> protected void handleNotificationEvent(Notification notification) {
>>>>>>
>>>>>>
>>>>>> if (notification.getFeature() instanceof EReferenceImpl){
>>>>>>
>>>>>> if
>>>>>>
>>>>> (((EReferenceImpl)notification.getFeature()).getName().equal s( "reference_to"
>>>>>
>>>>> ))>
>>>>> {
>>>>>> ..... // doing something with my model
>>>>>>
>>>>>> //here it want to update my diagram
>>>>>>
>>>>>>
>>>>>> }
>>>>>>
>>>>>> }
>>>>>>
>>>>>>
>>>>>> super.handleNotificationEvent(notification);
>>>>>>
>>>>>> }
>>>>>>
>>>>>>
>>>>>>
>>>>>> Thanks a lot in advance,
>>>>>>
>>>>>> Martin
>>>>>>
>>>>>>
>>>>>>
>>>>
>>
Re: DiagramUpdateCommand [message #191071 is a reply to message #191047] Wed, 04 June 2008 16:32 Go to previous messageGo to next message
Richard Gronback is currently offline Richard GronbackFriend
Messages: 605
Registered: July 2009
Senior Member
Hello,

Well, you could customize the code generation to incorporate the behavior
you'd like. Or, if you mean you'd like to keep the generated .diagram
plug-in as is, you can create another plug-in, contribute a custom
EditPartProvider, and then substitute/extend the existing EditPart with the
one containing the logic below (or that you'd like).

Best,
Rich


On 6/4/08 12:01 PM, in article g26e8u$8s7$1@build.eclipse.org, "Matthias
Schmidt" <matthias.schmidt@xactium.com> wrote:

> Hello again,
>
> I managed to implement your example, Rich.
> But I really would like to add the refresh behaviour via a plug-in. I
> assume, I'm not able to override this method "protected void
> handleNotificationEvent(Notification notification)" via an extension
> point - right? :)
>
> The point is, that it doesn't effect only one EditPart but a big number
> of ShapeNodeEditParts and I really would like xxx.diagram plug-in to
> leave it as it is.
>
> So can you give me a hint how to do that?
> Cheers,
>
> Matthias
>
>
>
>
> Matthias Schmidt wrote:
>> Hello,
>>
>> Thanks for your answer Rich. I do understand the code better now.
>>
>> But my problem is slightly different to Martin's. I've created a plug-in
>> which adds an action to the right-click menu of my diagram shapes. This
>> action changes it's fields and after that the shape needs to be changed
>> if a certain field has a certain value.
>> Everything works fine. The fields get updated and the shape changes it's
>> style upon the specified constraint. But (besides the known bug, that
>> the shape jumps to a position near the middle of the diagram) there are
>> still history issues.
>>
>> Let's say I use the undo facility. It seams that the refresh activity
>> doesn't get stored. That means that the shape style doesn't change back
>> when I roll back.
>>
>> Here is what the action contains to refresh the diagram:
>>
>> CanonicalEditPolicy canonicalEditPolicy = (CanonicalEditPolicy)
>> mySelectedViewElement.getParent().getEditPolicy(EditPolicyRo les.CANONICAL_ROL
>> E);
>>
>> canonicalEditPolicy.refresh();
>>
>> While mySelectedViewElement stores the current shape's EditPart.
>>
>>
>> Any hints are welcome.
>> Thanks,
>>
>> Matthias
>>
>>
>>
>>
>> Richard Gronback wrote:
>>> You'll need to use a method from your model, that which returns the
>>> feature
>>> you're interested in. The method getTopic_Subtopics() is from the
>>> mindmap
>>> domain model.
>>>
>>> I've never noticed any problems with undo following a diagram update.
>>>
>>> Best,
>>> Rich
>>>
>>>
>>> On 6/3/08 12:26 PM, in article g23rc3$ht2$1@build.eclipse.org, "Matthias
>>> Schmidt" <matthias.schmidt@xactium.com> wrote:
>>>
>>>> Hello,
>>>>
>>>> I'm trying that as well at the minute and I got stuck.
>>>> Looks like MyPackage.eINSTANCE.getTopic_Subtopics().equals(feature)
>>>> doesn't work for me because the methode getTopic_Subtopics() doesn't
>>>> exist. Does anybody know, what I'm doing work here?
>>>>
>>>> And another question. Does this approach provide me with full history
>>>> support? As refreshing the diagram the way I do it currently, leads to
>>>> exceptions when using the undo facility.
>>>>
>>>> Cheers,
>>>> Matthias
>>>>
>>>>
>>>>
>>>>
>>>> Martin Schmidt wrote:
>>>>> great. works fantastic!!! Thank You!!!
>>>>> "Richard Gronback" <richard.gronback@borland.com> schrieb im
>>>>> Newsbeitrag
>>>>> news:C46AC1EA.E3FF%richard.gronback@borland.com...
>>>>>> You can try something like this:
>>>>>>
>>>>>> @Override
>>>>>> protected void handleNotificationEvent(Notification notification) {
>>>>>> int type = notification.getEventType();
>>>>>> Object feature = notification.getFeature();
>>>>>> if
>>>>>> (MindmapPackage.eINSTANCE.getTopic_Subtopics().equals(featur e)
>>>>>> &&
>>>>>> (type == Notification.ADD || type == Notification.REMOVE)) {
>>>>>> CanonicalEditPolicy canonicalEditPolicy =
>>>>>> (CanonicalEditPolicy)
>>>>>> getParent().getEditPolicy(EditPolicyRoles.CANONICAL_ROLE);
>>>>>> canonicalEditPolicy.refresh();
>>>>>> }
>>>>>> super.handleNotificationEvent(notification);
>>>>>> }
>>>>>>
>>>>>> Best,
>>>>>> Rich
>>>>>>
>>>>>>
>>>>>> On 6/3/08 8:53 AM, in article g23esd$nh2$2@build.eclipse.org, "Martin
>>>>>> Schmidt" <martinschmidt.83@web.de> wrote:
>>>>>>
>>>>>>> In the previous post "Refresh all the diagram" i saw this:
>>>>>>>
>>>>>>> Hello Matthias,
>>>>>>>
>>>>>>> If you are trying to perform the same action as F5 does then you
>>>>>>> can have
>>>>>>> a look on generated ???DiagramUpdateCommand.
>>>>>>>
>>>>>>> -----------------
>>>>>>> Alex Shatalin
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Can somebody give me an code example how to use DiagramUpdateCommand?
>>>>>>> I´m trying to update my whole diagram after i did some model
>>>>>>> changes when
>>>>>>> a
>>>>>>> reference of an element was changed. So i overwrite method
>>>>>>> "handleNotificationEvent" in my figures EditPart:
>>>>>>>
>>>>>>> @Override
>>>>>>>
>>>>>>> protected void handleNotificationEvent(Notification notification) {
>>>>>>>
>>>>>>>
>>>>>>> if (notification.getFeature() instanceof EReferenceImpl){
>>>>>>>
>>>>>>> if
>>>>>>>
>>>>>> (((EReferenceImpl)notification.getFeature()).getName().equal s( "reference_
>>>>>> to"
>>>>>>
>>>>>> ))>
>>>>>> {
>>>>>>> ..... // doing something with my model
>>>>>>>
>>>>>>> //here it want to update my diagram
>>>>>>>
>>>>>>>
>>>>>>> }
>>>>>>>
>>>>>>> }
>>>>>>>
>>>>>>>
>>>>>>> super.handleNotificationEvent(notification);
>>>>>>>
>>>>>>> }
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Thanks a lot in advance,
>>>>>>>
>>>>>>> Martin
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>
>>>
Re: DiagramUpdateCommand [message #191187 is a reply to message #191071] Thu, 05 June 2008 14:49 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: matthias.schmidt.xactium.com

Hi Rich,

Yes!
I think adding the custom EditPartProvider using a separate plug-in is
exactly what I'm aiming for.

Can you give me more informations where and how to start? Which
extension points need to be used? Is there some documentation available
out there?

Thanks a lot.
Matthias



Richard Gronback wrote:
> Hello,
>
> Well, you could customize the code generation to incorporate the behavior
> you'd like. Or, if you mean you'd like to keep the generated .diagram
> plug-in as is, you can create another plug-in, contribute a custom
> EditPartProvider, and then substitute/extend the existing EditPart with the
> one containing the logic below (or that you'd like).
>
> Best,
> Rich
>
>
> On 6/4/08 12:01 PM, in article g26e8u$8s7$1@build.eclipse.org, "Matthias
> Schmidt" <matthias.schmidt@xactium.com> wrote:
>
>> Hello again,
>>
>> I managed to implement your example, Rich.
>> But I really would like to add the refresh behaviour via a plug-in. I
>> assume, I'm not able to override this method "protected void
>> handleNotificationEvent(Notification notification)" via an extension
>> point - right? :)
>>
>> The point is, that it doesn't effect only one EditPart but a big number
>> of ShapeNodeEditParts and I really would like xxx.diagram plug-in to
>> leave it as it is.
>>
>> So can you give me a hint how to do that?
>> Cheers,
>>
>> Matthias
>>
>>
>>
>>
>> Matthias Schmidt wrote:
>>> Hello,
>>>
>>> Thanks for your answer Rich. I do understand the code better now.
>>>
>>> But my problem is slightly different to Martin's. I've created a plug-in
>>> which adds an action to the right-click menu of my diagram shapes. This
>>> action changes it's fields and after that the shape needs to be changed
>>> if a certain field has a certain value.
>>> Everything works fine. The fields get updated and the shape changes it's
>>> style upon the specified constraint. But (besides the known bug, that
>>> the shape jumps to a position near the middle of the diagram) there are
>>> still history issues.
>>>
>>> Let's say I use the undo facility. It seams that the refresh activity
>>> doesn't get stored. That means that the shape style doesn't change back
>>> when I roll back.
>>>
>>> Here is what the action contains to refresh the diagram:
>>>
>>> CanonicalEditPolicy canonicalEditPolicy = (CanonicalEditPolicy)
>>> mySelectedViewElement.getParent().getEditPolicy(EditPolicyRo les.CANONICAL_ROL
>>> E);
>>>
>>> canonicalEditPolicy.refresh();
>>>
>>> While mySelectedViewElement stores the current shape's EditPart.
>>>
>>>
>>> Any hints are welcome.
>>> Thanks,
>>>
>>> Matthias
>>>
>>>
>>>
>>>
>>> Richard Gronback wrote:
>>>> You'll need to use a method from your model, that which returns the
>>>> feature
>>>> you're interested in. The method getTopic_Subtopics() is from the
>>>> mindmap
>>>> domain model.
>>>>
>>>> I've never noticed any problems with undo following a diagram update.
>>>>
>>>> Best,
>>>> Rich
>>>>
>>>>
>>>> On 6/3/08 12:26 PM, in article g23rc3$ht2$1@build.eclipse.org, "Matthias
>>>> Schmidt" <matthias.schmidt@xactium.com> wrote:
>>>>
>>>>> Hello,
>>>>>
>>>>> I'm trying that as well at the minute and I got stuck.
>>>>> Looks like MyPackage.eINSTANCE.getTopic_Subtopics().equals(feature)
>>>>> doesn't work for me because the methode getTopic_Subtopics() doesn't
>>>>> exist. Does anybody know, what I'm doing work here?
>>>>>
>>>>> And another question. Does this approach provide me with full history
>>>>> support? As refreshing the diagram the way I do it currently, leads to
>>>>> exceptions when using the undo facility.
>>>>>
>>>>> Cheers,
>>>>> Matthias
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> Martin Schmidt wrote:
>>>>>> great. works fantastic!!! Thank You!!!
>>>>>> "Richard Gronback" <richard.gronback@borland.com> schrieb im
>>>>>> Newsbeitrag
>>>>>> news:C46AC1EA.E3FF%richard.gronback@borland.com...
>>>>>>> You can try something like this:
>>>>>>>
>>>>>>> @Override
>>>>>>> protected void handleNotificationEvent(Notification notification) {
>>>>>>> int type = notification.getEventType();
>>>>>>> Object feature = notification.getFeature();
>>>>>>> if
>>>>>>> (MindmapPackage.eINSTANCE.getTopic_Subtopics().equals(featur e)
>>>>>>> &&
>>>>>>> (type == Notification.ADD || type == Notification.REMOVE)) {
>>>>>>> CanonicalEditPolicy canonicalEditPolicy =
>>>>>>> (CanonicalEditPolicy)
>>>>>>> getParent().getEditPolicy(EditPolicyRoles.CANONICAL_ROLE);
>>>>>>> canonicalEditPolicy.refresh();
>>>>>>> }
>>>>>>> super.handleNotificationEvent(notification);
>>>>>>> }
>>>>>>>
>>>>>>> Best,
>>>>>>> Rich
>>>>>>>
>>>>>>>
>>>>>>> On 6/3/08 8:53 AM, in article g23esd$nh2$2@build.eclipse.org, "Martin
>>>>>>> Schmidt" <martinschmidt.83@web.de> wrote:
>>>>>>>
>>>>>>>> In the previous post "Refresh all the diagram" i saw this:
>>>>>>>>
>>>>>>>> Hello Matthias,
>>>>>>>>
>>>>>>>> If you are trying to perform the same action as F5 does then you
>>>>>>>> can have
>>>>>>>> a look on generated ???DiagramUpdateCommand.
>>>>>>>>
>>>>>>>> -----------------
>>>>>>>> Alex Shatalin
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> Can somebody give me an code example how to use DiagramUpdateCommand?
>>>>>>>> I´m trying to update my whole diagram after i did some model
>>>>>>>> changes when
>>>>>>>> a
>>>>>>>> reference of an element was changed. So i overwrite method
>>>>>>>> "handleNotificationEvent" in my figures EditPart:
>>>>>>>>
>>>>>>>> @Override
>>>>>>>>
>>>>>>>> protected void handleNotificationEvent(Notification notification) {
>>>>>>>>
>>>>>>>>
>>>>>>>> if (notification.getFeature() instanceof EReferenceImpl){
>>>>>>>>
>>>>>>>> if
>>>>>>>>
>>>>>>> (((EReferenceImpl)notification.getFeature()).getName().equal s( "reference_
>>>>>>> to"
>>>>>>>
>>>>>>> ))>
>>>>>>> {
>>>>>>>> ..... // doing something with my model
>>>>>>>>
>>>>>>>> //here it want to update my diagram
>>>>>>>>
>>>>>>>>
>>>>>>>> }
>>>>>>>>
>>>>>>>> }
>>>>>>>>
>>>>>>>>
>>>>>>>> super.handleNotificationEvent(notification);
>>>>>>>>
>>>>>>>> }
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> Thanks a lot in advance,
>>>>>>>>
>>>>>>>> Martin
>>>>>>>>
>>>>>>>>
>>>>>>>>
>
Re: DiagramUpdateCommand [message #191216 is a reply to message #191187] Thu, 05 June 2008 15:01 Go to previous messageGo to next message
Richard Gronback is currently offline Richard GronbackFriend
Messages: 605
Registered: July 2009
Senior Member
You can start here:
http://help.eclipse.org/help32/topic/org.eclipse.gmf.doc/how to/diagram/howto
..html#overrideConnectionLook

I have an example in the book as well that I can share, if this doesn't do
the trick.

Best,
Rich


On 6/5/08 10:49 AM, in article g28uek$fbf$1@build.eclipse.org, "Matthias
Schmidt" <matthias.schmidt@xactium.com> wrote:

> Hi Rich,
>
> Yes!
> I think adding the custom EditPartProvider using a separate plug-in is
> exactly what I'm aiming for.
>
> Can you give me more informations where and how to start? Which
> extension points need to be used? Is there some documentation available
> out there?
>
> Thanks a lot.
> Matthias
>
>
>
> Richard Gronback wrote:
>> Hello,
>>
>> Well, you could customize the code generation to incorporate the behavior
>> you'd like. Or, if you mean you'd like to keep the generated .diagram
>> plug-in as is, you can create another plug-in, contribute a custom
>> EditPartProvider, and then substitute/extend the existing EditPart with the
>> one containing the logic below (or that you'd like).
>>
>> Best,
>> Rich
>>
>>
>> On 6/4/08 12:01 PM, in article g26e8u$8s7$1@build.eclipse.org, "Matthias
>> Schmidt" <matthias.schmidt@xactium.com> wrote:
>>
>>> Hello again,
>>>
>>> I managed to implement your example, Rich.
>>> But I really would like to add the refresh behaviour via a plug-in. I
>>> assume, I'm not able to override this method "protected void
>>> handleNotificationEvent(Notification notification)" via an extension
>>> point - right? :)
>>>
>>> The point is, that it doesn't effect only one EditPart but a big number
>>> of ShapeNodeEditParts and I really would like xxx.diagram plug-in to
>>> leave it as it is.
>>>
>>> So can you give me a hint how to do that?
>>> Cheers,
>>>
>>> Matthias
>>>
>>>
>>>
>>>
>>> Matthias Schmidt wrote:
>>>> Hello,
>>>>
>>>> Thanks for your answer Rich. I do understand the code better now.
>>>>
>>>> But my problem is slightly different to Martin's. I've created a plug-in
>>>> which adds an action to the right-click menu of my diagram shapes. This
>>>> action changes it's fields and after that the shape needs to be changed
>>>> if a certain field has a certain value.
>>>> Everything works fine. The fields get updated and the shape changes it's
>>>> style upon the specified constraint. But (besides the known bug, that
>>>> the shape jumps to a position near the middle of the diagram) there are
>>>> still history issues.
>>>>
>>>> Let's say I use the undo facility. It seams that the refresh activity
>>>> doesn't get stored. That means that the shape style doesn't change back
>>>> when I roll back.
>>>>
>>>> Here is what the action contains to refresh the diagram:
>>>>
>>>> CanonicalEditPolicy canonicalEditPolicy = (CanonicalEditPolicy)
>>>> mySelectedViewElement.getParent().getEditPolicy(EditPolicyRo les.CANONICAL_R
>>>> OL
>>>> E);
>>>>
>>>> canonicalEditPolicy.refresh();
>>>>
>>>> While mySelectedViewElement stores the current shape's EditPart.
>>>>
>>>>
>>>> Any hints are welcome.
>>>> Thanks,
>>>>
>>>> Matthias
>>>>
>>>>
>>>>
>>>>
>>>> Richard Gronback wrote:
>>>>> You'll need to use a method from your model, that which returns the
>>>>> feature
>>>>> you're interested in. The method getTopic_Subtopics() is from the
>>>>> mindmap
>>>>> domain model.
>>>>>
>>>>> I've never noticed any problems with undo following a diagram update.
>>>>>
>>>>> Best,
>>>>> Rich
>>>>>
>>>>>
>>>>> On 6/3/08 12:26 PM, in article g23rc3$ht2$1@build.eclipse.org, "Matthias
>>>>> Schmidt" <matthias.schmidt@xactium.com> wrote:
>>>>>
>>>>>> Hello,
>>>>>>
>>>>>> I'm trying that as well at the minute and I got stuck.
>>>>>> Looks like MyPackage.eINSTANCE.getTopic_Subtopics().equals(feature)
>>>>>> doesn't work for me because the methode getTopic_Subtopics() doesn't
>>>>>> exist. Does anybody know, what I'm doing work here?
>>>>>>
>>>>>> And another question. Does this approach provide me with full history
>>>>>> support? As refreshing the diagram the way I do it currently, leads to
>>>>>> exceptions when using the undo facility.
>>>>>>
>>>>>> Cheers,
>>>>>> Matthias
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> Martin Schmidt wrote:
>>>>>>> great. works fantastic!!! Thank You!!!
>>>>>>> "Richard Gronback" <richard.gronback@borland.com> schrieb im
>>>>>>> Newsbeitrag
>>>>>>> news:C46AC1EA.E3FF%richard.gronback@borland.com...
>>>>>>>> You can try something like this:
>>>>>>>>
>>>>>>>> @Override
>>>>>>>> protected void handleNotificationEvent(Notification notification) {
>>>>>>>> int type = notification.getEventType();
>>>>>>>> Object feature = notification.getFeature();
>>>>>>>> if
>>>>>>>> (MindmapPackage.eINSTANCE.getTopic_Subtopics().equals(featur e)
>>>>>>>> &&
>>>>>>>> (type == Notification.ADD || type == Notification.REMOVE)) {
>>>>>>>> CanonicalEditPolicy canonicalEditPolicy =
>>>>>>>> (CanonicalEditPolicy)
>>>>>>>> getParent().getEditPolicy(EditPolicyRoles.CANONICAL_ROLE);
>>>>>>>> canonicalEditPolicy.refresh();
>>>>>>>> }
>>>>>>>> super.handleNotificationEvent(notification);
>>>>>>>> }
>>>>>>>>
>>>>>>>> Best,
>>>>>>>> Rich
>>>>>>>>
>>>>>>>>
>>>>>>>> On 6/3/08 8:53 AM, in article g23esd$nh2$2@build.eclipse.org, "Martin
>>>>>>>> Schmidt" <martinschmidt.83@web.de> wrote:
>>>>>>>>
>>>>>>>>> In the previous post "Refresh all the diagram" i saw this:
>>>>>>>>>
>>>>>>>>> Hello Matthias,
>>>>>>>>>
>>>>>>>>> If you are trying to perform the same action as F5 does then you
>>>>>>>>> can have
>>>>>>>>> a look on generated ???DiagramUpdateCommand.
>>>>>>>>>
>>>>>>>>> -----------------
>>>>>>>>> Alex Shatalin
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Can somebody give me an code example how to use DiagramUpdateCommand?
>>>>>>>>> I´m trying to update my whole diagram after i did some model
>>>>>>>>> changes when
>>>>>>>>> a
>>>>>>>>> reference of an element was changed. So i overwrite method
>>>>>>>>> "handleNotificationEvent" in my figures EditPart:
>>>>>>>>>
>>>>>>>>> @Override
>>>>>>>>>
>>>>>>>>> protected void handleNotificationEvent(Notification notification) {
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> if (notification.getFeature() instanceof EReferenceImpl){
>>>>>>>>>
>>>>>>>>> if
>>>>>>>>>
>>>>>>>> (((EReferenceImpl)notification.getFeature()).getName().equal s( "referenc
>>>>>>>> e_
>>>>>>>> to"
>>>>>>>>
>>>>>>>> ))>
>>>>>>>> {
>>>>>>>>> ..... // doing something with my model
>>>>>>>>>
>>>>>>>>> //here it want to update my diagram
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> }
>>>>>>>>>
>>>>>>>>> }
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> super.handleNotificationEvent(notification);
>>>>>>>>>
>>>>>>>>> }
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Thanks a lot in advance,
>>>>>>>>>
>>>>>>>>> Martin
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>
Re: DiagramUpdateCommand [message #191727 is a reply to message #191216] Mon, 09 June 2008 13:47 Go to previous message
Eclipse UserFriend
Originally posted by: matthias.schmidt.xactium.com

Hi Rich,

This is definitely a step in the right direction. Thanks.

My only problem is, that I have to override the method
createConnectionFigure() and I don't really want to do that. I'm only
aiming for the method handleNotificationEvent().

Can I still do it that way or do I have to aim for a different approach.

Cheers,
Matthias




Richard Gronback wrote:
> You can start here:
> http://help.eclipse.org/help32/topic/org.eclipse.gmf.doc/how to/diagram/howto
> .html#overrideConnectionLook
>
> I have an example in the book as well that I can share, if this doesn't do
> the trick.
>
> Best,
> Rich
>
>
> On 6/5/08 10:49 AM, in article g28uek$fbf$1@build.eclipse.org, "Matthias
> Schmidt" <matthias.schmidt@xactium.com> wrote:
>
>> Hi Rich,
>>
>> Yes!
>> I think adding the custom EditPartProvider using a separate plug-in is
>> exactly what I'm aiming for.
>>
>> Can you give me more informations where and how to start? Which
>> extension points need to be used? Is there some documentation available
>> out there?
>>
>> Thanks a lot.
>> Matthias
>>
>>
>>
>> Richard Gronback wrote:
>>> Hello,
>>>
>>> Well, you could customize the code generation to incorporate the behavior
>>> you'd like. Or, if you mean you'd like to keep the generated .diagram
>>> plug-in as is, you can create another plug-in, contribute a custom
>>> EditPartProvider, and then substitute/extend the existing EditPart with the
>>> one containing the logic below (or that you'd like).
>>>
>>> Best,
>>> Rich
>>>
>>>
>>> On 6/4/08 12:01 PM, in article g26e8u$8s7$1@build.eclipse.org, "Matthias
>>> Schmidt" <matthias.schmidt@xactium.com> wrote:
>>>
>>>> Hello again,
>>>>
>>>> I managed to implement your example, Rich.
>>>> But I really would like to add the refresh behaviour via a plug-in. I
>>>> assume, I'm not able to override this method "protected void
>>>> handleNotificationEvent(Notification notification)" via an extension
>>>> point - right? :)
>>>>
>>>> The point is, that it doesn't effect only one EditPart but a big number
>>>> of ShapeNodeEditParts and I really would like xxx.diagram plug-in to
>>>> leave it as it is.
>>>>
>>>> So can you give me a hint how to do that?
>>>> Cheers,
>>>>
>>>> Matthias
>>>>
>>>>
>>>>
>>>>
>>>> Matthias Schmidt wrote:
>>>>> Hello,
>>>>>
>>>>> Thanks for your answer Rich. I do understand the code better now.
>>>>>
>>>>> But my problem is slightly different to Martin's. I've created a plug-in
>>>>> which adds an action to the right-click menu of my diagram shapes. This
>>>>> action changes it's fields and after that the shape needs to be changed
>>>>> if a certain field has a certain value.
>>>>> Everything works fine. The fields get updated and the shape changes it's
>>>>> style upon the specified constraint. But (besides the known bug, that
>>>>> the shape jumps to a position near the middle of the diagram) there are
>>>>> still history issues.
>>>>>
>>>>> Let's say I use the undo facility. It seams that the refresh activity
>>>>> doesn't get stored. That means that the shape style doesn't change back
>>>>> when I roll back.
>>>>>
>>>>> Here is what the action contains to refresh the diagram:
>>>>>
>>>>> CanonicalEditPolicy canonicalEditPolicy = (CanonicalEditPolicy)
>>>>> mySelectedViewElement.getParent().getEditPolicy(EditPolicyRo les.CANONICAL_R
>>>>> OL
>>>>> E);
>>>>>
>>>>> canonicalEditPolicy.refresh();
>>>>>
>>>>> While mySelectedViewElement stores the current shape's EditPart.
>>>>>
>>>>>
>>>>> Any hints are welcome.
>>>>> Thanks,
>>>>>
>>>>> Matthias
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> Richard Gronback wrote:
>>>>>> You'll need to use a method from your model, that which returns the
>>>>>> feature
>>>>>> you're interested in. The method getTopic_Subtopics() is from the
>>>>>> mindmap
>>>>>> domain model.
>>>>>>
>>>>>> I've never noticed any problems with undo following a diagram update.
>>>>>>
>>>>>> Best,
>>>>>> Rich
>>>>>>
>>>>>>
>>>>>> On 6/3/08 12:26 PM, in article g23rc3$ht2$1@build.eclipse.org, "Matthias
>>>>>> Schmidt" <matthias.schmidt@xactium.com> wrote:
>>>>>>
>>>>>>> Hello,
>>>>>>>
>>>>>>> I'm trying that as well at the minute and I got stuck.
>>>>>>> Looks like MyPackage.eINSTANCE.getTopic_Subtopics().equals(feature)
>>>>>>> doesn't work for me because the methode getTopic_Subtopics() doesn't
>>>>>>> exist. Does anybody know, what I'm doing work here?
>>>>>>>
>>>>>>> And another question. Does this approach provide me with full history
>>>>>>> support? As refreshing the diagram the way I do it currently, leads to
>>>>>>> exceptions when using the undo facility.
>>>>>>>
>>>>>>> Cheers,
>>>>>>> Matthias
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Martin Schmidt wrote:
>>>>>>>> great. works fantastic!!! Thank You!!!
>>>>>>>> "Richard Gronback" <richard.gronback@borland.com> schrieb im
>>>>>>>> Newsbeitrag
>>>>>>>> news:C46AC1EA.E3FF%richard.gronback@borland.com...
>>>>>>>>> You can try something like this:
>>>>>>>>>
>>>>>>>>> @Override
>>>>>>>>> protected void handleNotificationEvent(Notification notification) {
>>>>>>>>> int type = notification.getEventType();
>>>>>>>>> Object feature = notification.getFeature();
>>>>>>>>> if
>>>>>>>>> (MindmapPackage.eINSTANCE.getTopic_Subtopics().equals(featur e)
>>>>>>>>> &&
>>>>>>>>> (type == Notification.ADD || type == Notification.REMOVE)) {
>>>>>>>>> CanonicalEditPolicy canonicalEditPolicy =
>>>>>>>>> (CanonicalEditPolicy)
>>>>>>>>> getParent().getEditPolicy(EditPolicyRoles.CANONICAL_ROLE);
>>>>>>>>> canonicalEditPolicy.refresh();
>>>>>>>>> }
>>>>>>>>> super.handleNotificationEvent(notification);
>>>>>>>>> }
>>>>>>>>>
>>>>>>>>> Best,
>>>>>>>>> Rich
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On 6/3/08 8:53 AM, in article g23esd$nh2$2@build.eclipse.org, "Martin
>>>>>>>>> Schmidt" <martinschmidt.83@web.de> wrote:
>>>>>>>>>
>>>>>>>>>> In the previous post "Refresh all the diagram" i saw this:
>>>>>>>>>>
>>>>>>>>>> Hello Matthias,
>>>>>>>>>>
>>>>>>>>>> If you are trying to perform the same action as F5 does then you
>>>>>>>>>> can have
>>>>>>>>>> a look on generated ???DiagramUpdateCommand.
>>>>>>>>>>
>>>>>>>>>> -----------------
>>>>>>>>>> Alex Shatalin
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Can somebody give me an code example how to use DiagramUpdateCommand?
>>>>>>>>>> I´m trying to update my whole diagram after i did some model
>>>>>>>>>> changes when
>>>>>>>>>> a
>>>>>>>>>> reference of an element was changed. So i overwrite method
>>>>>>>>>> "handleNotificationEvent" in my figures EditPart:
>>>>>>>>>>
>>>>>>>>>> @Override
>>>>>>>>>>
>>>>>>>>>> protected void handleNotificationEvent(Notification notification) {
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> if (notification.getFeature() instanceof EReferenceImpl){
>>>>>>>>>>
>>>>>>>>>> if
>>>>>>>>>>
>>>>>>>>> (((EReferenceImpl)notification.getFeature()).getName().equal s( "referenc
>>>>>>>>> e_
>>>>>>>>> to"
>>>>>>>>>
>>>>>>>>> ))>
>>>>>>>>> {
>>>>>>>>>> ..... // doing something with my model
>>>>>>>>>>
>>>>>>>>>> //here it want to update my diagram
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> }
>>>>>>>>>>
>>>>>>>>>> }
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> super.handleNotificationEvent(notification);
>>>>>>>>>>
>>>>>>>>>> }
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Thanks a lot in advance,
>>>>>>>>>>
>>>>>>>>>> Martin
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>
Previous Topic:swither for a diagram
Next Topic:getEditPartRegistry.get() returning null?
Goto Forum:
  


Current Time: Fri Apr 19 21:26:56 GMT 2024

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

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

Back to the top