Bug 428632 - EMBEDDED_TEXT_EDITOR_SCOPE stays active when using EmbeddedEditor within a view
Summary: EMBEDDED_TEXT_EDITOR_SCOPE stays active when using EmbeddedEditor within a view
Status: NEW
Alias: None
Product: TMF
Classification: Modeling
Component: Xtext (show other bugs)
Version: 2.5.1   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-02-20 06:12 EST by Tobias Baumann CLA
Modified: 2015-11-11 04:14 EST (History)
2 users (show)

See Also:


Attachments
Attachment containing pop_up_window.png, keyboard_binding.png, current EmbeddedEditorActions.java and new EmbeddedEditorActions.java (44.59 KB, application/x-zip-compressed)
2014-02-20 06:12 EST, Tobias Baumann CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tobias Baumann CLA 2014-02-20 06:12:37 EST
Created attachment 240145 [details]
Attachment containing pop_up_window.png, keyboard_binding.png, current EmbeddedEditorActions.java and new EmbeddedEditorActions.java

Hi.

I have an embedded xtext editor (created with EmbeddedEditorFactory) within a view part. During editing, e.g. pressing "Line end", an annoying window pops up (please see attachment).

This window appears because the same keyboard binding is registered for the same command (please see attachment). The shortcut have different scopes, but nevertheless the pop up window appears.

The reason for that is, that the EMBEDDED_TEXT_EDITOR_SCOPE gets activated during initialize and deactived on editor disposal in EmbeddedEditorActions. When using the embedded editor in a view, the EMBEDDED_TEXT_EDITOR_SCOPE stays active as long as the view is active.

I suggest to activate the context on focusGained and deactivate it on focusLost. Please see attachment showing my suggestion how to change the EmbeddedEditorActions.

Kind regards.
Comment 1 Sven Efftinge CLA 2014-02-20 06:26:38 EST
also the embedded editor scope should be a child of org.eclipse.ui.textEditorScope, which will help avoiding keybinding conflicts.
Comment 2 Sebastian Zarnekow CLA 2014-02-20 06:30:50 EST
(In reply to Sven Efftinge from comment #1)
> also the embedded editor scope should be a child of
> org.eclipse.ui.textEditorScope, which will help avoiding keybinding
> conflicts.

IIRC, that was not possible because the embedded editor is used in dialogs, too, e.g. the preference page
Comment 3 Sven Efftinge CLA 2014-02-20 07:20:47 EST
org.eclipse.ui.textEditorScope is a child of org.eclipse.ui.contexts.dialogAndWindow
Comment 4 Sebastian Zarnekow CLA 2014-02-20 16:32:14 EST
According to this comment in the context hierarchy on 'org.eclipse.ui.contexts.window' which is the direct parent of 'org.eclipse.ui.textEditorScope', textEditorScope will not work in dialogs:

<!--
   This is the root context for key bindings that should apply in
   windows (e.g., IWorkbenchWindow).  Key bindings in this context
   will only apply to windows (not dialogs).
-->

Maybe we need to set different contexts depending on the use case for the embedded editor?