Command Contribution to Form Editor toolbar -- possible? [message #486727] |
Fri, 18 September 2009 16:01  |
Eclipse User |
|
|
|
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
|
|
|
Re: Command Contribution to Form Editor toolbar -- possible? [message #486868 is a reply to message #486727] |
Sun, 20 September 2009 08:04   |
Eclipse User |
|
|
|
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
|
|
|
|
Re: Command Contribution to Form Editor toolbar -- possible? [message #487221 is a reply to message #487098] |
Tue, 22 September 2009 09:46  |
Eclipse User |
|
|
|
The with element is for accessing variables ... see org.eclipse.ui.ISources for a list of the main supported ones.
If your editor is supplying the object as its selection, then you can access it through "selection". if not, then you either have to 1) write a provider to provide your variable or 2) use a property tester on your editor that can access the object you want.
PW
|
|
|
Powered by
FUDForum. Page generated in 0.12492 seconds