| [news.eclipse.modeling.gmf] Re: swither for a diagram |
Hi Alexey,
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.contributionItemProviders">
<contributionItemProvider class="org.spbu.pldoctoolkit.graph.diagram.infproduct.providers.SwitchFIPContributionItemProvider" checkPluginLoaded="false">
<Priority name="Lowest">
</Priority>
<partContribution class="org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramWorkbenchPart">
<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@xxxxxx> 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