getContextButtonPad is not running feature [message #849008] |
Wed, 18 April 2012 20:01 |
Josef Pohl Messages: 82 Registered: January 2012 |
Member |
|
|
Hi there,
I am trying to associate a Custom Feature with a context button on the ContexButtonPad. I seem to have two issues that I am not sure how to trouble shoot.
The first, and less troubling, is that the icon (which is registered through an image provider, hopefully correctly) is not showing up, but the location has a gray square instead. I have the image provider and registered the extensions in the plugin.xml. Is there anything else that I am missing?
The second issue is that the CustomFeature I registered with the button is not firing when I click on it.
The CustomFeature does actually work from the context menu derived from a right click on the GA.
I was modeling this code (below) partially on the instance from the sketch tool example. The tutorial shows examples for adding drag and drop features and collapse features (the latter with help of a createCollapseContextButton method). But there is nothing about adding a domain specific context button that is not one of these features.
The item I was not sure about is adding the feature to the button so I just did it in the constructor. Is this correct?
Thanks, as always!
Joe
@Override
public IContextButtonPadData getContextButtonPad(IPictogramElementContext context) {
IContextButtonPadData data = super.getContextButtonPad(context);
PictogramElement pe = context.getPictogramElement();
setGenericContextButtons(data, pe, CONTEXT_BUTTON_DELETE | CONTEXT_BUTTON_UPDATE);
// setting behavior
// behavior is defined in EgsndiagramBrowserFeature
ContextButtonEntry button;
CustomContext cc = new CustomContext(new PictogramElement[] {pe});
ICustomFeature[] cf = getFeatureProvider().getCustomFeatures(cc);
for (int i = 0; i < cf.length; i++){
ICustomFeature iCF = cf[i];
if (iCF instanceof EgsndiagramBrowserFeature) {
button = new ContextButtonEntry(iCF, context);
button.setText("View Referenced Document");
button.setDescription("Launch a browser to view referenced document");
button.setIconId(EgsnImageProvider.IMG_DOCUMENT);
data.getDomainSpecificContextButtons().add(button);
}
}
return data;
}
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.09927 seconds