use of com.intellij.openapi.module.Module in project intellij-community by JetBrains.
the class RootVisitorHost method visitOrderEntryRoots.
private static boolean visitOrderEntryRoots(RootVisitor visitor, OrderEntry entry) {
Set<VirtualFile> allRoots = new LinkedHashSet<>();
Collections.addAll(allRoots, entry.getFiles(OrderRootType.SOURCES));
Collections.addAll(allRoots, entry.getFiles(OrderRootType.CLASSES));
Module module = entry instanceof ModuleOrderEntry ? ((ModuleOrderEntry) entry).getModule() : null;
Sdk sdk = entry instanceof JdkOrderEntry ? ((JdkOrderEntry) entry).getJdk() : null;
for (VirtualFile root : allRoots) {
if (!visitor.visitRoot(root, module, sdk, false)) {
return false;
}
}
return true;
}
use of com.intellij.openapi.module.Module in project intellij-community by JetBrains.
the class ResolveImportUtil method getPathCache.
@Nullable
static PythonPathCache getPathCache(PsiElement foothold) {
PythonPathCache cache = null;
final Module module = ModuleUtilCore.findModuleForPsiElement(foothold);
if (module != null) {
cache = PythonModulePathCache.getInstance(module);
} else {
final Sdk sdk = PyBuiltinCache.findSdkForFile(foothold.getContainingFile());
if (sdk != null) {
cache = PythonSdkPathCache.getInstance(foothold.getProject(), sdk);
}
}
return cache;
}
use of com.intellij.openapi.module.Module in project intellij-community by JetBrains.
the class ModuleContextProvider method getModules.
public static Module[] getModules(@Nullable PsiFile context) {
if (context == null)
return Module.EMPTY_ARRAY;
final Set<Module> modules = new HashSet<>();
for (ModuleContextProvider moduleContextProvider : Extensions.getExtensions(EP_NAME)) {
ContainerUtil.addAllNotNull(modules, moduleContextProvider.getContextModules(context));
}
Module module = ModuleUtilCore.findModuleForPsiElement(context);
if (module != null)
modules.add(module);
return modules.toArray(new Module[modules.size()]);
}
use of com.intellij.openapi.module.Module in project intellij-community by JetBrains.
the class AbstractConvertContext method getConvertContextModules.
@NotNull
private Module[] getConvertContextModules() {
Module[] modules = ModuleContextProvider.getModules(getFile());
if (modules.length > 0)
return modules;
final Module module = getModule();
if (module != null)
return new Module[] { module };
return Module.EMPTY_ARRAY;
}
use of com.intellij.openapi.module.Module in project intellij-community by JetBrains.
the class AbstractConvertContext method getSearchScope.
@Override
@Nullable
public GlobalSearchScope getSearchScope() {
GlobalSearchScope scope = null;
Module[] modules = getConvertContextModules();
if (modules.length != 0) {
PsiFile file = getFile();
file = file.getOriginalFile();
VirtualFile virtualFile = file.getVirtualFile();
if (virtualFile != null) {
boolean tests = TestSourcesFilter.isTestSources(virtualFile, file.getProject());
for (Module module : modules) {
if (scope == null) {
scope = module.getModuleRuntimeScope(tests);
} else {
scope = scope.union(module.getModuleRuntimeScope(tests));
}
}
}
}
// ??? scope == null ? GlobalSearchScope.allScope(getProject()) : scope; ???
return scope;
}
Aggregations