use of com.intellij.openapi.roots.ModuleRootManager in project android by JetBrains.
the class ConflictSetTest method setUpModuleDependencies.
private void setUpModuleDependencies() {
// Make module depend on myLibModule.
ModuleRootManager moduleRootManager = ModuleRootManager.getInstance(myModule);
ModifiableRootModel rootModel = moduleRootManager.getModifiableModel();
try {
rootModel.addModuleOrderEntry(myLibModule);
} finally {
rootModel.commit();
}
}
use of com.intellij.openapi.roots.ModuleRootManager in project intellij-plugins by JetBrains.
the class CodeContext method createCodeContextFromLibraries.
private static CodeContext createCodeContextFromLibraries(final String namespace, final Module module, final FlexBuildConfiguration bc) {
final Map<String, CodeContext> contextsOfModule = new THashMap<>();
final ModuleRootManager rootManager = ModuleRootManager.getInstance(module);
// If fixed - then method usage at getStdCodeContext() must be changed to make sure that all namespaces handled at that point.
for (DependencyEntry entry : bc.getDependencies().getEntries()) {
if (entry.getDependencyType().getLinkageType() == LinkageType.LoadInRuntime)
continue;
if (entry instanceof BuildConfigurationEntry) {
final FlexBuildConfiguration bcDependency = ((BuildConfigurationEntry) entry).findBuildConfiguration();
if (bcDependency != null && bcDependency.getOutputType() == OutputType.Library) {
addComponentsFromManifests(module, contextsOfModule, bcDependency, true);
}
} else if (entry instanceof ModuleLibraryEntry) {
final LibraryOrderEntry orderEntry = FlexProjectRootsUtil.findOrderEntry((ModuleLibraryEntry) entry, rootManager);
if (orderEntry != null) {
for (VirtualFile file : orderEntry.getRootFiles(OrderRootType.CLASSES)) {
handleFileDependency(module, contextsOfModule, file);
}
}
} else if (entry instanceof SharedLibraryEntry) {
final Library library = FlexProjectRootsUtil.findOrderEntry(module.getProject(), (SharedLibraryEntry) entry);
if (library != null) {
for (VirtualFile file : library.getFiles(OrderRootType.CLASSES)) {
handleFileDependency(module, contextsOfModule, file);
}
}
}
}
addComponentsFromManifests(module, contextsOfModule, bc, false);
final CodeContextHolder contextHolder = CodeContextHolder.getInstance(module.getProject());
for (Map.Entry<String, CodeContext> entry : contextsOfModule.entrySet()) {
contextHolder.putCodeContext(entry.getKey(), module, entry.getValue());
}
CodeContext codeContext = contextsOfModule.get(namespace);
if (codeContext == null) {
codeContext = CodeContextHolder.EMPTY;
}
return codeContext;
}
Aggregations