Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » Overriding Eclipse default Key listener [Solved](How can I override the default Key listener?)
Overriding Eclipse default Key listener [Solved] [message #501629] Thu, 03 December 2009 08:08 Go to next message
Goran is currently offline GoranFriend
Messages: 6
Registered: December 2009
Junior Member
Hi !

I was wondering if it is possible to override Eclipse own "internal default" Key listener?

I have made a key listener that checks for CTRL+SHIFT+END
and it works ok, but Eclipse also reacts to it and does its thing
(marking text from cursor to end of page) in editor window.

This two actions (Eclipse and mine) 'collides'.

I have tried with keyevent.doit = false
but to no avail.

(Besides isn't that .doit for my listener and not Eclipse default listener?)

So, anyone with knowledge/experiences/ideas as to how to prevent Eclipse form reacting on "my" keybinding(s).

BR Goran

[Updated on: Fri, 11 December 2009 03:52]

Report message to a moderator

Re: Overriding Eclipse default Key listener [message #501829 is a reply to message #501629] Thu, 03 December 2009 23:33 Go to previous messageGo to next message
Lars Vogel is currently offline Lars VogelFriend
Messages: 1098
Registered: July 2009
Senior Member

Hi,

you can define your own schema:

http://www.vogella.de/articles/EclipseCommands/article.html# keybinding

Best regards, Lars

--
http://www.vogella.de/ - Eclipse plugin and Eclipse RCP Tutorials
http://www.twitter.com/vogella - vogella on Twitter

Goran wrote:
> Hi !
>
> I was wondering if it is possible to override Eclipse own "internal
> default" Key listener?
>
> I have made a key listener that checks for CTRL+SHIFT+END
> and it works ok, but Eclipse also reacts to it and does its thing
> (marking text from cursor to end of page) in editor window.
>
> This two actions (Eclipse and mine) 'collides'.
>
> I have tried with keyevent.doit = false
> but to no avail.
>
> (Besides isn't that .doit for my listener and not Eclipse default
> listener?)
>
> So, anyone with knowledge/experiences/ideas as to how to prevent Eclipse
> form reacting on "my" keybinding(s).
>
> BR Goran
>
Re: Overriding Eclipse default Key listener [message #502205 is a reply to message #501829] Mon, 07 December 2009 09:03 Go to previous messageGo to next message
Goran is currently offline GoranFriend
Messages: 6
Registered: December 2009
Junior Member
Hi Lars !

Making a schema doesn't seem to help.

I have made a plugin that has a modified editor and I tried both making my own keylistener (as previously mentioned)
and also tried to bind command with a handler and a binding (to no avail).
I now have made a new schema and tried the binding (Ctrl+Shift+End) there but still Eclipse does it's own thing
just after mine thereby erasing my wanted result. I am clueless atm :-/.

Is there a way to get some 'message' when Eclipse own internal listener has executed a command maybe?
If so maybe I could let that trigger my command. I don't want to poke in "Eclipse internal code"..

Thankful for any help !

BR Goran


Lars Vogel wrote on Thu, 03 December 2009 18:33
Hi,

you can define your own schema:

http://www.vogella.de/articles/EclipseCommands/article.html# keybinding

Best regards, Lars

--
http://www.vogella.de/ - Eclipse plugin and Eclipse RCP Tutorials
http://www.twitter.com/vogella - vogella on Twitter
>

Re: Overriding Eclipse default Key listener [message #502414 is a reply to message #502205] Tue, 08 December 2009 04:59 Go to previous messageGo to next message
Lars Vogel is currently offline Lars VogelFriend
Messages: 1098
Registered: July 2009
Senior Member

Hi,

you can check the keybindings, see:
http://www.vogella.de/articles/EclipseCodeAccess/article.htm l#keybindings

Perhaps this helps.

Best regards, Lars

Goran wrote:
> Hi Lars !
>
> Making a schema doesn't seem to help.
>
> I have made a plugin that has a modified editor and I tried both making
> my own keylistener (as previously mentioned)
> and also tried to bind command with a handler and a binding (to no
> avail). I now have made a new schema and tried the binding
> (Ctrl+Shift+End) there but still Eclipse does it's own thing
> just after mine thereby erasing my wanted result. I am clueless atm :-/.
>
> Is there a way to get some 'message' when Eclipse own internal listener
> has executed a command maybe?
> If so maybe I could let that trigger my command. I don't want to poke in
> "Eclipse internal code"..
>
> Thankful for any help !
>
> BR Goran
>
>
> Lars Vogel wrote on Thu, 03 December 2009 18:33
>> Hi,
>>
>> you can define your own schema:
>>
>> http://www.vogella.de/articles/EclipseCommands/article.html# keybinding
>>
>> Best regards, Lars
>>
>> --
>> http://www.vogella.de/ - Eclipse plugin and Eclipse RCP Tutorials
>> http://www.twitter.com/vogella - vogella on Twitter
>> >
>
>




--
http://www.vogella.de/ - Eclipse plugin and Eclipse RCP Tutorials
http://www.twitter.com/vogella - vogella on Twitter
Re: Overriding Eclipse default Key listener [message #502477 is a reply to message #502414] Tue, 08 December 2009 13:24 Go to previous messageGo to next message
Goran is currently offline GoranFriend
Messages: 6
Registered: December 2009
Junior Member
Hi Lars !

I got the expected output except the last line with the function.
Could I have missed some setting?

Output in Console:

KEYS >>> Listener.handleEvent(type = KeyDown, stateMask = 0x0, keyCode = 0x40000, time = 22719658, character = 0x0)
KEYS >>> Listener.handleEvent(type = KeyDown, stateMask = 0x40000, keyCode = 0x20000, time = 22719938, character = 0x0)
KEYS >>> Listener.handleEvent(type = KeyDown, stateMask = 0x60000, keyCode = 0x1000008, time = 22720157, character = 0x0)
KEYS >>> WorkbenchKeyboard.press(potentialKeyStrokes = [CTRL+SHIFT+END, CTRL+, CTRL+SHIFT+])

Also regarding the schema - I might have put the
plugin_customization.ini file at the wrong place, will get
back on this once I am sure I got it in the right place.


also, Thank You for Your time and expertise !

BR Goran

Lars Vogel wrote on Mon, 07 December 2009 23:59
Hi,

you can check the keybindings, see:
http://www.vogella.de/articles/EclipseCodeAccess/article.htm l#keybindings

Perhaps this helps.

Best regards, Lars


icon7.gif  Re: Overriding Eclipse default Key listener [Solved] [message #503156 is a reply to message #502477] Fri, 11 December 2009 08:52 Go to previous messageGo to next message
Goran is currently offline GoranFriend
Messages: 6
Registered: December 2009
Junior Member

Hi !

Problem solved !

I overlooked a Key Released event Embarrassed

So all Lars suggestions worked, but was "overwritten"
by the key released event.

BR Goran
Re: Overriding Eclipse default Key listener [Solved] [message #503322 is a reply to message #503156] Fri, 11 December 2009 20:41 Go to previous message
Lars Vogel is currently offline Lars VogelFriend
Messages: 1098
Registered: July 2009
Senior Member

Hi,

I'm glad to here that your example works. :-)

Cheers, Lars


--
http://www.vogella.de/ - Eclipse plugin and Eclipse RCP Tutorials
http://www.twitter.com/vogella - vogella on Twitter



On 11.12.2009 00:52, Goran wrote:
>
> Hi !
>
> Problem solved !
>
> I overlooked a Key Released event :blush:
> So all Lars suggestions worked, but was "overwritten"
> by the key released event.
>
> BR Goran
Previous Topic:Ant script doesn't get same classpath in Eclipse as on command line
Next Topic:Launch debug configuration after startup
Goto Forum:
  


Current Time: Mon Sep 23 13:24:11 GMT 2024

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

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

Back to the top