Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Menu contribution to a nested editor
Menu contribution to a nested editor [message #539301] Thu, 10 June 2010 09:46 Go to next message
Mauro Condarelli is currently offline Mauro CondarelliFriend
Messages: 424
Registered: September 2009
Senior Member
Hi,
I have an editor (WorldEditor extends FormEditor) that, in one page
includes a custom TextEditor (SceneEditor extends
AbstractDecoratedTextEditor).

I added an entry to the context menu of this editor:
<menuContribution
locationURI="popup:#EditorContext?after=additions">
<command
commandId="it.condarelli.writer.commands.AddActor"
label="Add &amp;Actor"
style="push">
</command>
</menuContribution>

Now, in the handler of this command (AddActor extends AbstractHandler) I
need to get access to the Document being edited.

Is there a way to do it? all fields and variables in the event
(ExecutionEvent event) point to the main editor (WorldEditor) and not to
the nested one (SceneEditor). Following the links down to the needed
Document *is* possible, but extremely cumbersome.
I fear I'm missing something obvious.
What am I doing wrong?

If it matters:
WorldEditor is EMF based and edits a custom XML Resource.
This model (World) has, deep inside, a string (content).
This string is used as EditorInput (SceneEditorInput implements
IEditorInput) for the SceneEditor.

TiA
Mauro
Re: Menu contribution to a nested editor [message #540222 is a reply to message #539301] Tue, 15 June 2010 12:29 Go to previous message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

In a MultiPageEditorPart, the Eclipse Workbench can only see the "main"
editor, not the inner editors.

You would have to do something like:
if (editor instanceof WorldEditor) {
((WorldEditor)editor).getInnerEditorICareAbout();
}

Later,
PW

--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse .platform.doc.isv/guide/workbench.htm


Previous Topic:RCP plugins directory
Next Topic:How to trim down application size?
Goto Forum:
  


Current Time: Sat Dec 20 09:50:27 GMT 2014

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

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