diff options
Diffstat (limited to 'platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/project/manage/ContentRootDataService.java')
-rw-r--r-- | platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/project/manage/ContentRootDataService.java | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/project/manage/ContentRootDataService.java b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/project/manage/ContentRootDataService.java index 7e7483869728..3e1c95ad3766 100644 --- a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/project/manage/ContentRootDataService.java +++ b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/project/manage/ContentRootDataService.java @@ -33,8 +33,13 @@ import com.intellij.openapi.externalSystem.util.ExternalSystemConstants; import com.intellij.openapi.externalSystem.util.Order; import com.intellij.openapi.module.Module; import com.intellij.openapi.project.Project; -import com.intellij.openapi.roots.*; +import com.intellij.openapi.roots.ContentEntry; +import com.intellij.openapi.roots.ModifiableRootModel; +import com.intellij.openapi.roots.ModuleRootModificationUtil; +import com.intellij.openapi.roots.SourceFolder; +import com.intellij.openapi.util.registry.Registry; import com.intellij.openapi.util.text.StringUtil; +import com.intellij.openapi.vcs.changes.ChangeListManager; import com.intellij.openapi.vfs.LocalFileSystem; import com.intellij.openapi.vfs.VfsUtil; import com.intellij.openapi.vfs.VirtualFile; @@ -151,7 +156,7 @@ public class ContentRootDataService implements ProjectDataService<ContentRootDat createSourceRootIfAbsent(contentEntry, path, module.getName(), JavaSourceRootType.TEST_SOURCE, true, createEmptyContentRootDirectories); } for (SourceRoot path : contentRoot.getPaths(ExternalSystemSourceType.EXCLUDED)) { - createExcludedRootIfAbsent(contentEntry, path, module.getName()); + createExcludedRootIfAbsent(contentEntry, path, module.getName(), module.getProject()); } contentEntriesMap.remove(contentEntry.getUrl()); } @@ -214,14 +219,18 @@ public class ContentRootDataService implements ProjectDataService<ContentRootDat } } - private static void createExcludedRootIfAbsent(@NotNull ContentEntry entry, @NotNull SourceRoot root, @NotNull String moduleName) { + private static void createExcludedRootIfAbsent(@NotNull ContentEntry entry, @NotNull SourceRoot root, @NotNull String moduleName, @NotNull Project project) { + String rootPath = root.getPath(); for (VirtualFile file : entry.getExcludeFolderFiles()) { - if (ExternalSystemApiUtil.getLocalFileSystemPath(file).equals(root.getPath())) { + if (ExternalSystemApiUtil.getLocalFileSystemPath(file).equals(rootPath)) { return; } } LOG.info(String.format("Importing excluded root '%s' for content root '%s' of module '%s'", root, entry.getUrl(), moduleName)); - entry.addExcludeFolder(toVfsUrl(root.getPath())); + entry.addExcludeFolder(toVfsUrl(rootPath)); + if (!Registry.is("ide.hide.excluded.files")) { + ChangeListManager.getInstance(project).addDirectoryToIgnoreImplicitly(rootPath); + } } @Override |