Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » disable action
disable action [message #464909] Tue, 20 March 2007 09:54 Go to next message
Eclipse UserFriend
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 #464919 is a reply to message #464909] Tue, 20 March 2007 14:36 Go to previous messageGo to next message
Ali Alauoubiy is currently offline Ali AlauoubiyFriend
Messages: 20
Registered: July 2009
Junior Member
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
Re: disable action [message #464985 is a reply to message #464919] Wed, 21 March 2007 13:58 Go to previous messageGo to next message
Eclipse UserFriend
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
Re: disable action [message #465050 is a reply to message #464909] Thu, 22 March 2007 11:42 Go to previous message
Daniel Krügler is currently offline Daniel KrüglerFriend
Messages: 853
Registered: July 2009
Senior Member
Michal Hybler wrote:
> 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.

Without trying it, I would propose to wrap this single menu
inside it's own actionset, which you configure as usual.

HTH,

Daniel Krügler
Previous Topic:How do I save editor state?
Next Topic:CellEditors in Tree + TreeColumn
Goto Forum:
  


Current Time: Sun Sep 08 03:57:39 GMT 2024

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

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

Back to the top