Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Keybinding problems when opening a text editor in a control
Keybinding problems when opening a text editor in a control [message #503926] Wed, 16 December 2009 13:57 Go to next message
Jan Koehnlein is currently offline Jan KoehnleinFriend
Messages: 657
Registered: July 2009
Senior Member
Hi,

I've embedded a textual (Xtext) editor in a graphical (GMF) editor to
allow combined textual/graphical editing. The text editor shows a
section of the textual representation of the same file. It pops up in a
small control if a diagram element is edited and closes on a defined key
sequence.

So the speciality of this case is that an editor is not opened in a
IWorkbenchPage but in a separate control. Most of it works fine, but
some keybinding issues remain:

To instantiate the Xtext editor I need an IEditorSite. I have tried two
options: Reuse the one from the diagram editor or create my own. In the
first case, after closing the popup Xtext editor the keybindings of the
parent diagram editor are lost, e.g. CTRL-S no longer works. Switching
to another part an back keybindings are restored. In the second case,
the Xtext specific keybindings are not activated in the popup editor, so
CTRL-SPACE for code assist does not work. Into the bargain, creating a
new IEditorSite is not possible without using internal API. It is
usually created by the runtime when activating an editor in a workbench
page.

The keybinding problem seems to be a missing context switch when opening
/ closing the XtextEditor. Debugging I found that a command for content
assist is there but has a null handler.

The editor's controls are created as children of the diagram control
using something like
xtextEditor.createPartControl(diagramParentComposite);
After editing, the editor is closed using
xtextEditor.dispose();
xtextEditorComposite.dispose();

Any ideas pointers are welcome. Am I approaching the problem completely
the wrong way?

Regards
Jan

--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com
Re: Keybinding problems when opening a text editor in a control [message #503992 is a reply to message #503926] Wed, 16 December 2009 13:16 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

it comes from trying to next a part within another part. It's just not
supported in 3.x. I don't think you'll be able to do much without
hacking internals. You could look at MultiPageEditorPart (and its inner
sites and inner services).

If you can get that working, though, you'll still have to mediate
between your main editor and your inner editor (there's no way to
disable the main editor keybindings while your inner editor is up, so
they had better just work or you'll have to swap around the context
hierarchy so that there are no conflicts).

If you make progress we'd love to hear about it.

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


Re: Keybinding problems when opening a text editor in a control [message #504109 is a reply to message #503992] Thu, 17 December 2009 10:04 Go to previous messageGo to next message
Jan Koehnlein is currently offline Jan KoehnleinFriend
Messages: 657
Registered: July 2009
Senior Member
Oh, thanks for your answer, even though it's bad news :-(

Could you nevertheless give me a hint how to switch the context or
enable certain keybindings "manually"? All my efforts so far were not
very fruitful.

I think to have figured out that this usually happens in
BindingManager.recomputeBindings()
which in the default case is called as an effect of a chain of mainly
internal listeners.

Any hints are welcome!

Cheers
Jan

Paul Webster schrieb:
> it comes from trying to next a part within another part. It's just not
> supported in 3.x. I don't think you'll be able to do much without
> hacking internals. You could look at MultiPageEditorPart (and its inner
> sites and inner services).
>
> If you can get that working, though, you'll still have to mediate
> between your main editor and your inner editor (there's no way to
> disable the main editor keybindings while your inner editor is up, so
> they had better just work or you'll have to swap around the context
> hierarchy so that there are no conflicts).
>
> If you make progress we'd love to hear about it.
>
> PW
>
>


--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com
Re: Keybinding problems when opening a text editor in a control [message #505921 is a reply to message #504109] Tue, 05 January 2010 14:56 Go to previous message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Jan Kšoehnlein wrote:
> Oh, thanks for your answer, even though it's bad news :-(
>
> Could you nevertheless give me a hint how to switch the context or
> enable certain keybindings "manually"? All my efforts so far were not
> very fruitful.
>
> I think to have figured out that this usually happens in
> BindingManager.recomputeBindings()
> which in the default case is called as an effect of a chain of mainly
> internal listeners.
>

It's a change in the contexts that cause the binding manager to
re-compute the bindings.

org.eclipse.ui.part.MultiPageEditorPart.activateSite() deactivates one
inner site and activates the new inner site ... the
NestableContextService would then swap active contexts, which cause the
keybindings to be updated ... if it was done correctly :-)

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 app has horrible remote performance
Next Topic:PropertyTester
Goto Forum:
  


Current Time: Mon Nov 24 21:38:26 GMT 2014

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

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