Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » modify pop up menu in canvas
modify pop up menu in canvas [message #659534] Mon, 14 March 2011 09:02 Go to next message
g mouch is currently offline g mouch
Messages: 14
Registered: December 2010
Junior Member
Hi,

How can I modify the menu that pops up in the canvas? First I want to change the icons.

Screenshot:
http://img41.imageshack.us/img41/9415/canvasix.png
Re: modify pop up menu in canvas [message #659604 is a reply to message #659534] Mon, 14 March 2011 15:01 Go to previous message
Christophe Bouhier is currently offline Christophe Bouhier
Messages: 914
Registered: July 2009
Senior Member
On 14-03-11 14:02, g mouch wrote:
> Hi,
> How can I modify the menu that pops up in the canvas? First I want to
> change the icons.

Typically, a generated GMF Editor, will install an IconProvider through
the plugin.xml. This provider, links to

<extension
point="org.eclipse.gmf.runtime.common.ui.services.iconProviders "
id="icon-provider">
<?gmfgen generated="true"?>
<IconProvider class="xxxIconProvider">
<Priority name="Low"/>
</IconProvider>
</extension>

If you look at the referenced class, it will have a method getIcon.

public Image getIcon(IAdaptable hint, int flags) {
return xxxElementTypes.getImage(hint);
}

....which then refers to your xxxElementTypes.

ultimately, it will refer to the plugin, to get the icon,
what it basically does, is use the EMF.Edit plugin, to resolve the icon
through an adapterfactory.... So changing the icons in the generated
..edit plugin, will also reflect in a GMF Editor.


public ImageDescriptor getItemImageDescriptor(Object item) {
IItemLabelProvider labelProvider = (IItemLabelProvider) adapterFactory
.adapt(item, IItemLabelProvider.class);
if (labelProvider != null) {
return ExtendedImageRegistry.getInstance().getImageDescriptor(
labelProvider.getImage(item));
}
return null;
}


Cheers Christophe





> Screenshot:
>
Previous Topic:multiple packages and mapping model
Next Topic:Display containment through link
Goto Forum:
  


Current Time: Mon Sep 01 21:59:01 EDT 2014

Powered by FUDForum. Page generated in 0.01910 seconds