Disable an action

How do you disable an action depending on a project setting? In other words,
I have a project setting "enabled", if it is not checked I want the action
for my plugin disabled in the menu. Thanks in advance for any help.


2 comments

class MyAction extends AnAction {
public void update(AnActionEvent event)
{
Presentation presentation = event.getPresentation();
if (isPluginDisabled()) {
presentation.setEnabled(false); // disable the toolbar icon or
the menu item
presentation.setVisible(false); // make the toolbar icon or
the menu item disappear
return;
}
...
}
}

Jacques
"Brad Lane" <_no_spam_brad.lane@pearson.com> wrote in message
news:b3go96$bp4$1@is.intellij.net...

How do you disable an action depending on a project setting? In other

words,

I have a project setting "enabled", if it is not checked I want the action
for my plugin disabled in the menu. Thanks in advance for any help.

>
>


0

Thanks.

"Jacques Morel" <jacmorel@yahoo.com> wrote in message
news:b3hf9r$g2u$1@is.intellij.net...

class MyAction extends AnAction {
public void update(AnActionEvent event)
{
Presentation presentation = event.getPresentation();
if (isPluginDisabled()) {
presentation.setEnabled(false); // disable the toolbar icon or
the menu item
presentation.setVisible(false); // make the toolbar icon or
the menu item disappear
return;
}
...
}
}

>

Jacques
"Brad Lane" <_no_spam_brad.lane@pearson.com> wrote in message
news:b3go96$bp4$1@is.intellij.net...

How do you disable an action depending on a project setting? In other

words,

I have a project setting "enabled", if it is not checked I want the

action

for my plugin disabled in the menu. Thanks in advance for any help.

>
>

>
>


0

Please sign in to leave a comment.