use of com.intellij.psi.search.scope.packageSet.PackageSet in project intellij-community by JetBrains.
the class FindManagerTest method testNoFilesFromAdditionalIndexedRootsWithCustomExclusionScope.
public void testNoFilesFromAdditionalIndexedRootsWithCustomExclusionScope() throws ParsingException {
FindModel findModel = FindManagerTestUtils.configureFindModel("Object.prototype.__defineGetter__");
PackageSet compile = PackageSetFactory.getInstance().compile("!src[subdir]:*..*");
findModel.setCustomScope(GlobalSearchScopesCore.filterScope(myProject, new NamedScope.UnnamedScope(compile)));
findModel.setCustomScope(true);
assertSize(0, findUsages(findModel));
}
use of com.intellij.psi.search.scope.packageSet.PackageSet in project intellij-community by JetBrains.
the class HighlightNamesUtil method getScopeAttributes.
private static TextAttributes getScopeAttributes(@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) {
final NamedScope namedScope = scope.getFirst();
final TextAttributesKey scopeKey = ScopeAttributesUtil.getScopeTextAttributeKey(namedScope.getName());
final TextAttributes attributes = colorsScheme.getAttributes(scopeKey);
if (attributes == null || attributes.isEmpty()) {
continue;
}
final PackageSet packageSet = namedScope.getValue();
if (packageSet != null && packageSet.contains(file, scope.getSecond())) {
result = TextAttributes.merge(attributes, result);
}
}
return result;
}
use of com.intellij.psi.search.scope.packageSet.PackageSet in project intellij-community by JetBrains.
the class DependencyRule method isForbiddenToUse.
public boolean isForbiddenToUse(@NotNull PsiFile from, @NotNull PsiFile to) {
if (myFromScope == null || myToScope == null)
return false;
final PackageSet fromSet = myFromScope.getValue();
final PackageSet toSet = myToScope.getValue();
if (fromSet == null || toSet == null)
return false;
DependencyValidationManager holder = DependencyValidationManager.getInstance(from.getProject());
return (myDenyRule ? fromSet.contains(from, holder) : new ComplementPackageSet(fromSet).contains(from, holder)) && toSet.contains(to, holder);
}
use of com.intellij.psi.search.scope.packageSet.PackageSet in project intellij-community by JetBrains.
the class DependencyRule method isApplicable.
public boolean isApplicable(@NotNull PsiFile file) {
if (myFromScope == null || myToScope == null)
return false;
final PackageSet fromSet = myFromScope.getValue();
if (fromSet == null)
return false;
DependencyValidationManager holder = DependencyValidationManager.getInstance(file.getProject());
return myDenyRule ? fromSet.contains(file, holder) : new ComplementPackageSet(fromSet).contains(file, holder);
}
use of com.intellij.psi.search.scope.packageSet.PackageSet in project intellij-community by JetBrains.
the class ScopeConfigurable method apply.
@Override
public void apply() throws ConfigurationException {
try {
myPanel.apply();
final PackageSet packageSet = myPanel.getCurrentScope();
myScope = new NamedScope(myScope.getName(), packageSet);
myPackageSet = packageSet != null ? packageSet.getText() : null;
myShareScope = mySharedCheckbox.isSelected();
} catch (ConfigurationException e) {
//was canceled - didn't change anything
}
}
Aggregations