Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » MultiPage Editor : swapping Action ContributorClasses
MultiPage Editor : swapping Action ContributorClasses [message #671316] Tue, 17 May 2011 09:36 Go to next message
Maqsood Ahmed is currently offline Maqsood Ahmed
Messages: 41
Registered: September 2010
Member
Hi all,

I have a MPE having a its Action Contributor Class. I then have added 'my editor' to this MPE, The MPE is not considering the added editor's Contributor Class(extends MultipageEditorActionBarContributor)..

My Question is
1) How do i swap Action ContributorClasses(Show/Hide/Disable Actions in the ActionBar) as and when my editor in this MPE is opened.
2) How to add Actions contributed my Editor's MPEABC to the existing action Bar

Best Regards,
Mak

Re: MultiPage Editor : swapping Action ContributorClasses [message #671348 is a reply to message #671316] Tue, 17 May 2011 11:28 Go to previous messageGo to next message
Paul Webster is currently offline Paul Webster
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

There is only one EditorActionBarContributor per editor, and your editor is the MultiPageEditorPart. You would have to write your own code to figure out what to add when your editor becomes the active page.

PW


Re: MultiPage Editor : swapping Action ContributorClasses [message #671880 is a reply to message #671348] Thu, 19 May 2011 04:57 Go to previous messageGo to next message
Maqsood Ahmed is currently offline Maqsood Ahmed
Messages: 41
Registered: September 2010
Member
Thanks Paul,

But the problem now is hw will i show/hide actions when other editors are opened inside this MPE? The Common Contirbutor would still be there, contirbuting all actions..
I cant access the editor's site while it is being initialized also(is null),
hence unable to disable the actions that i dont need.

There is this problem because, each time the MPE editor that opens up will be having different editor (as a page in this MPE). Can u give some leads to solve this problem.

Mak

[Updated on: Thu, 19 May 2011 05:07]

Report message to a moderator

(no subject) [message #671894 is a reply to message #671348] Thu, 19 May 2011 04:57 Go to previous messageGo to next message
Eclipse User
Originally posted by: <forums-noreply

Thanks Paul,

But the problem now is hw will i show/hide actions when other editors are opened inside this MPE? The Common Contirbutor would still be there, contirbuting all actions..
I cant access the editor's site while it is being initialized also(is null),
hence unable to disable the actions that i dont need.

Mak
Re: MultiPage Editor : swapping Action ContributorClasses [message #672002 is a reply to message #671880] Thu, 19 May 2011 10:41 Go to previous messageGo to next message
Paul Webster is currently offline Paul Webster
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Are you asking about actions contributed through each editors EditorActionBarContributors (possibly 2 per real editor)? Or are you asking about editors that add IActions to their IActionBars in their createPartControl(Composite) method?

In the first case, those contributions literally don't exist. There's no "I'll just point my MPEP at the original editor" API, because there are 2 many assumptions to host them correctly within an editor. If you want this case, the MPEP editor/EditorActionBarContributor has to re-implement everything it wants to swap in and out for each type of editor in its pages, and manage the whole thing itself.

In the second case, it looks like org.eclipse.ui.part.MultiPageEditorSite simply delegates to MPEP actionBars, which would mean the multiple editors in the MPEP would simple contribute all of their actions (they'd all be available while the MPEP was the active editor, regardless of what page it was on). In theory the MultiPageEditorSite is extendable, but I'm unless providing SubActionBars per site worked, I'm not sure what it would do.


PW


Re: MultiPage Editor : swapping Action ContributorClasses [message #692407 is a reply to message #672002] Mon, 04 July 2011 07:52 Go to previous message
E. Waldin is currently offline E. Waldin
Messages: 5
Registered: April 2010
Junior Member
Try taking a look at the eclipse corner article "Integrating EMF and GMF Generated Editors", in particular the section "Completing Menus and Toolbars". There is some nifty code for binding in the action bar contributors of the different editors. Look at TopicmapMultipageActionBarContributor and SubActionBarsExt. It's quite general. Just ignore all the stuff in the beginning about modifying the EMF editor. Hope this helps.

-Earl
Previous Topic:CVS ext "Unknown response received from cvs server:"
Next Topic:SAS MVADriver
Goto Forum:
  


Current Time: Fri Aug 29 08:27:36 EDT 2014

Powered by FUDForum. Page generated in 0.07518 seconds