"paste" listener on a SWT widget

Posted by Fredrik on Stack Overflow See other posts from Stack Overflow or by Fredrik
Published on 2010-05-31T15:53:43Z Indexed on 2010/05/31 18:53 UTC
Read the original article Hit count: 252

Filed under:
|

I have an application with a SWT widget, say a org.eclipse.swt.widgets.Text, and want to add some control to the paste function.

The idea is that if the user can paste a string of IDs, I detect that, run some code and paste the object that corresponds to the IDs.

So I'm looking for some "ClipBoardListener" of some sort to add to my widget, but that doesnt seem to exist. A keylistener would only trap the pastes done by key and then you would have to deal with different key combos for pasting in different OS's.

Based on this java 1.2 question I tried subclassing the text class and override the inser method, but that didnt work

Exception in thread "main" org.eclipse.swt.SWTException: Subclassing not allowed

Seemed like an ugly solution anyway.

© Stack Overflow or respective owner

Related posts about eclipse

Related posts about swt