|
Re: Command Contribution to Form Editor toolbar -- possible? [message #486868 is a reply to message #486727] |
Sun, 20 September 2009 12:04 |
Tom Seidel Messages: 91 Registered: July 2009 |
Member |
|
|
Millard,
I don't know if the following is best practise, but I've implemented
menucontributions in a forms header within a viewpart with the following:
public void createPartControl(final Composite parent) {
...create controls, form, etc...
this.form.getToolBarManager().add(new
Separator(IWorkbenchActionConstants.MB_ADDITIONS));
IMenuService menuService = (IMenuService)
getSite().getService(IMenuService.class);
menuService.populateContributionManager((ContributionManager )
getToolbarManager(),
"formheading:" + getSite().getId()); //$NON-NLS-1$
this.form.getToolBarManager().update(true);
}
Afterwards you can use a locationURI "formheading:myViewId?after=additions"
I'm pretty sure this can be adopted to editorparts.
Cheerz
Tom
Millard Ellingsworth schrieb:
> I use the FormToolkit in my Editor. Is there any way to declaratively
> fill/adjust that toolbar? As best I can tell, there does not seem to
> be. I tried a similar approach to adding to the View (menuContribution
> for toolbar:<editorID>), but nothing shows up -- and none of the docs or
> blogs I've read ever discuss being able to do this.
>
> If it is possible, please enlighten me. If not, is there a way, using
> Categories or something else to declaratively identify the contents,
> then programmatically get that "container" and iterate over its
> contents, adding IContributionItems using
> form.getToolbarManager().add(IContributionItem)? I'm assuming they will
> behave (enableWhen) based on their Handlers still?
>
> Thanks...Millard
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04110 seconds