void (@NotNull AnActionEvent event) { Presentation presentation = event.getPresentation(); Project project = event.getData(CommonDataKeys.PROJECT); if (project == null) { presentation.setEnabled(false); // make it invisible only in main menu to avoid initial invisibility in toolbars presentation.setVisible(!ActionPlaces.isMainMenuOrActionSearch(event.getPlace())); return; } UpdateSession session = event.getUpdateSession(); OccurenceNavigator navigator = session.compute( this, "getNavigator", ActionUpdateThread.EDT, () -> getNavigator(event.getDataContext())); if (navigator == null) { presentation.setEnabled(false); // make it invisible only in main menu to avoid initial invisibility in toolbars presentation.setVisible(!ActionPlaces.isMainMenuOrActionSearch(event.getPlace())); return; } presentation.setVisible(true); try { boolean enabled = Boolean.TRUE.equals(session.compute( navigator, "hasOccurenceToGo", navigator.getActionUpdateThread(), () -> hasOccurenceToGo(navigator))); presentation.setEnabled(enabled); String description = getDescription(navigator); if (StringUtil.isEmpty(description)) { LOG.error(PluginException.createByClass("Empty description provided by " + navigator.getClass().getName(), null, navigator.getClass())); } else { presentation.setText(description); } } catch (IndexNotReadyException e) { presentation.setEnabled(false); } }