Home » Modeling » GMF (Graphical Modeling Framework) » swither for a diagram
|
Re: swither for a diagram [message #190478 is a reply to message #190367] |
Mon, 02 June 2008 10:08 |
Eclipse User |
|
|
|
Originally posted by: jan.herriger.gmx.de
Hi Alexey,
I don't know exactly what you want to achieve. But it sounds reasonable
to me, to create an IEditorActionDelegate. Add this action to
menu/toolbar with org.eclipse.ui.editorActions extension point (or
org.eclipse.ui.menus, if you like).
Alexey Semenov schrieb:
> Hi All,
>
> I need to implement a switcher related to the diagram. It should have a
> pre-defined set of values based on external information, and switch
> diagram's editing mode and colouring.
>
> The question is, how do I implement such a switcher. Generally speaking,
> I see 3 options:
>
> (1) insert it into the palette, as a column of buttons below the tools'
> buttons;
> (2) implement a tabs group for the diagram;
> (3) have it separately somewhere in Eclipse toolbars.
>
> I've tried (1) and it looks very non-standard, so uneasy. So does (2). I
> haven't investigated option (3) yet.
>
> Could anyone please advise me the quickest method and probably point me
> somewhere in the docs/examples if my need has already been addressed and
> solved? Or at least say I'm a freaking geek and will have to solve my
> geeky problems on my own
>
> Many thanks,
> Alexey
|
|
|
Re: swither for a diagram [message #191632 is a reply to message #190478] |
Mon, 09 June 2008 10:01 |
Alexey Semenov Messages: 78 Registered: July 2009 |
Member |
|
|
Hi Jan,
Thanks for the reply.
I've done a little investigation and it seems that GMF provides utility =
=
classes for this kind of extension. I added this code to plugin.xml and =
=
this added a button to the diagram's toolbar.
<extension id=3D"presentationContributionItemProvider" =
name=3D"%ext.presentationContributionItemProvider" =
point=3D" org.eclipse.gmf.runtime.common.ui.services.action.contributi onI=
temProviders">
<contributionItemProvider =
class=3D" org.spbu.pldoctoolkit.graph.diagram.infproduct.providers.Swi tch=
FIPContributionItemProvider" =
checkPluginLoaded=3D"false">
<Priority name=3D"Lowest">
</Priority>
<partContribution =
class=3D" org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramWorkbenchPa rt "=
>
<partMenuGroup toolbarPath=3D"/" id=3D"toolbarTestGroup=
">
</partMenuGroup>
<partAction toolbarPath=3D"/toolbarTestGroup" =
id=3D"switchPresentationAction">
</partAction>
</partContribution>
</contributionItemProvider>
</extension>
What I need now is to wire the event from the button with an appearance =
=
change on the diagram.
My current idea is to find the current active DiagramEditor and call a =
method there, which will cause the diagram to re-paint itself. The =
canonical edit policy of the diagram will then update its data.
Is it a correct idea? :)
Thanks,
Alexey
On Mon, 02 Jun 2008 14:08:22 +0400, Jan Herriger <jan.herriger@gmx.de> =
wrote:
> Hi Alexey,
>
> I don't know exactly what you want to achieve. But it sounds reasonabl=
e =
> to me, to create an IEditorActionDelegate. Add this action to =
> menu/toolbar with org.eclipse.ui.editorActions extension point (or =
> org.eclipse.ui.menus, if you like).
>
> Alexey Semenov schrieb:
>> Hi All,
>> I need to implement a switcher related to the diagram. It should hav=
e =
>> a pre-defined set of values based on external information, and switch=
=
>> diagram's editing mode and colouring.
>> The question is, how do I implement such a switcher. Generally =
>> speaking, I see 3 options:
>> (1) insert it into the palette, as a column of buttons below the =
>> tools' buttons;
>> (2) implement a tabs group for the diagram;
>> (3) have it separately somewhere in Eclipse toolbars.
>> I've tried (1) and it looks very non-standard, so uneasy. So does (2=
). =
>> I haven't investigated option (3) yet.
>> Could anyone please advise me the quickest method and probably point=
=
>> me somewhere in the docs/examples if my need has already been address=
ed =
>> and solved? Or at least say I'm a freaking geek and will have to solv=
e =
>> my geeky problems on my own
>> Many thanks,
>> Alexey
|
|
|
Re: swither for a diagram [message #191702 is a reply to message #191632] |
Mon, 09 June 2008 12:25 |
Eclipse User |
|
|
|
Originally posted by: jan.herriger.gmx.de
Hi Alexey,
I assume, this action modifies the notational model? DiagramEditPart
listens to these changes. You should be able to catch corresponding
events inside #handleNotificationEvent and update diagram contents.
Alexey Semenov schrieb:
> Hi Jan,
>
> Thanks for the reply.
>
> I've done a little investigation and it seems that GMF provides utility
> classes for this kind of extension. I added this code to plugin.xml and
> this added a button to the diagram's toolbar.
>
> <extension id="presentationContributionItemProvider"
> name="%ext.presentationContributionItemProvider"
> point=" org.eclipse.gmf.runtime.common.ui.services.action.contributi onItemProviders ">
>
> <contributionItemProvider
> class=" org.spbu.pldoctoolkit.graph.diagram.infproduct.providers.Swi tchFIPContributionItemProvider "
> checkPluginLoaded="false">
> <Priority name="Lowest">
> </Priority>
> <partContribution
> class=" org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramWorkbenchPa rt ">
> <partMenuGroup toolbarPath="/" id="toolbarTestGroup">
> </partMenuGroup>
> <partAction toolbarPath="/toolbarTestGroup"
> id="switchPresentationAction">
> </partAction>
> </partContribution>
> </contributionItemProvider>
> </extension>
>
> What I need now is to wire the event from the button with an appearance
> change on the diagram.
>
> My current idea is to find the current active DiagramEditor and call a
> method there, which will cause the diagram to re-paint itself. The
> canonical edit policy of the diagram will then update its data.
>
> Is it a correct idea? :)
>
> Thanks,
> Alexey
>
>
> On Mon, 02 Jun 2008 14:08:22 +0400, Jan Herriger <jan.herriger@gmx.de>
> wrote:
>
>> Hi Alexey,
>>
>> I don't know exactly what you want to achieve. But it sounds
>> reasonable to me, to create an IEditorActionDelegate. Add this action
>> to menu/toolbar with org.eclipse.ui.editorActions extension point (or
>> org.eclipse.ui.menus, if you like).
>>
>> Alexey Semenov schrieb:
>>> Hi All,
>>> I need to implement a switcher related to the diagram. It should
>>> have a pre-defined set of values based on external information, and
>>> switch diagram's editing mode and colouring.
>>> The question is, how do I implement such a switcher. Generally
>>> speaking, I see 3 options:
>>> (1) insert it into the palette, as a column of buttons below the
>>> tools' buttons;
>>> (2) implement a tabs group for the diagram;
>>> (3) have it separately somewhere in Eclipse toolbars.
>>> I've tried (1) and it looks very non-standard, so uneasy. So does
>>> (2). I haven't investigated option (3) yet.
>>> Could anyone please advise me the quickest method and probably point
>>> me somewhere in the docs/examples if my need has already been
>>> addressed and solved? Or at least say I'm a freaking geek and will
>>> have to solve my geeky problems on my own
>>> Many thanks,
>>> Alexey
>
|
|
|
Goto Forum:
Current Time: Fri Apr 26 20:28:31 GMT 2024
Powered by FUDForum. Page generated in 0.02929 seconds
|