|
Re: modify pop up menu in canvas [message #659604 is a reply to message #659534] |
Mon, 14 March 2011 19:01 |
Christophe Bouhier 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:
>
|
|
|
Powered by
FUDForum. Page generated in 0.03526 seconds