Java Code Examples for com.intellij.psi.search.GlobalSearchScope#EMPTY_SCOPE
The following examples show how to use
com.intellij.psi.search.GlobalSearchScope#EMPTY_SCOPE .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PropertiesManager.java From intellij-quarkus with Eclipse Public License 2.0 | 6 votes |
private SearchScope createSearchScope(Module module, List<MicroProfilePropertiesScope> scopes, boolean excludeTestCode) { SearchScope searchScope = GlobalSearchScope.EMPTY_SCOPE; for (MicroProfilePropertiesScope scope : scopes) { switch (scope) { case sources: searchScope = searchScope.union(module.getModuleScope(!excludeTestCode)); break; case dependencies: searchScope = searchScope.union(module.getModuleWithLibrariesScope()); break; } } return searchScope; }
Example 2
Source File: TestConsoleProperties.java From consulo with Apache License 2.0 | 6 votes |
@Nonnull 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; }
Example 3
Source File: AbstractGotoSEContributor.java From consulo with Apache License 2.0 | 6 votes |
protected AbstractGotoSEContributor(@Nullable Project project, @Nullable PsiElement context) { myProject = project; psiContext = context; myEverywhereScope = myProject == null ? GlobalSearchScope.EMPTY_SCOPE : GlobalSearchScope.everythingScope(myProject); GlobalSearchScope projectScope = myProject == null ? GlobalSearchScope.EMPTY_SCOPE : GlobalSearchScope.projectScope(myProject); if (myProject == null) { myProjectScope = GlobalSearchScope.EMPTY_SCOPE; } else if (!myEverywhereScope.equals(projectScope)) { myProjectScope = projectScope; } else { // just get the second scope, i.e. Attached Directories in DataGrip Ref<GlobalSearchScope> result = Ref.create(); processScopes(SimpleDataContext.getProjectContext(myProject), o -> { if (o.scopeEquals(myEverywhereScope) || o.scopeEquals(null)) return true; result.set((GlobalSearchScope)o.getScope()); return false; }); myProjectScope = ObjectUtils.notNull(result.get(), myEverywhereScope); } myScopeDescriptor = getInitialSelectedScope(); }
Example 4
Source File: BlazePackageSearchScope.java From intellij with Apache License 2.0 | 5 votes |
@Override public GlobalSearchScope uniteWith(@NotNull GlobalSearchScope scope) { if (scope instanceof BlazePackageSearchScope) { BlazePackageSearchScope other = (BlazePackageSearchScope) scope; if (!blazePackage.equals(other.blazePackage)) { return GlobalSearchScope.EMPTY_SCOPE; } return onlyBlazeFiles ? this : other; } return super.uniteWith(scope); }
Example 5
Source File: BashSearchScopes.java From BashSupport with Apache License 2.0 | 5 votes |
public static GlobalSearchScope moduleScope(PsiFile file) { VirtualFile virtualFile = file.getVirtualFile(); if (virtualFile == null) { return GlobalSearchScope.EMPTY_SCOPE; } Module module = ProjectRootManager.getInstance(file.getProject()).getFileIndex().getModuleForFile(virtualFile); if (module == null) { return GlobalSearchScope.fileScope(file); } //the module scope returned by getModuleScope() just contains the files in the configured source and test source directories, //module content scope includes all files in the module directory return module.getModuleContentScope(); }
Example 6
Source File: AnalysisScope.java From consulo with Apache License 2.0 | 4 votes |
@Nonnull public SearchScope toSearchScope() { switch (myType) { case CUSTOM: return myScope; case DIRECTORY: return GlobalSearchScopesCore.directoryScope((PsiDirectory)myElement, true); case FILE: return new LocalSearchScope(myElement); case INVALID: return LocalSearchScope.EMPTY; case MODULE: GlobalSearchScope moduleScope = GlobalSearchScope.moduleScope(myModule); return myIncludeTestSource ? moduleScope : GlobalSearchScope.notScope(GlobalSearchScopesCore.projectTestScope(myModule.getProject())).intersectWith(moduleScope); case MODULES: SearchScope scope = GlobalSearchScope.EMPTY_SCOPE; for (Module module : myModules) { scope = scope.union(GlobalSearchScope.moduleScope(module)); } return scope; case PROJECT: return myIncludeTestSource ? GlobalSearchScope.projectScope(myProject) : GlobalSearchScopesCore.projectProductionScope(myProject); case VIRTUAL_FILES: return new GlobalSearchScope() { @Override public boolean contains(@Nonnull VirtualFile file) { return myFilesSet.contains(file); } @Override public int compare(@Nonnull VirtualFile file1, @Nonnull VirtualFile file2) { return 0; } @Override public boolean isSearchInModuleContent(@Nonnull Module aModule) { return false; } @Override public boolean isSearchInLibraries() { return false; } }; default: LOG.error("invalid type " + myType); return GlobalSearchScope.EMPTY_SCOPE; } }
Example 7
Source File: MockPsiFile.java From consulo with Apache License 2.0 | 4 votes |
@Override @Nonnull public GlobalSearchScope getResolveScope() { return GlobalSearchScope.EMPTY_SCOPE; }
Example 8
Source File: MockPsiFile.java From consulo with Apache License 2.0 | 4 votes |
@Override @Nonnull public SearchScope getUseScope() { return GlobalSearchScope.EMPTY_SCOPE; }
Example 9
Source File: FileBasedIndexImpl.java From consulo with Apache License 2.0 | 4 votes |
<K> void ensureUpToDate(@Nonnull final ID<K, ?> indexId, @Nullable Project project, @Nullable GlobalSearchScope filter, @Nullable VirtualFile restrictedFile) { ProgressManager.checkCanceled(); getChangedFilesCollector().ensureUpToDate(); ApplicationManager.getApplication().assertReadAccessAllowed(); NoAccessDuringPsiEvents.checkCallContext(); if (!needsFileContentLoading(indexId)) { return; //indexed eagerly in foreground while building unindexed file list } if (filter == GlobalSearchScope.EMPTY_SCOPE) { return; } if (ActionUtil.isDumbMode(project)) { handleDumbMode(project); } if (myReentrancyGuard.get().booleanValue()) { //assert false : "ensureUpToDate() is not reentrant!"; return; } myReentrancyGuard.set(Boolean.TRUE); try { if (isUpToDateCheckEnabled()) { try { if (!RebuildStatus.isOk(indexId)) { throw new ProcessCanceledException(); } forceUpdate(project, filter, restrictedFile); indexUnsavedDocuments(indexId, project, filter, restrictedFile); } catch (RuntimeException e) { final Throwable cause = e.getCause(); if (cause instanceof StorageException || cause instanceof IOException) { scheduleRebuild(indexId, e); } else { throw e; } } } } finally { myReentrancyGuard.set(Boolean.FALSE); } }