|Copy and paste problems in ToolBar Text widget [message #557847]
||Thu, 09 September 2010 08:30
| Andreas Scherer
Registered: September 2010
I want to add in the Eclipse status line a new ToolBar containing a Text widget that supports full copy and paste functions. The creation of the ToolBar succeeds (using the extension point org.eclipse.ui.menus), but unfortunately the copy and paste actions are not handled by the Text widget of my ToolBar but by the active workbench part. That means that if for example the active workbench part is an editor, then I can select my Text widget, write text in it, but when pressing CTRL+P the content of the clipboard is inserted somewhere into the editor text instead of my widget.
My first fix tried to get the active workbench part, and in case it's an editor, get its action bars, and as soon as my Text widget gets the focus, set new global action handlers.
My second fix tried to call the handler service (IHandlerService), and as soon as my Text widget gets the focus, activate new handlers for the command ids (like org.eclipse.ui.edit.paste).
I also thought about changing what is active in my workbench window, but all these fixes did now work properly, so I tried another fix: I implemented a new command, defined it with the extension point org.eclipse.ui.commands, then I defined new key bindings for CTRL+C/V/X with extension point org.eclipse.ui.bindings, I defined a new context for my key bindings, and as soon as my Text widget gets the focus, I activate the context.
This solution works fine with copy and paste, but I see that there are some more editor functions like CTRL+SHIFT+LEFT/RIGHT to select words, and such functions still do not work properly. It would be ok if these editor function would not work at all, but it is somehow weird that editing text in my Text widget and pressing CTRL+SHIFT+LEFT selects text somewhere else in the active editor.
What is the best solution for this problem?
Powered by FUDForum
. Page generated in 0.02865 seconds