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.


0
2 comments
Avatar
Permanently deleted user

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
Avatar
Permanently deleted user

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.