Skip to main content



      Home
Home » Eclipse Projects » GEF » KeyHandler for Cut, Copy, Paste
KeyHandler for Cut, Copy, Paste [message #234966] Sat, 02 June 2007 06:54 Go to next message
Eclipse UserFriend
Originally posted by: rajmohanpk.hcl.in

Hi,

I'm using Eclipse GEF and RCP framework in developing an application, i
want to map the Ctrl+X, Ctrl+C, Ctrl+V keyboard actions for cut, copy,
paste operations respectively. I have tried the following keysequence and
it works, but i want to map it with the above standard actions.

sharedKeyHandler.put(KeyStroke.getPressed(SWT.CTRL, 0),

getActionRegistry().getAction(ActionFactory.CUT.getId()));

sharedKeyHandler.put(KeyStroke.getPressed(SWT.F2, 0),

getActionRegistry().getAction(ActionFactory.COPY.getId()));

sharedKeyHandler.put(KeyStroke.getPressed(SWT.F3, 0),

getActionRegistry().getAction(ActionFactory.PASTE.getId()));

Please let me know, how to do the same.

Thanks!,
Rajmohan
Re: KeyHandler for Cut, Copy, Paste [message #234977 is a reply to message #234966] Sat, 02 June 2007 07:03 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: rajmohanpk.hcl.in

Also i have tried the following code snippet, and it is *NOT* working.
sharedKeyHandler.put(
KeyStroke.getPressed( 'C', 0, SWT.CTRL ),

getActionRegistry().getAction(IWorkbenchActionConstants.COPY ));
sharedKeyHandler.put(
KeyStroke.getPressed( 'X', 0, SWT.CTRL ),

getActionRegistry().getAction(IWorkbenchActionConstants.CUT) );
sharedKeyHandler.put(
KeyStroke.getPressed( 'V', 0, SWT.CTRL ),

getActionRegistry().getAction(IWorkbenchActionConstants.PAST E));

Please Help.
Re: KeyHandler for Cut, Copy, Paste [message #234998 is a reply to message #234977] Sun, 03 June 2007 18:23 Go to previous message
Eclipse UserFriend
Hi,

You don't need to define the key binding for copy, paste etc actions,
which are common for the workbench, since the keybinding is already
defined for them and is exactly the same. You need to define retarget copy
action for youe editor.
( http://help.eclipse.org/help32/index.jsp?topic=/org.eclipse. platform.doc.isv/guide/wrkAdv_retarget.htm)

You can use Undo and Redo retarget actions from GEF's logic example editor
as an example.
Hope this helps.

Cheers,
Alex
Previous Topic:Thumbnail problem in RC1
Next Topic:Precise moves using keyboard
Goto Forum:
  


Current Time: Fri Jul 04 21:53:49 EDT 2025

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

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

Back to the top