Home » Eclipse Projects » Eclipse Platform » Key binding, content assist, and multipage editors
Key binding, content assist, and multipage editors [message #298159] |
Wed, 25 January 2006 18:30  |
Eclipse User |
|
|
|
I've found other threads regarding content assist and key bindings but they
weren't too helpful for my particular situation.
I've created a multipage editor where one of the pages is a text editor
(similar to the manifest editor). I've tried add content assist to my text
editor but the Ctrl+Space key combination just does not work. I've
experimented and found that it works just fine when using a plan editor, but
when using a multipage editor, the content assist action does not get
executed at all.
Can anybody provide any insight?
Thanks in advance,
Albert
|
|
| |
Re: Key binding, content assist, and multipage editors [message #298225 is a reply to message #298174] |
Thu, 26 January 2006 13:32   |
Eclipse User |
|
|
|
In my current project, the key binding ctrl+space does not work. Also, it
does not appear in the menu. I've added it to the menu by using a
RetargetTextEditorAction within my implementation of
MultiPageEditorActionBarContributor.
I performed a small experiment by creating a new plugin with a multipage
editor (using the "New Plug-in Project" wizard) and only added the content
assist action to the text editor in the first page. The key binding works
properly.
After some investigation, I found the source of my problem. The issue is
that my text editor's key binding service was not activated, thus even
though the eclipse framework received the ctrl+space event (via
WorkbenchKeyboard.executeCommand() ), it didn't know about the handler for
that action. Digging further, I noticed that in my implementation of
multipage editor (extending MultiPageEditorPart), setFocus() was overrided,
but it never made a call to the super implementation
(MultiPageEditorPart.setFocus()). For those interested, it turns out this
is quite important. The implemention of MultiPageEditorPart.setFocus()
actives the key binding service of the active page if it is an editor.
Without this, the ctrl+space binding for content assist will fail to work.
So make sure you call the super implementation of setFocus() for a multipage
editor or remember to activate the key binding service.
If I have any of the details wrong, please feel free to correct me.
Cheers,
Albert
"Daniel Megert" <daniel.megert@eclipse.org> wrote in message
news:draauu$viu$1@utils.eclipse.org...
> Albert Huh? wrote:
>
>>I've found other threads regarding content assist and key bindings but
>>they weren't too helpful for my particular situation.
>>
>>I've created a multipage editor where one of the pages is a text editor
>>(similar to the manifest editor). I've tried add content assist to my
>>text editor but the Ctrl+Space key combination just does not work. I've
>>experimented and found that it works just fine when using a plan editor,
>>but when using a multipage editor, the content assist action does not get
>>executed at all.
>>
>>Can anybody provide any insight?
>>
> Does it work using the menu?
>
> Dani
>
>>Thanks in advance,
>>Albert
>>
>>
|
|
|
Re: Key binding, content assist, and multipage editors [message #298287 is a reply to message #298225] |
Fri, 27 January 2006 16:06   |
Eclipse User |
|
|
|
Originally posted by: douglas.pollock.magma.ca
Albert Huh? wrote:
> After some investigation, I found the source of my problem. The issue is
> that my text editor's key binding service was not activated, thus even
> though the eclipse framework received the ctrl+space event (via
> WorkbenchKeyboard.executeCommand() ), it didn't know about the handler for
> that action. Digging further, I noticed that in my implementation of
> multipage editor (extending MultiPageEditorPart), setFocus() was
> overrided, but it never made a call to the super implementation
> (MultiPageEditorPart.setFocus()). For those interested, it turns out this
> is quite important. The implemention of MultiPageEditorPart.setFocus()
> actives the key binding service of the active page if it is an editor.
> Without this, the ctrl+space binding for content assist will fail to work.
> So make sure you call the super implementation of setFocus() for a
> multipage editor or remember to activate the key binding service.
>
> If I have any of the details wrong, please feel free to correct me.
You have got it exactly right. Unfortunately, the activation of nested
services should have been done in a different method. One that doesn't say
"Subclasses may extend or reimplement." I have opened Bug 125567 to
address this issue.
cheers,
d.
|
|
|
Re: Key binding, content assist, and multipage editors [message #298615 is a reply to message #298287] |
Wed, 01 February 2006 12:31  |
Eclipse User |
|
|
|
Thanks for filing a bug report Doug.
Cheers,
Albert
"Douglas Pollock" <douglas.pollock@magma.ca> wrote in message
news:dre20o$b1g$1@utils.eclipse.org...
> Albert Huh? wrote:
>> After some investigation, I found the source of my problem. The issue is
>> that my text editor's key binding service was not activated, thus even
>> though the eclipse framework received the ctrl+space event (via
>> WorkbenchKeyboard.executeCommand() ), it didn't know about the handler
>> for
>> that action. Digging further, I noticed that in my implementation of
>> multipage editor (extending MultiPageEditorPart), setFocus() was
>> overrided, but it never made a call to the super implementation
>> (MultiPageEditorPart.setFocus()). For those interested, it turns out
>> this
>> is quite important. The implemention of MultiPageEditorPart.setFocus()
>> actives the key binding service of the active page if it is an editor.
>> Without this, the ctrl+space binding for content assist will fail to
>> work.
>> So make sure you call the super implementation of setFocus() for a
>> multipage editor or remember to activate the key binding service.
>>
>> If I have any of the details wrong, please feel free to correct me.
>
> You have got it exactly right. Unfortunately, the activation of nested
> services should have been done in a different method. One that doesn't
> say
> "Subclasses may extend or reimplement." I have opened Bug 125567 to
> address this issue.
>
>
>
> cheers,
> d.
>
|
|
|
Goto Forum:
Current Time: Tue Sep 02 19:04:54 EDT 2025
Powered by FUDForum. Page generated in 0.07772 seconds
|