Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » How to add keydown/up event listener on eclipse rcp editor view?
How to add keydown/up event listener on eclipse rcp editor view? [message #925065] Thu, 27 September 2012 06:39 Go to next message
Liudas Sodas is currently offline Liudas Sodas
Messages: 7
Registered: September 2012
Junior Member
So I basically need to get key press up/down event from eclipse editor view. I googled it for couple hours but only found keypress events from shell (like here www.java2s.com/Tutorial/Java/0280__SWT/Geteventtype.htm). But this method do not work in/from editor view. So maybe some one knows how to add keypress event listener in editor?

P.S. I'm using eclipse 4.2.

Thanks in advance
Re: How to add keydown/up event listener on eclipse rcp editor view? [message #925254 is a reply to message #925065] Thu, 27 September 2012 10:37 Go to previous message
Liudas Sodas is currently offline Liudas Sodas
Messages: 7
Registered: September 2012
Junior Member
I found out the way (thanks guys in irc)

// ITextEditor editor;
((StyledText)editor.getAdapter(org.eclipse.swt.widgets.Control.class)).addKeyListener(new KeyListener() {
	
	@Override
	public void keyReleased(KeyEvent e) {
		System.out.println("key release ");
	}
	
	@Override
	public void keyPressed(KeyEvent e) {
		System.out.println("key pressed ");
	}
});
Previous Topic:Juno GMF-RCP Application Won't Export from Product
Next Topic:Loading an encrypted file
Goto Forum:
  


Current Time: Thu Aug 28 11:33:13 EDT 2014

Powered by FUDForum. Page generated in 0.01538 seconds