how to define enabledwhen of a self instantiated command ? [message #695153] |
Mon, 11 July 2011 06:14 |
heaad Messages: 1 Registered: July 2011 |
Junior Member |
|
|
hi,
I define a coolbar in my view using this code :
// define a CommandContributionItem
IWorkbenchWindow window = getSite().getWorkbenchWindow() ;
CommandContributionItemParameter p = new CommandContributionItemParameter(
window, "",
"myCommandID",
SWT.PUSH);
CommandContributionItem contributionItem = new CommandContributionItem( p );
// I define coolbar in my view
CoolBar coolBar = new CoolBar( coolBarContainer, SWT.FLAT );
final IToolBarManager toolbar = new ToolBarManager(SWT.FLAT | SWT.RIGHT);
// add my CommandContributionItem to the toolbar
toolbar.add( contributionItem ) ;
ToolBarContributionItem toolBarContributionItem = new ToolBarContributionItem( toolbar, "model") ;
toolBarContributionItem.fill(coolBar, 0) ;
In the same view ,there is a TreeViewer , the command should be enabled if and only if a certain type of node of the TreeViewer is selected.
how to define the enabledwhen of the command ?
thanks!
[Updated on: Mon, 11 July 2011 06:18] Report message to a moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.04222 seconds