void (@NotNull PsiElement element) { Project project = element.getProject(); DependencyValidationManager validationManager = DependencyValidationManager.getInstance(project); if (myTools != null) { for (ScopeToolState state : myTools) { NamedScope scope = state.getScope(project); if (scope != null) { PackageSet packageSet = scope.getValue(); if (packageSet != null) { PsiFile file = element.getContainingFile(); if (file != null) { if (packageSet.contains(file, validationManager)) { state.setEnabled(false); return; } } else { VirtualFile virtualFile = PsiUtilCore.getVirtualFile(element); if (packageSet instanceof PackageSetBase && virtualFile != null && ((PackageSetBase)packageSet).contains(virtualFile, project, validationManager)) { state.setEnabled(false); return; } } } } } myDefaultState.setEnabled(false); } else { myDefaultState.setEnabled(false); setEnabled(false); } }