Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » MultiPageEditorPart and menu contribution
MultiPageEditorPart and menu contribution [message #756649] Mon, 14 November 2011 10:13 Go to next message
Jan Krakora is currently offline Jan Krakora
Messages: 477
Registered: December 2009
Location: Prague
Senior Member
Hi guys,

I have an Editor part and several menu contributions with <visibleWhen> expression bounded to the activeEditorId property. It's working as expected, the menu is visible only when this editor is active.

Now I would like to create a multi page editor (MultiPageEditorPart). This multi page editor contains several editors and one of them is the editor part mentioned earlier. But when I select the tab containing the editor part, my menu contribution is not visible.

When I turn tracing on, I can see that the multi page editor part is the active editor all the time regardless of the selected tab. That's not what I've expected. I thought that when I select a tab containing an editor part, the multi page editor part activates (somehow) this editor part.

I'm I missing something?
Re: MultiPageEditorPart and menu contribution [message #756661 is a reply to message #756649] Mon, 14 November 2011 10:35 Go to previous messageGo to next message
Paul Webster is currently offline Paul Webster
Messages: 6850
Registered: July 2009
Location: Ottawa
Senior Member

You're seeing correctly. The MPEP is an editor, and the contained editors are not exposed to the workbench framework. It cannot see them as they are. The MPEP has to do the work to provide whatever commands its current active editor is.

PW


Re: MultiPageEditorPart and menu contribution [message #756674 is a reply to message #756661] Mon, 14 November 2011 11:03 Go to previous messageGo to next message
Jan Krakora is currently offline Jan Krakora
Messages: 477
Registered: December 2009
Location: Prague
Senior Member
Yes, but how to do that? Those nested editors can be contributed from 3rd party plugins, where its programmers use menu contributions as I wrote before. How can I(as the MPEP programmer), enable theirs menu contributions bounded to the activeEditorId property? Or it's just impossible?
Re: MultiPageEditorPart and menu contribution [message #756706 is a reply to message #756674] Mon, 14 November 2011 13:16 Go to previous messageGo to next message
Paul Webster is currently offline Paul Webster
Messages: 6850
Registered: July 2009
Location: Ottawa
Senior Member

In the main menu bar, you have 2 situations.

1) if they used org.eclipse.ui.menus to make their commands available and tied it to their editor ID, you'd have to provide something similar tied to the MPEP editor id. If they tied their handlers to their activeEditorId, I'm not sure there's much you can do as the handler wouldn't be available even if the menu item was. If they activated their handler through the IHandlerService from their site, that would continue to work.

2) if they used the EditorActionBarContributors to contribute actions instead, then you're out of luck without copying their code and doing all of the work they used to do.

PW



Re: MultiPageEditorPart and menu contribution [message #756812 is a reply to message #756706] Tue, 15 November 2011 04:04 Go to previous messageGo to next message
Jan Krakora is currently offline Jan Krakora
Messages: 477
Registered: December 2009
Location: Prague
Senior Member
Thank you
Re: MultiPageEditorPart and menu contribution [message #756881 is a reply to message #756812] Tue, 15 November 2011 07:32 Go to previous message
Paul Webster is currently offline Paul Webster
Messages: 6850
Registered: July 2009
Location: Ottawa
Senior Member

I'll just add that the work that is being done in Eclipse 4 is restructuring the framework so that an embedded editor like this can just continue to work as it did. But we won't be exposing that functionality fully until Eclipse 4.3.

PW


Previous Topic:Link to Indigo SR1 Delta Pack
Next Topic:Activity pattern binding to remove "Previous/Next Annotation" and "Last Edit Location
Goto Forum:
  


Current Time: Sat Apr 19 00:41:58 EDT 2014

Powered by FUDForum. Page generated in 0.01640 seconds