Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » Keyboard Listener
Keyboard Listener [message #277192] Mon, 06 December 2004 10:53 Go to next message
Eclipse UserFriend
Originally posted by: brendan.moorehead.gmail.com

i wish to attach a keyboard listener to the current editor
i have a listener setup so i always know the current editor
i have also created my key listener
however i do not know where to add this listener
please can someone tell me where to call this code

cheers
Re: Keyboard Listener [message #277205 is a reply to message #277192] Mon, 06 December 2004 14:37 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: douglas.pollock.magma.ca

Brendan Moorehead wrote:
> i wish to attach a keyboard listener to the current editor
> i have a listener setup so i always know the current editor
> i have also created my key listener
> however i do not know where to add this listener
> please can someone tell me where to call this code


Why? :)


It sounds like you just want to define a command and key binding in XML.
Look at the plugin.xml for "org.eclipse.ui" for examples. Once you have
that, you can call
"workbench.getCommandSupport().addHandlerSubmission(...)" to get your code
hooked up to the command. Remove to remove the handler when you're done,
or you will leak memory.


I'm not sure how you would attach a key listener to an editor, unless you
created it yourself.



cheers,
d.
Re: Keyboard Listener [message #277227 is a reply to message #277205] Tue, 07 December 2004 03:04 Go to previous message
Eclipse UserFriend
Originally posted by: brendan.moorehead.gmail.com

i need to listen for cuy, copy & paste shortcuts - CTRL + C, CTRL + X,
CTRL + V
my setting a global action handler it only gets the action from the toolbar
it is not my editor i need to listen for, its any active edtior
so i need a keyboard listener, which is added dynamically to
whatever the current editor is


Douglas Pollock wrote:

> Brendan Moorehead wrote:
>> i wish to attach a keyboard listener to the current editor
>> i have a listener setup so i always know the current editor
>> i have also created my key listener
>> however i do not know where to add this listener
>> please can someone tell me where to call this code


> Why? :)


> It sounds like you just want to define a command and key binding in XML.
> Look at the plugin.xml for "org.eclipse.ui" for examples. Once you have
> that, you can call
> "workbench.getCommandSupport().addHandlerSubmission(...)" to get your code
> hooked up to the command. Remove to remove the handler when you're done,
> or you will leak memory.


> I'm not sure how you would attach a key listener to an editor, unless you
> created it yourself.



> cheers,
> d.
Previous Topic:REPOST: How to load a plugin programatically?
Next Topic:How servlet access plugin of Eclipse
Goto Forum:
  


Current Time: Fri May 09 22:51:14 EDT 2025

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

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

Back to the top