Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Cut / Copy / Paste - Disable / Enable handlers
Cut / Copy / Paste - Disable / Enable handlers [message #544952] Tue, 06 July 2010 08:18 Go to next message
Helmut Neubauer is currently offline Helmut NeubauerFriend
Messages: 54
Registered: July 2009
Member
Hello,

I'm using the default commands org.eclipse.ui.edit.cut,
org.eclipse.ui.edit.copy and org.eclipse.ui.edit.paste (and the default
handlers) for text in a extended StyledText class overwriting the
methods cut, copy and paste.

In my RCP application, they are always enabled, but I want them to be
enabled only if it is reasonable like in the Eclipse IDE itself:

Copy and cut should only be enabled if there is some text selected and
paste only if there is some text in the clipboard.

How is this possible?

Thanks
Re: Cut / Copy / Paste - Disable / Enable handlers [message #545763 is a reply to message #544952] Fri, 09 July 2010 00:27 Go to previous messageGo to next message
Wim Jongman is currently offline Wim JongmanFriend
Messages: 423
Registered: July 2009
Senior Member
Hi Helmut,

your handler needs an enabledwhen clause with an attached "test" in
combination with a class in the propertytester extension point. The
propertytester can test if there is something in the buffer.

Before that, you might want to fiddle around with the setenabled and
isenabled methods of the handler.

Regards,

Wim


> Hello,
>
> I'm using the default commands org.eclipse.ui.edit.cut,
> org.eclipse.ui.edit.copy and org.eclipse.ui.edit.paste (and the default
> handlers) for text in a extended StyledText class overwriting the
> methods cut, copy and paste.
>
> In my RCP application, they are always enabled, but I want them to be
> enabled only if it is reasonable like in the Eclipse IDE itself:
>
> Copy and cut should only be enabled if there is some text selected and
> paste only if there is some text in the clipboard.
>
> How is this possible?
>
> Thanks
Re: Cut / Copy / Paste - Disable / Enable handlers [message #545817 is a reply to message #545763] Fri, 09 July 2010 09:22 Go to previous messageGo to next message
Helmut Neubauer is currently offline Helmut NeubauerFriend
Messages: 54
Registered: July 2009
Member
Hi Wim,

thanks for your answer, but actually I don't use my own handler.
Actually the default handlers are used. I thought, I can avoid to
implement my own handler, because I'v overwritten the copy, cut and
paste methods of the widget. That works ok, except of the described
problem.

The Eclipse IDE itself enables and disabled the states of cut, copy and
paste, too. So I thought I don't have to anything except adding the
default commands to my menu bar and overwriting the widgets methods.

But perhaps, it's better to use own commands with own handlers?

Regards,
Helmut


Am 09.07.2010 02:27, schrieb Wim Jongman:
> Hi Helmut,
>
> your handler needs an enabledwhen clause with an attached "test" in
> combination with a class in the propertytester extension point. The
> propertytester can test if there is something in the buffer.
>
> Before that, you might want to fiddle around with the setenabled and
> isenabled methods of the handler.
>
> Regards,
>
> Wim
>
>
>> Hello,
>>
>> I'm using the default commands org.eclipse.ui.edit.cut,
>> org.eclipse.ui.edit.copy and org.eclipse.ui.edit.paste (and the default
>> handlers) for text in a extended StyledText class overwriting the
>> methods cut, copy and paste.
>>
>> In my RCP application, they are always enabled, but I want them to be
>> enabled only if it is reasonable like in the Eclipse IDE itself:
>>
>> Copy and cut should only be enabled if there is some text selected and
>> paste only if there is some text in the clipboard.
>>
>> How is this possible?
>>
>> Thanks
Re: Cut / Copy / Paste - Disable / Enable handlers [message #551027 is a reply to message #545817] Wed, 04 August 2010 22:01 Go to previous message
Wim Jongman is currently offline Wim JongmanFriend
Messages: 423
Registered: July 2009
Senior Member
Hi Helmut,

Sorry for the delay. No it should not. I guess your widget does not play well
in a Q&A that the default handlers play and are therefore by default enabled.
The enabled state of the handler can be checked by a propertytester. Does
this give you some clues to investigate? Please send me mail if you reply.

> Hi Wim,
>
> thanks for your answer, but actually I don't use my own handler.
> Actually the default handlers are used. I thought, I can avoid to
> implement my own handler, because I'v overwritten the copy, cut and
> paste methods of the widget. That works ok, except of the described
> problem.
>
> The Eclipse IDE itself enables and disabled the states of cut, copy and
> paste, too. So I thought I don't have to anything except adding the
> default commands to my menu bar and overwriting the widgets methods.
>
> But perhaps, it's better to use own commands with own handlers?
>
> Regards,
> Helmut
>
>
> Am 09.07.2010 02:27, schrieb Wim Jongman:
>> Hi Helmut,
>>
>> your handler needs an enabledwhen clause with an attached "test" in
>> combination with a class in the propertytester extension point. The
>> propertytester can test if there is something in the buffer.
>>
>> Before that, you might want to fiddle around with the setenabled and
>> isenabled methods of the handler.
>>
>> Regards,
>>
>> Wim
>>
>>
>>> Hello,
>>>
>>> I'm using the default commands org.eclipse.ui.edit.cut,
>>> org.eclipse.ui.edit.copy and org.eclipse.ui.edit.paste (and the default
>>> handlers) for text in a extended StyledText class overwriting the
>>> methods cut, copy and paste.
>>>
>>> In my RCP application, they are always enabled, but I want them to be
>>> enabled only if it is reasonable like in the Eclipse IDE itself:
>>>
>>> Copy and cut should only be enabled if there is some text selected and
>>> paste only if there is some text in the clipboard.
>>>
>>> How is this possible?
>>>
>>> Thanks
Previous Topic:Button at Status Bar
Next Topic:Customizing View Title Area
Goto Forum:
  


Current Time: Tue Apr 16 22:20:27 GMT 2024

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

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

Back to the top