|
Re: SWT Button as a command [message #892475 is a reply to message #892452] |
Thu, 28 June 2012 11:34 |
|
Hi Jan,
How to execute a command programmatically can be found here:
wiki.eclipse.org/Platform_Command_Framework#Executing_a_command_with_parameters
But by just invoking the command in i.e. a SelectionListener of the Button you would have manage the active and enabled state yourself.
The easiest solution for that is to use a Toolbarmanager, which is populated by the IMenuService :
IMenuService menuService = (IMenuService) PlatformUI.getWorkbench()
.getActiveWorkbenchWindow().getService(IMenuService.class);
ToolBar toolbar = new ToolBar(composite, SWT.NONE);
ToolBarManager tBManager = new ToolBarManager(toolbar);
menuService.populateContributionManager(tBManager,":::locationURI of your menuContribution:::");
tBManager.update(true);
Best regards,
Simon
[Updated on: Thu, 28 June 2012 11:36] Report message to a moderator
|
|
|
|
Re: SWT Button as a command [message #892497 is a reply to message #892452] |
Thu, 28 June 2012 13:10 |
|
Hi Jan,
this is correct
But please consider the update mechanism of the Command Contributions in a toolbar for which yuta kobayashi asked in the following post last friday...
www.eclipse.org/forums/index.php/t/365261/
In this post I described how to request an update concerning the state of the Contributions in a toolbar.
Best regards,
Simon
|
|
|
|
Powered by
FUDForum. Page generated in 0.02590 seconds