Skip to main content



      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
Eclipse UserFriend
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
Eclipse UserFriend
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: Thu Jul 03 12:15:50 EDT 2025

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

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

Back to the top