Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » KeyHandler for Cut, Copy, Paste
KeyHandler for Cut, Copy, Paste [message #234966] Sat, 02 June 2007 10: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 11: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 22:23 Go to previous message
Alex Boyko is currently offline Alex BoykoFriend
Messages: 200
Registered: July 2009
Senior Member
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:Display a UML Diagram using Draw2D Producing an error
Next Topic:Standalone GEF
Goto Forum:
  


Current Time: Sat Aug 20 06:48:44 GMT 2022

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

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

Back to the top