@Override
public void update(final AnActionEvent event) {
try {
final com.intellij.openapi.project.Project project = DataKeys.PROJECT.getData(event.getDataContext());
final Presentation presentation = event.getPresentation();
// check a project is loaded
if (isProjectNotLoaded(project, presentation)) {
return;
}
isPluginAccessible(project);
// check if tool window is registered
final ToolWindow toolWindow = isToolWindowRegistered(project);
if (toolWindow == null) {
presentation.setEnabled(false);
presentation.setVisible(false);
return;
}
registerEventListener(project);
if (!_running) {
_enabled = _importBugCollection == null;
}
presentation.setEnabled(toolWindow.isAvailable() && isEnabled());
presentation.setVisible(true);
} catch (final Throwable e) {
final FindBugsPluginException processed = FindBugsPluginImpl.processError("Action update failed", e);
LOGGER.error("Action update failed", processed);
}