use of com.intellij.openapi.roots.ContentEntry in project android by JetBrains.
the class NonAndroidModuleNode method getNonEmptySourceTypes.
private static Set<NonAndroidSourceType> getNonEmptySourceTypes(Module module) {
ModuleRootManager rootManager = ModuleRootManager.getInstance(module);
Set<NonAndroidSourceType> sourceTypes = Sets.newHashSetWithExpectedSize(NonAndroidSourceType.values().length);
ContentEntry[] contentEntries = rootManager.getContentEntries();
for (ContentEntry entry : contentEntries) {
for (NonAndroidSourceType type : NonAndroidSourceType.values()) {
for (SourceFolder sourceFolder : entry.getSourceFolders(type.rootType)) {
if (sourceFolder.getFile() != null) {
sourceTypes.add(type);
break;
}
}
}
}
return sourceTypes;
}
use of com.intellij.openapi.roots.ContentEntry in project android by JetBrains.
the class ExcludedRoots method addFolderPathsFromExcludedModules.
private void addFolderPathsFromExcludedModules() {
for (Module module : myExcludedModules) {
ModuleRootManager rootManager = ModuleRootManager.getInstance(module);
for (ContentEntry entry : rootManager.getContentEntries()) {
for (SourceFolder sourceFolder : entry.getSourceFolders()) {
myExcludedRoots.add(urlToFilePath(sourceFolder.getUrl()));
}
CompilerModuleExtension compiler = rootManager.getModuleExtension(CompilerModuleExtension.class);
String url = compiler.getCompilerOutputUrl();
if (isNotEmpty(url)) {
myExcludedRoots.add(urlToFilePath(url));
}
}
AndroidModuleModel androidModuleModel = AndroidModuleModel.get(module);
if (androidModuleModel != null) {
myExcludedRoots.add(androidModuleModel.getMainArtifact().getJavaResourcesFolder());
}
}
}
use of com.intellij.openapi.roots.ContentEntry in project android by JetBrains.
the class ContentRootsModuleSetupStep method findContentEntries.
@NotNull
private static List<ContentEntry> findContentEntries(@NotNull ModifiableRootModel moduleModel, @NotNull JavaModuleModel javaModuleModel) {
removeExistingContentEntries(moduleModel);
List<ContentEntry> contentEntries = new ArrayList<>();
for (JavaModuleContentRoot contentRoot : javaModuleModel.getContentRoots()) {
File rootDirPath = contentRoot.getRootDirPath();
ContentEntry contentEntry = moduleModel.addContentEntry(pathToIdeaUrl(rootDirPath));
contentEntries.add(contentEntry);
}
return contentEntries;
}
use of com.intellij.openapi.roots.ContentEntry in project android by JetBrains.
the class ContentRootsModuleSetupStep method doSetUpModule.
@Override
protected void doSetUpModule(@NotNull Module module, @NotNull IdeModifiableModelsProvider ideModelsProvider, @NotNull JavaModuleModel javaModuleModel, @Nullable SyncAction.ModuleModels gradleModels, @Nullable ProgressIndicator indicator) {
ModifiableRootModel moduleModel = ideModelsProvider.getModifiableRootModel(module);
JavaContentEntriesSetup setup = new JavaContentEntriesSetup(javaModuleModel, moduleModel);
List<ContentEntry> contentEntries = findContentEntries(moduleModel, javaModuleModel);
setup.execute(contentEntries);
}
use of com.intellij.openapi.roots.ContentEntry in project android by JetBrains.
the class ContentRootModuleSetupStep method findContentEntries.
@NotNull
private static List<ContentEntry> findContentEntries(@NotNull ModifiableRootModel moduleModel, @NotNull NdkModuleModel ndkModuleModel) {
removeExistingContentEntries(moduleModel);
ContentEntry contentEntry = moduleModel.addContentEntry(pathToIdeaUrl(ndkModuleModel.getRootDirPath()));
return Collections.singletonList(contentEntry);
}
Aggregations