Search in sources :

Example 1 with PackageSetBase

use of com.intellij.psi.search.scope.packageSet.PackageSetBase in project android by JetBrains.

the class TestArtifactCustomScopeTest method testUnitTestFileColor.

public void testUnitTestFileColor() throws Exception {
    VirtualFile file = findRelativeFile("app/src/test/java/google/simpleapplication/UnitTest.java", getProject().getBaseDir());
    assertNotNull(file);
    UnitTestsScope scope = new UnitTestsScope();
    PackageSetBase packageSet = (PackageSetBase) scope.getValue();
    assertNotNull(packageSet);
    assertTrue(packageSet.contains(file, getProject(), null));
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) UnitTestsScope(com.android.tools.idea.testartifacts.scopes.TestArtifactCustomScopeProvider.UnitTestsScope) PackageSetBase(com.intellij.psi.search.scope.packageSet.PackageSetBase)

Example 2 with PackageSetBase

use of com.intellij.psi.search.scope.packageSet.PackageSetBase in project intellij-community by JetBrains.

the class FileColorsModel method findConfiguration.

@Nullable
private FileColorConfiguration findConfiguration(@NotNull final VirtualFile colored) {
    for (FileColorConfiguration configuration : getConfigurations()) {
        NamedScope scope = NamedScopesHolder.getScope(myProject, configuration.getScopeName());
        if (scope != null) {
            NamedScopesHolder namedScopesHolder = NamedScopesHolder.getHolder(myProject, configuration.getScopeName(), null);
            PackageSet packageSet = scope.getValue();
            if (packageSet instanceof PackageSetBase && namedScopesHolder != null && ((PackageSetBase) packageSet).contains(colored, myProject, namedScopesHolder)) {
                return configuration;
            }
        }
    }
    return null;
}
Also used : NamedScope(com.intellij.psi.search.scope.packageSet.NamedScope) NamedScopesHolder(com.intellij.psi.search.scope.packageSet.NamedScopesHolder) PackageSet(com.intellij.psi.search.scope.packageSet.PackageSet) PackageSetBase(com.intellij.psi.search.scope.packageSet.PackageSetBase) Nullable(org.jetbrains.annotations.Nullable)

Example 3 with PackageSetBase

use of com.intellij.psi.search.scope.packageSet.PackageSetBase in project android by JetBrains.

the class TestArtifactCustomScopeTest method ignore_testAndroidTestFileColor.

// see comments on http://ag/1025651
public void ignore_testAndroidTestFileColor() throws Exception {
    VirtualFile file = findRelativeFile("app/src/androidTest/java/google/simpleapplication/ApplicationTest.java", getProject().getBaseDir());
    assertNotNull(file);
    AndroidTestsScope scope = new AndroidTestsScope();
    PackageSetBase packageSet = (PackageSetBase) scope.getValue();
    assertNotNull(packageSet);
    assertTrue(packageSet.contains(file, getProject(), null));
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) AndroidTestsScope(com.android.tools.idea.testartifacts.scopes.TestArtifactCustomScopeProvider.AndroidTestsScope) PackageSetBase(com.intellij.psi.search.scope.packageSet.PackageSetBase)

Aggregations

PackageSetBase (com.intellij.psi.search.scope.packageSet.PackageSetBase)3 VirtualFile (com.intellij.openapi.vfs.VirtualFile)2 AndroidTestsScope (com.android.tools.idea.testartifacts.scopes.TestArtifactCustomScopeProvider.AndroidTestsScope)1 UnitTestsScope (com.android.tools.idea.testartifacts.scopes.TestArtifactCustomScopeProvider.UnitTestsScope)1 NamedScope (com.intellij.psi.search.scope.packageSet.NamedScope)1 NamedScopesHolder (com.intellij.psi.search.scope.packageSet.NamedScopesHolder)1 PackageSet (com.intellij.psi.search.scope.packageSet.PackageSet)1 Nullable (org.jetbrains.annotations.Nullable)1