getContextButtonPad is not running feature [message #849008] |
Wed, 18 April 2012 16:01  |
Eclipse User |
|
|
|
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;
}
|
|
|
|
|
|
|
|
Re: getContextButtonPad is not running feature [message #855478 is a reply to message #854819] |
Tue, 24 April 2012 17:30  |
Eclipse User |
|
|
|
Thanks Michael,
That did the trick. Looking back I am not sure where, or why, I did that. But it appears Brian did a similar thing as well.
I resolved the image display thing as well. The icon I had in there was 128 x 128 not 16 x 16.
The bug report will be useful.
Thanks,
Joe
|
|
|
Powered by
FUDForum. Page generated in 0.05416 seconds