ScopeToolState (@Nullable PsiElement element) { if (myTools == null || element == null) return myDefaultState; return ReadAction.compute(() -> { if (!element.isValid()) return myDefaultState; Project project = element.getProject(); DependencyValidationManager manager = DependencyValidationManager.getInstance(project); for (ScopeToolState state : myTools) { NamedScope scope = state.getScope(project); PackageSet set = scope != null ? scope.getValue() : null; if (set != null && set.contains(element.getContainingFile(), manager)) { return state; } } return myDefaultState; }); }