TextAttributes (@NotNull PsiElement element, @NotNull TextAttributesScheme colorsScheme) { PsiFile file = element.getContainingFile(); if (file == null) return null; TextAttributes result = null; DependencyValidationManagerImpl validationManager = (DependencyValidationManagerImpl)DependencyValidationManager.getInstance(file.getProject()); List<Pair<NamedScope,NamedScopesHolder>> scopes = validationManager.getScopeBasedHighlightingCachedScopes(); for (Pair<NamedScope, NamedScopesHolder> scope : scopes) { NamedScope namedScope = scope.getFirst(); TextAttributesKey scopeKey = ScopeAttributesUtil.getScopeTextAttributeKey(namedScope.getScopeId()); TextAttributes attributes = colorsScheme.getAttributes(scopeKey); if (attributes == null || attributes.isEmpty()) { continue; } PackageSet packageSet = namedScope.getValue(); if (packageSet != null && packageSet.contains(file, scope.getSecond())) { result = TextAttributes.merge(attributes, result); } } return result; }