void (@NotNull final AnActionEvent e) { Pair<Set<PsiFile>, Set<PsiFile>> scopes = e.getUpdateSession() .compute(this, "getSelectedScopes", ActionUpdateThread.EDT, () -> { return Pair.create(getSelectedScope(myLeftTree), getSelectedScope(myRightTree)); }); final boolean[] direct = new boolean[]{true}; processDependencies(scopes.first, scopes.second, path -> { direct [0] = false; return false; }); e.getPresentation().setEnabled(!direct[0]); }