Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » No automatic cut & paste in SWT widgets?
No automatic cut & paste in SWT widgets? [message #463797] Tue, 15 November 2005 11:06 Go to next message
arjan is currently offline arjanFriend
Messages: 3
Registered: July 2009
Junior Member
Hi,

I've added a number of (Text) widgets to a Texteditor, but copy and
paste doesn't work in them.

Why?

Grtz
Re: No automatic cut & paste in SWT widgets? [message #463801 is a reply to message #463797] Tue, 15 November 2005 12:05 Go to previous messageGo to next message
Veronika Irvine is currently offline Veronika IrvineFriend
Messages: 1272
Registered: July 2009
Senior Member
Ctrl+Insert and Shift+Insert probably work. Are cut, copy and paste still
on the context menu?

The native widgets support Ctrl+C and Ctrl+V, however if the application
overrides these accelerators (as Eclipse does) then the native capability is
disabled. Instead you must work with the application mechanism (e.g. the
Eclipse actions) to provide copy and paste.

"arjan" <arjan@mbuyu_dont_spam.nl> wrote in message
news:dlcf60$p61$1@news.eclipse.org...
> Hi,
>
> I've added a number of (Text) widgets to a Texteditor, but copy and paste
> doesn't work in them.
>
> Why?
>
> Grtz
Re: No automatic cut & paste in SWT widgets? [message #463872 is a reply to message #463801] Tue, 15 November 2005 12:39 Go to previous message
arjan is currently offline arjanFriend
Messages: 3
Registered: July 2009
Junior Member
Veronika Irvine wrote:
> Ctrl+Insert and Shift+Insert probably work. Are cut, copy and paste still
> on the context menu?
>
> The native widgets support Ctrl+C and Ctrl+V, however if the application
> overrides these accelerators (as Eclipse does) then the native capability is
> disabled.

Isn't there a way to enable this again?

I'm indeed building an Eclipse plug-in where I added a number of widgets
(StyledText's among other) to my custom editor that is derived from
TextEditor.

Basically, I'm doing this in the createSourceViewer method, where I
create widgets that have the Composite handed to me as the first
parameter of createSourceViewer as parent. One of the things I also do
in createSourceViewer is creating a SourceViewer derived class, which I
ultimately return in this method.

Al the widgets I create show up and behave as expected except that, like
I said, cut, copy, paste don't work.

I now circumvented this problem by overiding doOperation and
canDoOperation, and manually relaying ITextOperationTarget's CUT, COPY
and PASTE commands to my child widgets. This is quite a lot of work,
since especially for the canDoOperation I also need to track whether
each of my widgets has a text selection.

(as a side note: I run into another problem here, and that is that Text
does not seem to fire SelectionListener events when any content is
selected. I'm using a TextCellEditor now, and these DO fire on selection
but it's a different event: PropertyChangedEvent. Is this a bug? I
looked into the source of TextCellEditor and it seems to confirm this.)

The entire aproach seems a bit over the top. Does anyone knows how I can
add widgets to an editor and have cut/copy/paste work automatically?
(i.e. to re-enable it again).



> Instead you must work with the application mechanism (e.g. the
> Eclipse actions) to provide copy and paste.
>
> "arjan" <arjan@mbuyu_dont_spam.nl> wrote in message
> news:dlcf60$p61$1@news.eclipse.org...
>
>>Hi,
>>
>>I've added a number of (Text) widgets to a Texteditor, but copy and paste
>>doesn't work in them.
>>
>>Why?
>>
>>Grtz
>
>
>
Previous Topic:HTML "Like" Table support
Next Topic:ActiveX and SWT
Goto Forum:
  


Current Time: Fri Sep 20 09:17:36 GMT 2024

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

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

Back to the top