use of com.intellij.psi.search.scope.ProjectProductionScope in project intellij-community by JetBrains.
the class ScopeChooserUtils method findScopeByName.
@NotNull
public static GlobalSearchScope findScopeByName(@NotNull Project project, @Nullable String scopeName) {
NamedScope namedScope = scopeName == null ? null : ChangeListsScopesProvider.getInstance(project).getCustomScope(scopeName);
if (namedScope == null) {
namedScope = NamedScopesHolder.getScope(project, scopeName);
}
if (namedScope == null && OPEN_FILES_SCOPE_NAME.equals(scopeName)) {
return intersectWithContentScope(project, GlobalSearchScopes.openFilesScope(project));
}
if (namedScope == null && CURRENT_FILE_SCOPE_NAME.equals(scopeName)) {
VirtualFile[] array = FileEditorManager.getInstance(project).getSelectedFiles();
List<VirtualFile> files = ContainerUtil.createMaybeSingletonList(ArrayUtil.getFirstElement(array));
GlobalSearchScope scope = GlobalSearchScope.filesScope(project, files, CURRENT_FILE_SCOPE_NAME);
return intersectWithContentScope(project, scope);
}
if (namedScope == null) {
namedScope = new ProjectFilesScope();
}
GlobalSearchScope scope = GlobalSearchScopesCore.filterScope(project, namedScope);
if (namedScope instanceof ProjectFilesScope || namedScope instanceof ProjectProductionScope) {
return scope;
}
return intersectWithContentScope(project, scope);
}
Aggregations