Skip to main content



      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 05:46 Go to next message
Eclipse UserFriend
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 08:29 Go to previous message
Eclipse UserFriend
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 Jul 05 00:10:50 EDT 2025

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

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

Back to the top