Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Command Contribution to Form Editor toolbar -- possible?
Command Contribution to Form Editor toolbar -- possible? [message #486727] Fri, 18 September 2009 20:01 Go to next message
Millard Ellingsworth is currently offline Millard EllingsworthFriend
Messages: 14
Registered: July 2009
Junior Member
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 12:04 Go to previous messageGo to next message
Tom Seidel is currently offline Tom SeidelFriend
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
Re: Command Contribution to Form Editor toolbar -- possible? [message #487098 is a reply to message #486868] Mon, 21 September 2009 20:59 Go to previous messageGo to next message
Millard Ellingsworth is currently offline Millard EllingsworthFriend
Messages: 14
Registered: July 2009
Junior Member
That worked for getting the items on the toolbar, thanks.

What's not working is <enabled when> for these items. Not sure what the right <with> element would be nor how to make sure that it is passed properly to a property tester.

Essentially, I need a Save and Run button for a task that is described by the Editor contents. The platform handles the Save button correctly (disabled when not dirty). But I need to handle the Run button -- and for that I need to query the object that is in the editor. I have not been able to figure out how to wire that up yet (still). Any help on this would be much appreciated.

I also have a Run action on the View list of tasks and have no trouble wiring up the property tester there, where the <with> is the activeMenuSelection (for which Eclipse very kindly happens to hand me exactly the right class of object to work on).
Re: Command Contribution to Form Editor toolbar -- possible? [message #487221 is a reply to message #487098] Tue, 22 September 2009 13:46 Go to previous message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

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


Previous Topic:Extends ResourceNavigator deprecated
Next Topic:RCP Training Classes Open for Registration
Goto Forum:
  


Current Time: Wed Feb 05 16:50:00 GMT 2025

Powered by FUDForum. Page generated in 0.04110 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top