Disable action when analysis starts

Answered

My plugin does some analysis when an action performed. I want to disable my action when analysis starts and re-enable it after end of analysis. I tried to do it on update fuction but it looks like it is always holding the value it recieves. It doesn't change after analysis. How can I do it?

 

@Override
public void update (AnActionEvent e) {
e.getPresentation().setEnabled(!IntelliJAnalysis.isTaskRunning());
}
}


public static boolean isTaskRunning() {
if(tok==true) {
return true;
}
else{
return false;
}
}
0
1 comment

Taslima,

You can make your action disabled when the IDE is not in the dumb state, so there is i.e. invalidation in progress:

e.getPresentation().setEnabled(project != null && !DumbService.isDumb(project));
1

Please sign in to leave a comment.