Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Access Palette(Viewer) from other Plugin or GMF generated Code
Access Palette(Viewer) from other Plugin or GMF generated Code [message #142660] Fri, 13 July 2007 17:57 Go to next message
Eclipse User
Originally posted by: christian.wittner.siemens.com

Hello,

I hope I put my question here in the right place and haven't missed a
similar question already discussed on this group. If those I apologize.

I have used the GMF to generate an editor for my ecore model. I can
executed it, load, edit diagramms all this is working fine.

Now I need to find out which ToolEntry is currently selected in the
Palette.

Which method or extension point are you supposed to use to get a handle to
the PalleteViewer or any other way to get information about which
ToolEntry in the Palette is currently selected?

Any help pointing me in the right direction would be highly appreciated.

What I found so far:

While trying to get a glimpse from the documentation I found the class:
org.eclipse.gef.ui.palette.PaletteViewer

Which has the Method:
addPaletteListener(PaletteListener paletteListener)

And the PaletteListener Interface contains the method:
activeToolChanged(PaletteViewer palette, ToolEntry tool)

Sounds to me as this is the information Event I need to register/listen to.

But I can't see where.
When I search the code which is generated by the gmf dashboard based on my
ecore file I can't find a PaletteViewer or a derived class. Not in the
diagram, edit or model part.

When I debug I find the method where the ToolEntries are generated and
added to the PaletteRoot.

MyPaletteFactory.fillPallete(PaletteRoot paletteRoot)

As far as I understand the Palettecontainer/ToolEntries don't know about
the Palette they are assigned to. Or I can't see how to get a handle to
the Palette or the Palette view from PaletteRoot, PaletteContainer or
ToolEntry.

I also found the Class org.eclipse.gef.EditDomain which has a promising
method: getPaletteViewer() But I couldn't find a way to access the
EditDomain from the generated Code or another Plugin either.

I am running out of idea where to look for the currently selected tool
entry in the palette.

Any help pointing me in the right direction would be highly appreciated.

Best Regards,
Christian Wittner
Re: Access Palette(Viewer) from other Plugin or GMF generated Code [message #142670 is a reply to message #142660] Fri, 13 July 2007 18:22 Go to previous message
Cherie Revells is currently offline Cherie Revells
Messages: 299
Registered: July 2009
Senior Member
Christian,

Take a look at the code in this class:
org.eclipse.gmf.runtime.diagram.ui.editpolicies.DiagramPopup BarEditPolicy

It is responsible for populating the popupbar on the diagram based on
the last active palette tool. I think it does exactly what you want to do.

Regards,
Cherie

Christian Wittner wrote:
> Hello,
>
> I hope I put my question here in the right place and haven't missed a
> similar question already discussed on this group. If those I apologize.
>
> I have used the GMF to generate an editor for my ecore model. I can
> executed it, load, edit diagramms all this is working fine.
>
> Now I need to find out which ToolEntry is currently selected in the
> Palette.
>
> Which method or extension point are you supposed to use to get a handle
> to the PalleteViewer or any other way to get information about which
> ToolEntry in the Palette is currently selected?
>
> Any help pointing me in the right direction would be highly appreciated.
>
> What I found so far:
>
> While trying to get a glimpse from the documentation I found the class:
> org.eclipse.gef.ui.palette.PaletteViewer
> Which has the Method:
> addPaletteListener(PaletteListener paletteListener)
> And the PaletteListener Interface contains the method:
> activeToolChanged(PaletteViewer palette, ToolEntry tool)
> Sounds to me as this is the information Event I need to register/listen to.
>
> But I can't see where.
> When I search the code which is generated by the gmf dashboard based on
> my ecore file I can't find a PaletteViewer or a derived class. Not in
> the diagram, edit or model part.
> When I debug I find the method where the ToolEntries are generated and
> added to the PaletteRoot.
>
> MyPaletteFactory.fillPallete(PaletteRoot paletteRoot)
>
> As far as I understand the Palettecontainer/ToolEntries don't know about
> the Palette they are assigned to. Or I can't see how to get a handle to
> the Palette or the Palette view from PaletteRoot, PaletteContainer or
> ToolEntry.
>
> I also found the Class org.eclipse.gef.EditDomain which has a promising
> method: getPaletteViewer() But I couldn't find a way to access the
> EditDomain from the generated Code or another Plugin either.
>
> I am running out of idea where to look for the currently selected tool
> entry in the palette.
>
> Any help pointing me in the right direction would be highly appreciated.
>
> Best Regards,
> Christian Wittner
>
>
Previous Topic:Support for saving as eps
Next Topic:How to install GMF Source Code and Help Docs?
Goto Forum:
  


Current Time: Mon Sep 22 18:24:54 GMT 2014

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

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