|Copy/Paste not working in plugin, but in RCP [message #675862]
||Wed, 01 June 2011 18:28
| Heiko Mattes
Registered: June 2011
I am having a strange behavior regarding the cut/copy/paste actions when I use them in my editor. I'm using Eclipse in version 3.6.1. The skeleton of the editor is generated by EMF, using a MultiPageEditor. In it, there is a tree viewer with an AdapterFactoryTreeEditor extending class as an editing support.
Now, strangely, the text widget for editing doesn't recognize the keyboard shortcuts for cut/copy/paste. In the context menu on that widget however, the cut/copy/paste actions work.
So, after looking around and trying many things, I gave up to make it work properly and just registered a key listener on the text widget, listening for Strg+X/C/V and invoke the cut/copy/paste action 'manually' on the widget. This worked fine. I know it was a hack, but better then not working at all.
But now comes the strange part. Whenever I exported the code as a plugin to use in an Eclipse or used the runtime eclipse directly, the above mentioned behavior occurred. But if I instead export it as an RCP application, whenever I copy something in the text widget, it gets copied in twice. That means, my key listener is firing, but also the global action handler is working properly (at least that is what I think is happening).
As, the only thing that changes is, at least from my code, that the RCP-product plugin is added. So at first, I thought that in the ApplicationActionBarAdvisor class I added the cut/copy/paste action to correctly register and those where invoked. But, I don't create them there. I create some other actions, like save and undo, but not cut/copy/paste.
So, now I'm at a loss at why those two scenarios are working differently. The RCP application handles the widget correctly, but within Eclipse not. Why are they behaving differently? Those anybody know what could be the issue and how to either register my text widget right, so that I don't need the key listener hack? Or, if that is too difficult, the other way round so that cut/copy/paste is only done by the key listener? Help would be very appreciated.
Powered by FUDForum
. Page generated in 0.05406 seconds