void (@NotNull AnActionEvent event) { Presentation presentation = event.getPresentation(); DataContext dataContext = event.getDataContext(); Project project = CommonDataKeys.PROJECT.getData(dataContext); if (project == null){ presentation.setEnabled(false); return; } final Lookup activeLookup = LookupManager.getInstance(project).getActiveLookup(); if (activeLookup != null){ presentation.setEnabled(isValidForLookup()); } else { super.update(event); } }