Programmatic enablement of declarative actions [message #323909] |
Sat, 12 January 2008 06:06  |
Eclipse User |
|
|
|
Originally posted by: malloovidio.bluewin.ch
Hi all!
I am writing an RCP application targeting Eclipse 3.2 in which I have
a view containing a single table displaying some search results.
At start-up, the table is filled with some default user-specific
entries.
This initial setup can be restored at any time by running an IAction
which has been contributed to the view's toolbar and menu through the
plugin.xml file.
Our customer wants the restore-action to be disabled whenever the
currently shown search results are the default ones. So, after running
the restore-action, the action should be disabled and re-enabled
whenever the user changes the search results by any means (e.g. by a
custom search action).
From what I see, my enablement requirements cannot be expressed in the
plugin.xml file as they are not expressible in terms of selections or
system properties or the like. Therefore, I guess I should control the
enablement programmatically but how to do this for a declarative action?
Or should I better make my restore-action programmatic right from the
beginning? (the reason why I would prefer to declare it in the
plugin.xml file is that I have some other, related, actions which are
all in the plugin.xml file).
Well, I hope my question is clear and thanks in advance for any help!
Regards,
Ovidio
|
|
|
Re: Programmatic enablement of declarative actions [message #323910 is a reply to message #323909] |
Sat, 12 January 2008 07:20   |
Eclipse User |
|
|
|
Originally posted by: fakemail.xyz.de
Ovidio Mallo schrieb:
> Hi all!
>
> I am writing an RCP application targeting Eclipse 3.2 in which I have
> a view containing a single table displaying some search results.
> At start-up, the table is filled with some default user-specific
> entries.
> This initial setup can be restored at any time by running an IAction
> which has been contributed to the view's toolbar and menu through the
> plugin.xml file.
>
> Our customer wants the restore-action to be disabled whenever the
> currently shown search results are the default ones. So, after running
> the restore-action, the action should be disabled and re-enabled
> whenever the user changes the search results by any means (e.g. by a
> custom search action).
>
> From what I see, my enablement requirements cannot be expressed in the
> plugin.xml file as they are not expressible in terms of selections or
> system properties or the like. Therefore, I guess I should control the
> enablement programmatically but how to do this for a declarative action?
> Or should I better make my restore-action programmatic right from the
> beginning? (the reason why I would prefer to declare it in the
> plugin.xml file is that I have some other, related, actions which are
> all in the plugin.xml file).
>
> Well, I hope my question is clear and thanks in advance for any help!
>
> Regards,
> Ovidio
From the IWorkbenchWindowActionDelegate you have access to the real
action and can change the state of this action programmatically. Is that
not enought?
|
|
|
Re: Programmatic enablement of declarative actions [message #323922 is a reply to message #323910] |
Sun, 13 January 2008 05:49  |
Eclipse User |
|
|
|
Originally posted by: malloovidio.bluewin.ch
Hi Christian!
Thanks for the fast reply!
Do you maybe know how I can access that proxy action created by
the framework from within my view? (Sorry if the question is too
obvious by I am rather new to the topic.) It should indeed be
enough if I can manage to get a reference to that action.
Thanks again,
Ovidio
Christian wrote:
> Ovidio Mallo schrieb:
>> Hi all!
>>
>> I am writing an RCP application targeting Eclipse 3.2 in which I have
>> a view containing a single table displaying some search results.
>> At start-up, the table is filled with some default user-specific
>> entries.
>> This initial setup can be restored at any time by running an IAction
>> which has been contributed to the view's toolbar and menu through the
>> plugin.xml file.
>>
>> Our customer wants the restore-action to be disabled whenever the
>> currently shown search results are the default ones. So, after running
>> the restore-action, the action should be disabled and re-enabled
>> whenever the user changes the search results by any means (e.g. by a
>> custom search action).
>>
>> From what I see, my enablement requirements cannot be expressed in the
>> plugin.xml file as they are not expressible in terms of selections or
>> system properties or the like. Therefore, I guess I should control the
>> enablement programmatically but how to do this for a declarative action?
>> Or should I better make my restore-action programmatic right from the
>> beginning? (the reason why I would prefer to declare it in the
>> plugin.xml file is that I have some other, related, actions which are
>> all in the plugin.xml file).
>>
>> Well, I hope my question is clear and thanks in advance for any help!
>>
>> Regards,
>> Ovidio
>
>
> From the IWorkbenchWindowActionDelegate you have access to the real
> action and can change the state of this action programmatically. Is that
> not enought?
|
|
|
Powered by
FUDForum. Page generated in 0.40659 seconds