Customizing Context Menu (remove standard features) [message #714467] |
Wed, 10 August 2011 11:08  |
Eclipse User |
|
|
|
Hi,
I just finished the tutorial parts for Context Buttons and Context menus. It is possible to remove standard features of the Context Buttons. (e.g. just by not adding the remove button)
setGenericContextButtons(data, pe, CONTEXT_BUTTON_DELETE |
CONTEXT_BUTTON_UPDATE);
But i found no way to remove standard features of the context menu, if i dont need them.
How to remove the "Remove" - feature from the context menu?
[Updated on: Wed, 10 August 2011 11:10] by Moderator
|
|
|
|
|
|
|
|
|
Re: Customizing Context Menu (remove standard features) [message #1015708 is a reply to message #720417] |
Fri, 01 March 2013 15:50  |
Eclipse User |
|
|
|
Here's my solution to not adding "Remove" to context menu. "Delete" is still there, so this fix does meet my needs.
public class MyFeatureProvider extends DefaultFeatureProvider {
...
@Override
public IRemoveFeature getRemoveFeature(IRemoveContext context) {
/**
* return <code>NULL</code> will disable Remove action but at the same time disable Delete action, because delete uses remove.
*/
return new DefaultRemoveFeature(this) {
/*
* (non-Javadoc)
* @see org.eclipse.graphiti.features.impl.AbstractFeature#isAvailable(org.eclipse.graphiti.features.context.IContext)
*/
@Override
public boolean isAvailable(IContext context) {
return false;
}
};
}
}
[Updated on: Fri, 01 March 2013 15:50] by Moderator
|
|
|
Powered by
FUDForum. Page generated in 0.07396 seconds