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 04:18  |
Eclipse User |
|
|
|
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 05:22   |
Eclipse User |
|
|
|
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 18:01  |
Eclipse User |
|
|
|
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
|
|
|
Goto Forum:
Current Time: Tue Jul 22 18:25:14 EDT 2025
Powered by FUDForum. Page generated in 0.05222 seconds
|