Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » ctrl-c / ctrl-v detection
ctrl-c / ctrl-v detection [message #444178] Fri, 10 February 2006 11:46 Go to next message
Carmelo  is currently offline Carmelo Friend
Messages: 224
Registered: July 2009
Senior Member
Hi all
Having trouble to get the CTRL-C from a tree

I have my rcp with the copy/paste action .
Sure there is something I'm missing .

In my view I have got a TreeViewer (with my tree widget)

I have 2 actions defined - copy and paste .

Both have been hooked with the global action .

bars.setGlobalActionHandler(ActionFactory.COPY.getId(),
copyAction);
bars.setGlobalActionHandler(ActionFactory.PASTE.getId(),
pasteAction);

Trying at this point to add the key listener to my tree component

viewer.getControl().addKeyListener(new
KeyAdapter()
{
public void keyPressed(KeyEvent event)
.

What should I have to check at this point to be able to get the ctrl-c
ctrl-v sequence so that I can run the copy/pasteaction?

I have the feeling, from printing the event, that I can only get the
SWT.CTRL . :-(

Any help would be appreciated.

Regards,
Kar
Re: ctrl-c / ctrl-v detection [message #444940 is a reply to message #444178] Fri, 24 February 2006 19:11 Go to previous message
Jeff Magill is currently offline Jeff MagillFriend
Messages: 15
Registered: July 2009
Junior Member
> Both have been hooked with the global action .
>
> bars.setGlobalActionHandler(ActionFactory.COPY.getId(),
> copyAction);
> bars.setGlobalActionHandler(ActionFactory.PASTE.getId(),
> pasteAction);

The copyAction is going to receive the event, not your tree. The
copyAction object should execute the operations you intended to put in
the keyPressed method.

The undo view in the SDK has examples that illustrate this. The undo
example is org.eclipse.ui.examples.undo in the org.eclipse.sdk.examples
plugin. I can't remember if I had to install the standalone examples to
get this or not. Search for "sdk examples" in the help contents of the SDK.

Setting a global action handler seems to mean that no widget in your
view will receive the hotkey events. Once the global action handler
handles the hotkey, the workbench considers that event to be processed
(doit set to false in the Event object). Someone PLEASE correct me if
I'm wrong about this (I would like to be wrong).

This creates a problem in that if you have other widgets in your view
that you would like to receive the hotkeys directly, they won't, because
the global action handler eats those events.

Apparently, the point of the TextActionHandler is to deal with this
issue, but I don't know what the complete solution is (such as for combo
boxes). Also, there is no undo and redo methods on Text so you can't
have both a global action handler and the widgets native local undo
handling.

It seems that setting a global action handler requires that you handle
all the hotkey actions explicitly even if it would make sense from a
user's point of view if the editing history were completely local for
some of the widgets.

Jeff
Previous Topic:List with images
Next Topic:SaxParser does not find a referenced DTD in Plugin
Goto Forum:
  


Current Time: Wed Nov 13 02:17:43 GMT 2024

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

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

Back to the top