Skip to main content



      Home
Home » Modeling » GMF (Graphical Modeling Framework) » How to extend the palette !?
How to extend the palette !? [message #532499] Mon, 10 May 2010 05:57
Eclipse UserFriend
Hi,

I would like to extend the palette. By Example I have a node named "composite". Then I will add a node named "custom_composite". The "custom_composite" is a "composite" with defined attributes (dynamic loaded).

I have two plugins. The first plugin is the generated code and the other is a custom plugin with "org.eclipse.gmf.runtime.diagram.ui.paletteProviders" extension point.

In my "public class CustomPaletteProvider implements IPaletteProvider" I added "custom_composite" entry like the generated code with:

types.add(ElementTypeRegistry.getInstance().getType("id"));
types.add(XsradElementTypes.Composite_2001);


In the constructor of my "CustomPaletteProvider" class I register:

IElementType elementType = XsradElementTypes.Composite_2001;
IElementType[] toSpecialize = new IElementType[1];
toSpecialize[0] = elementType;
CustomElementMatcher matcher = new CustomElementMatcher();
CustomContainerDescriptor descriptor = new CustomContainerDescriptor();
ISpecializationType specializedType = new SpecializationType("id", null, "name", toSpecialize, matcher, descriptor, new CustomFileHelperAdvice());
ElementTypeRegistry.getInstance().register(specializedType);
ClientContextManager.getInstance().getBinding(XsradElementTypes.Composite_2001).bindId("id");


My hope is that the "CustomFileHelperAdvice()" e.g. "protected ICommand getBeforeConfigureCommand(ConfigureRequest request)" execute when I drop my "custom_composite" entry on the diagram. But it doesn`t work!

What must I implement in "CustomElementMatcher implements IElementMatcher" and
"CustomContainerDescriptor implements IContainerDescriptor" ?

Make I wrong assumptions about the "AbstractEditHelperAdvice"?

Questions over questions (;

Is there a easy way to gain this functionality?

Thanks a lot!
Previous Topic:Contents of Compartment disappears after restarting Eclipse
Next Topic:Saving properties of a diagram
Goto Forum:
  


Current Time: Sun Jul 13 16:03:05 EDT 2025

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

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

Back to the top