disable action [message #464909] |
Tue, 20 March 2007 09:54 |
Eclipse User |
|
|
|
Originally posted by: m.hybler.aegis.cz
How can I disable only one action in menubar. If I have used
cz.aegis.cms.partAssociations it is working but on whole actionSet but I
need disable only one item from menu. Functionality is correct but
problem is in hiding all items in actionSet.
Thanks for help Michal
|
|
|
|
Re: disable action [message #464985 is a reply to message #464919] |
Wed, 21 March 2007 13:58 |
Eclipse User |
|
|
|
Originally posted by: m.hybler.aegis.cz
Ali Alauoubiy wrote:
> Hi There,
>
> In your action class (the one which implements IWorkbenchWindowActionDelegate) you need to override the following method:
>
> public void selectionChanged(IAction action, ISelection incoming) {
>
> if (incoming instanceof IStructuredSelection) {
> action.setEnabled(false);
> selection = (IStructuredSelection) incoming;
> action.setEnabled(selection.size() == 1 && [ADD HERE SOME OF YOUR LOGIC]);
>
> if (selection.getFirstElement() instanceof TradingBook)
> {
> //do something
> } else {
> action.setEnabled(false);
> }
> }
>
> Regards
> Ali
Thanks it is useable if I want set action enabled when correct selection
is done. I need set this action active if view is initiate. I have view
which isnt started on my plugin startup but on user demand.
With best regards Michal
|
|
|
|
Powered by
FUDForum. Page generated in 0.04312 seconds