Skip to main content


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 13:02 Go to next message
g mouch is currently offline g mouchFriend
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 19:01 Go to previous message
Christophe Bouhier is currently offline Christophe BouhierFriend
Messages: 937
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: Thu Apr 25 01:08:20 GMT 2024

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

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

Back to the top