Search in sources :

Example 1 with ModuleRunProfile

use of com.intellij.execution.configurations.ModuleRunProfile in project intellij-community by JetBrains.

the class TestConsoleProperties method initScope.

@NotNull
protected GlobalSearchScope initScope() {
    RunProfile configuration = getConfiguration();
    if (!(configuration instanceof ModuleRunProfile)) {
        return GlobalSearchScope.allScope(myProject);
    }
    Module[] modules = ((ModuleRunProfile) configuration).getModules();
    if (modules.length == 0) {
        return GlobalSearchScope.allScope(myProject);
    }
    GlobalSearchScope scope = GlobalSearchScope.EMPTY_SCOPE;
    for (Module each : modules) {
        scope = scope.uniteWith(GlobalSearchScope.moduleRuntimeScope(each, true));
    }
    return scope;
}
Also used : ModuleRunProfile(com.intellij.execution.configurations.ModuleRunProfile) GlobalSearchScope(com.intellij.psi.search.GlobalSearchScope) ModuleRunProfile(com.intellij.execution.configurations.ModuleRunProfile) RunProfile(com.intellij.execution.configurations.RunProfile) Module(com.intellij.openapi.module.Module) NotNull(org.jetbrains.annotations.NotNull)

Example 2 with ModuleRunProfile

use of com.intellij.execution.configurations.ModuleRunProfile in project android by JetBrains.

the class AndroidTestConsoleProperties method initScope.

@NotNull
@Override
protected GlobalSearchScope initScope() {
    GlobalSearchScope scope = super.initScope();
    Module[] modules = ((ModuleRunProfile) getConfiguration()).getModules();
    for (Module each : modules) {
        // UnitTest scope in each module is excluded from the scope used to find JUnitTests
        TestArtifactSearchScopes testArtifactSearchScopes = TestArtifactSearchScopes.get(each);
        if (testArtifactSearchScopes != null) {
            scope = scope.intersectWith(GlobalSearchScope.notScope(testArtifactSearchScopes.getUnitTestSourceScope()));
        }
    }
    return scope;
}
Also used : ModuleRunProfile(com.intellij.execution.configurations.ModuleRunProfile) TestArtifactSearchScopes(com.android.tools.idea.testartifacts.scopes.TestArtifactSearchScopes) GlobalSearchScope(com.intellij.psi.search.GlobalSearchScope) Module(com.intellij.openapi.module.Module) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

ModuleRunProfile (com.intellij.execution.configurations.ModuleRunProfile)2 Module (com.intellij.openapi.module.Module)2 GlobalSearchScope (com.intellij.psi.search.GlobalSearchScope)2 NotNull (org.jetbrains.annotations.NotNull)2 TestArtifactSearchScopes (com.android.tools.idea.testartifacts.scopes.TestArtifactSearchScopes)1 RunProfile (com.intellij.execution.configurations.RunProfile)1