use of com.intellij.openapi.externalSystem.psi.search.ExternalModuleBuildGlobalSearchScope in project intellij-community by JetBrains.
the class GradleScriptType method patchResolveScopeInner.
public GlobalSearchScope patchResolveScopeInner(@Nullable Module module, @NotNull GlobalSearchScope baseScope) {
if (module == null)
return GlobalSearchScope.EMPTY_SCOPE;
if (!ExternalSystemApiUtil.isExternalSystemAwareModule(GradleConstants.SYSTEM_ID, module))
return baseScope;
GlobalSearchScope result = GlobalSearchScope.EMPTY_SCOPE;
final Project project = module.getProject();
for (OrderEntry entry : ModuleRootManager.getInstance(module).getOrderEntries()) {
if (entry instanceof JdkOrderEntry) {
GlobalSearchScope scopeForSdk = LibraryScopeCache.getInstance(project).getScopeForSdk((JdkOrderEntry) entry);
result = result.uniteWith(scopeForSdk);
}
}
String modulePath = ExternalSystemApiUtil.getExternalProjectPath(module);
if (modulePath == null)
return result;
final Collection<VirtualFile> files = GradleBuildClasspathManager.getInstance(project).getModuleClasspathEntries(modulePath);
result = new ExternalModuleBuildGlobalSearchScope(project, result.uniteWith(new NonClasspathDirectoriesScope(files)), modulePath);
return result;
}
use of com.intellij.openapi.externalSystem.psi.search.ExternalModuleBuildGlobalSearchScope in project intellij-community by JetBrains.
the class GradleClassFinder method findClass.
@Override
public PsiClass findClass(@NotNull String qualifiedName, @NotNull GlobalSearchScope scope) {
PsiClass aClass = super.findClass(qualifiedName, scope);
if (aClass == null || scope instanceof ExternalModuleBuildGlobalSearchScope || scope instanceof EverythingGlobalScope) {
return aClass;
}
PsiFile containingFile = aClass.getContainingFile();
VirtualFile file = containingFile != null ? containingFile.getVirtualFile() : null;
return (file != null && !ProjectFileIndex.SERVICE.getInstance(myProject).isInContent(file) && !ProjectFileIndex.SERVICE.getInstance(myProject).isInLibraryClasses(file) && !ProjectFileIndex.SERVICE.getInstance(myProject).isInLibrarySource(file)) ? aClass : null;
}
Aggregations