Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 Tools » Decorate a class shortcut
Decorate a class shortcut [message #471189] Tue, 26 June 2007 07:48 Go to next message
Philippe is currently offline PhilippeFriend
Messages: 100
Registered: July 2009
Senior Member
Hi,

I would like to add some options for class shortcuts on ClassD.

First, I would like to had a popupMenu Action for navigating to the
owning package of the shortcut if it exist.
I tought of a simple popupMenu extension with an ActionFilter to
determine whether the editPart is a shortcut. But I'm not so sure about
how to open the diagram corresponding to the package. Any idea?

Second, I would like to add a decoration to a shortcut depending a
parameter that would be set by the user.A kind of "Mark as navigable"
action. The best would be to add a little something (text or icon) to
mark the selected shortcut. From where should I start to make this,
whether in the editPart class or can I make this from an external
plug-ins for leaving UML2Tools code clean.

Thanks for your help
Philippe
Re: Decorate a class shortcut [message #471192 is a reply to message #471189] Tue, 26 June 2007 18:45 Go to previous messageGo to next message
Tatiana Fesenko is currently offline Tatiana FesenkoFriend
Messages: 530
Registered: July 2009
Senior Member
Hi Philippe,

1) One may initialize as much diagrams from model file as he/she wants,
therefore there may be several 'contaning' diagrams for the element .
Shortcut element has a domain model Id data only. I don't see any
possibility to implement navigation to 'containing' diagram. Good news is
that you can implement your own "Create shortcut action". Have a look at
UMLCreateShortcutAction and UMLCreateShortcutDecorationsCommand. The last
one (UMLCreateShortcutDecorationsCommand) creates annotation that contains
all information about the 'source' element. You can add some additional
information in the annotation and then implement navigation.

2) Shortcut signs are painted with UMLShortcutsDecoratorProvider. You could
write your own DecoratorProvider and use existing one as a template. Do not
forget to register it in plugin.xml =)

Good luck,
Tatiana.

"Philippe" <philippeweber57@yahoo.fr> wrote in message
news:f5qghp$8kr$1@build.eclipse.org...
> Hi,
>
> I would like to add some options for class shortcuts on ClassD.
>
> First, I would like to had a popupMenu Action for navigating to the owning
> package of the shortcut if it exist.
> I tought of a simple popupMenu extension with an ActionFilter to determine
> whether the editPart is a shortcut. But I'm not so sure about how to open
> the diagram corresponding to the package. Any idea?
>
> Second, I would like to add a decoration to a shortcut depending a
> parameter that would be set by the user.A kind of "Mark as navigable"
> action. The best would be to add a little something (text or icon) to mark
> the selected shortcut. From where should I start to make this, whether in
> the editPart class or can I make this from an external plug-ins for
> leaving UML2Tools code clean.
>
> Thanks for your help
> Philippe
Re: Decorate a class shortcut [message #471194 is a reply to message #471192] Wed, 27 June 2007 11:45 Go to previous messageGo to next message
Philippe is currently offline PhilippeFriend
Messages: 100
Registered: July 2009
Senior Member
Hi Tatiana,

thanks for the good answers, it works great.
In addition, I have created a dialog to select the diagram to link to.
To do so I have modified the UMLElementChooserDialog to obtain a diagram
element URI. It is OK but I need to ameliorate the LabelProvider.
Furthermore is there a simple way to filter the nodes to have only
diagram elements visible within umlclass_diagram files ?

By the way, the original UMLShortcutDecoratorProvider doesn't appear to
be declared in UML2Tools RC3fix, the icon isn't visible on class diagrams.
Seems like a little bug.

Thanks
Philippe

Tatiana Fesenko wrote:
> Hi Philippe,
>
> 1) One may initialize as much diagrams from model file as he/she wants,
> therefore there may be several 'contaning' diagrams for the element .
> Shortcut element has a domain model Id data only. I don't see any
> possibility to implement navigation to 'containing' diagram. Good news is
> that you can implement your own "Create shortcut action". Have a look at
> UMLCreateShortcutAction and UMLCreateShortcutDecorationsCommand. The last
> one (UMLCreateShortcutDecorationsCommand) creates annotation that contains
> all information about the 'source' element. You can add some additional
> information in the annotation and then implement navigation.
>
> 2) Shortcut signs are painted with UMLShortcutsDecoratorProvider. You could
> write your own DecoratorProvider and use existing one as a template. Do not
> forget to register it in plugin.xml =)
>
> Good luck,
> Tatiana.
>
> "Philippe" <philippeweber57@yahoo.fr> wrote in message
> news:f5qghp$8kr$1@build.eclipse.org...
>> Hi,
>>
>> I would like to add some options for class shortcuts on ClassD.
>>
>> First, I would like to had a popupMenu Action for navigating to the owning
>> package of the shortcut if it exist.
>> I tought of a simple popupMenu extension with an ActionFilter to determine
>> whether the editPart is a shortcut. But I'm not so sure about how to open
>> the diagram corresponding to the package. Any idea?
>>
>> Second, I would like to add a decoration to a shortcut depending a
>> parameter that would be set by the user.A kind of "Mark as navigable"
>> action. The best would be to add a little something (text or icon) to mark
>> the selected shortcut. From where should I start to make this, whether in
>> the editPart class or can I make this from an external plug-ins for
>> leaving UML2Tools code clean.
>>
>> Thanks for your help
>> Philippe
>
>
Re: Decorate a class shortcut [message #471196 is a reply to message #471194] Wed, 27 June 2007 18:55 Go to previous message
Tatiana Fesenko is currently offline Tatiana FesenkoFriend
Messages: 530
Registered: July 2009
Senior Member
Hi Philippe,

You've got diagram URI. That's great! Now you can get
org.eclipse.gmf.runtime.notation.Diagram:

TransactionalEditingDomain editingDomain =
GMFEditingDomainFactory.INSTANCE.createEditingDomain();
Resource diagramResource =
editingDomain.getResourceSet().getResource(diagramURI, true);
Diagram diagram = diagramResource.getContents().get(0);

Then take diagram's children and views' children by getChildren().
UMLNavigatorLabelProvider review may inspire you with LabelProvider.

You are absolutely right, shortcut mark doesn't appear on diagram. There is
bugzilla #189608 "Add shortcut mark". I already put a patch, it should
appear in the release build.

Best regards,
Tatiana.

"Philippe" <philippeweber57@yahoo.fr> wrote in message
news:f5tioo$ccr$1@build.eclipse.org...
> Hi Tatiana,
>
> thanks for the good answers, it works great.
> In addition, I have created a dialog to select the diagram to link to. To
> do so I have modified the UMLElementChooserDialog to obtain a diagram
> element URI. It is OK but I need to ameliorate the LabelProvider.
> Furthermore is there a simple way to filter the nodes to have only diagram
> elements visible within umlclass_diagram files ?
>
> By the way, the original UMLShortcutDecoratorProvider doesn't appear to be
> declared in UML2Tools RC3fix, the icon isn't visible on class diagrams.
> Seems like a little bug.
>
> Thanks
> Philippe
>
> Tatiana Fesenko wrote:
>> Hi Philippe,
>>
>> 1) One may initialize as much diagrams from model file as he/she wants,
>> therefore there may be several 'contaning' diagrams for the element .
>> Shortcut element has a domain model Id data only. I don't see any
>> possibility to implement navigation to 'containing' diagram. Good news is
>> that you can implement your own "Create shortcut action". Have a look at
>> UMLCreateShortcutAction and UMLCreateShortcutDecorationsCommand. The
>> last one (UMLCreateShortcutDecorationsCommand) creates annotation that
>> contains all information about the 'source' element. You can add some
>> additional information in the annotation and then implement navigation.
>>
>> 2) Shortcut signs are painted with UMLShortcutsDecoratorProvider. You
>> could write your own DecoratorProvider and use existing one as a
>> template. Do not forget to register it in plugin.xml =)
>>
>> Good luck,
>> Tatiana.
>>
>> "Philippe" <philippeweber57@yahoo.fr> wrote in message
>> news:f5qghp$8kr$1@build.eclipse.org...
>>> Hi,
>>>
>>> I would like to add some options for class shortcuts on ClassD.
>>>
>>> First, I would like to had a popupMenu Action for navigating to the
>>> owning package of the shortcut if it exist.
>>> I tought of a simple popupMenu extension with an ActionFilter to
>>> determine whether the editPart is a shortcut. But I'm not so sure about
>>> how to open the diagram corresponding to the package. Any idea?
>>>
>>> Second, I would like to add a decoration to a shortcut depending a
>>> parameter that would be set by the user.A kind of "Mark as navigable"
>>> action. The best would be to add a little something (text or icon) to
>>> mark the selected shortcut. From where should I start to make this,
>>> whether in the editPart class or can I make this from an external
>>> plug-ins for leaving UML2Tools code clean.
>>>
>>> Thanks for your help
>>> Philippe
>>
Re: Decorate a class shortcut [message #600511 is a reply to message #471189] Tue, 26 June 2007 18:45 Go to previous message
Tatiana Fesenko is currently offline Tatiana FesenkoFriend
Messages: 530
Registered: July 2009
Senior Member
Hi Philippe,

1) One may initialize as much diagrams from model file as he/she wants,
therefore there may be several 'contaning' diagrams for the element .
Shortcut element has a domain model Id data only. I don't see any
possibility to implement navigation to 'containing' diagram. Good news is
that you can implement your own "Create shortcut action". Have a look at
UMLCreateShortcutAction and UMLCreateShortcutDecorationsCommand. The last
one (UMLCreateShortcutDecorationsCommand) creates annotation that contains
all information about the 'source' element. You can add some additional
information in the annotation and then implement navigation.

2) Shortcut signs are painted with UMLShortcutsDecoratorProvider. You could
write your own DecoratorProvider and use existing one as a template. Do not
forget to register it in plugin.xml =)

Good luck,
Tatiana.

"Philippe" <philippeweber57@yahoo.fr> wrote in message
news:f5qghp$8kr$1@build.eclipse.org...
> Hi,
>
> I would like to add some options for class shortcuts on ClassD.
>
> First, I would like to had a popupMenu Action for navigating to the owning
> package of the shortcut if it exist.
> I tought of a simple popupMenu extension with an ActionFilter to determine
> whether the editPart is a shortcut. But I'm not so sure about how to open
> the diagram corresponding to the package. Any idea?
>
> Second, I would like to add a decoration to a shortcut depending a
> parameter that would be set by the user.A kind of "Mark as navigable"
> action. The best would be to add a little something (text or icon) to mark
> the selected shortcut. From where should I start to make this, whether in
> the editPart class or can I make this from an external plug-ins for
> leaving UML2Tools code clean.
>
> Thanks for your help
> Philippe
Re: Decorate a class shortcut [message #600536 is a reply to message #471192] Wed, 27 June 2007 11:45 Go to previous message
Philippe is currently offline PhilippeFriend
Messages: 100
Registered: July 2009
Senior Member
Hi Tatiana,

thanks for the good answers, it works great.
In addition, I have created a dialog to select the diagram to link to.
To do so I have modified the UMLElementChooserDialog to obtain a diagram
element URI. It is OK but I need to ameliorate the LabelProvider.
Furthermore is there a simple way to filter the nodes to have only
diagram elements visible within umlclass_diagram files ?

By the way, the original UMLShortcutDecoratorProvider doesn't appear to
be declared in UML2Tools RC3fix, the icon isn't visible on class diagrams.
Seems like a little bug.

Thanks
Philippe

Tatiana Fesenko wrote:
> Hi Philippe,
>
> 1) One may initialize as much diagrams from model file as he/she wants,
> therefore there may be several 'contaning' diagrams for the element .
> Shortcut element has a domain model Id data only. I don't see any
> possibility to implement navigation to 'containing' diagram. Good news is
> that you can implement your own "Create shortcut action". Have a look at
> UMLCreateShortcutAction and UMLCreateShortcutDecorationsCommand. The last
> one (UMLCreateShortcutDecorationsCommand) creates annotation that contains
> all information about the 'source' element. You can add some additional
> information in the annotation and then implement navigation.
>
> 2) Shortcut signs are painted with UMLShortcutsDecoratorProvider. You could
> write your own DecoratorProvider and use existing one as a template. Do not
> forget to register it in plugin.xml =)
>
> Good luck,
> Tatiana.
>
> "Philippe" <philippeweber57@yahoo.fr> wrote in message
> news:f5qghp$8kr$1@build.eclipse.org...
>> Hi,
>>
>> I would like to add some options for class shortcuts on ClassD.
>>
>> First, I would like to had a popupMenu Action for navigating to the owning
>> package of the shortcut if it exist.
>> I tought of a simple popupMenu extension with an ActionFilter to determine
>> whether the editPart is a shortcut. But I'm not so sure about how to open
>> the diagram corresponding to the package. Any idea?
>>
>> Second, I would like to add a decoration to a shortcut depending a
>> parameter that would be set by the user.A kind of "Mark as navigable"
>> action. The best would be to add a little something (text or icon) to mark
>> the selected shortcut. From where should I start to make this, whether in
>> the editPart class or can I make this from an external plug-ins for
>> leaving UML2Tools code clean.
>>
>> Thanks for your help
>> Philippe
>
>
Re: Decorate a class shortcut [message #600551 is a reply to message #471194] Wed, 27 June 2007 18:55 Go to previous message
Tatiana Fesenko is currently offline Tatiana FesenkoFriend
Messages: 530
Registered: July 2009
Senior Member
Hi Philippe,

You've got diagram URI. That's great! Now you can get
org.eclipse.gmf.runtime.notation.Diagram:

TransactionalEditingDomain editingDomain =
GMFEditingDomainFactory.INSTANCE.createEditingDomain();
Resource diagramResource =
editingDomain.getResourceSet().getResource(diagramURI, true);
Diagram diagram = diagramResource.getContents().get(0);

Then take diagram's children and views' children by getChildren().
UMLNavigatorLabelProvider review may inspire you with LabelProvider.

You are absolutely right, shortcut mark doesn't appear on diagram. There is
bugzilla #189608 "Add shortcut mark". I already put a patch, it should
appear in the release build.

Best regards,
Tatiana.

"Philippe" <philippeweber57@yahoo.fr> wrote in message
news:f5tioo$ccr$1@build.eclipse.org...
> Hi Tatiana,
>
> thanks for the good answers, it works great.
> In addition, I have created a dialog to select the diagram to link to. To
> do so I have modified the UMLElementChooserDialog to obtain a diagram
> element URI. It is OK but I need to ameliorate the LabelProvider.
> Furthermore is there a simple way to filter the nodes to have only diagram
> elements visible within umlclass_diagram files ?
>
> By the way, the original UMLShortcutDecoratorProvider doesn't appear to be
> declared in UML2Tools RC3fix, the icon isn't visible on class diagrams.
> Seems like a little bug.
>
> Thanks
> Philippe
>
> Tatiana Fesenko wrote:
>> Hi Philippe,
>>
>> 1) One may initialize as much diagrams from model file as he/she wants,
>> therefore there may be several 'contaning' diagrams for the element .
>> Shortcut element has a domain model Id data only. I don't see any
>> possibility to implement navigation to 'containing' diagram. Good news is
>> that you can implement your own "Create shortcut action". Have a look at
>> UMLCreateShortcutAction and UMLCreateShortcutDecorationsCommand. The
>> last one (UMLCreateShortcutDecorationsCommand) creates annotation that
>> contains all information about the 'source' element. You can add some
>> additional information in the annotation and then implement navigation.
>>
>> 2) Shortcut signs are painted with UMLShortcutsDecoratorProvider. You
>> could write your own DecoratorProvider and use existing one as a
>> template. Do not forget to register it in plugin.xml =)
>>
>> Good luck,
>> Tatiana.
>>
>> "Philippe" <philippeweber57@yahoo.fr> wrote in message
>> news:f5qghp$8kr$1@build.eclipse.org...
>>> Hi,
>>>
>>> I would like to add some options for class shortcuts on ClassD.
>>>
>>> First, I would like to had a popupMenu Action for navigating to the
>>> owning package of the shortcut if it exist.
>>> I tought of a simple popupMenu extension with an ActionFilter to
>>> determine whether the editPart is a shortcut. But I'm not so sure about
>>> how to open the diagram corresponding to the package. Any idea?
>>>
>>> Second, I would like to add a decoration to a shortcut depending a
>>> parameter that would be set by the user.A kind of "Mark as navigable"
>>> action. The best would be to add a little something (text or icon) to
>>> mark the selected shortcut. From where should I start to make this,
>>> whether in the editPart class or can I make this from an external
>>> plug-ins for leaving UML2Tools code clean.
>>>
>>> Thanks for your help
>>> Philippe
>>
Previous Topic:how to enable "Delete from diagram"?
Next Topic:extending UML2Tools
Goto Forum:
  


Current Time: Thu May 09 14:32:17 GMT 2024

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

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

Back to the top