summaryrefslogtreecommitdiff
path: root/platform/lang-impl/src/com/intellij/openapi/roots/libraries/ui/impl/RootDetectionUtil.java
diff options
context:
space:
mode:
Diffstat (limited to 'platform/lang-impl/src/com/intellij/openapi/roots/libraries/ui/impl/RootDetectionUtil.java')
-rw-r--r--platform/lang-impl/src/com/intellij/openapi/roots/libraries/ui/impl/RootDetectionUtil.java8
1 files changed, 4 insertions, 4 deletions
diff --git a/platform/lang-impl/src/com/intellij/openapi/roots/libraries/ui/impl/RootDetectionUtil.java b/platform/lang-impl/src/com/intellij/openapi/roots/libraries/ui/impl/RootDetectionUtil.java
index 5a3efe1a31b7..ca273ba2373d 100644
--- a/platform/lang-impl/src/com/intellij/openapi/roots/libraries/ui/impl/RootDetectionUtil.java
+++ b/platform/lang-impl/src/com/intellij/openapi/roots/libraries/ui/impl/RootDetectionUtil.java
@@ -70,7 +70,7 @@ public class RootDetectionUtil {
try {
for (VirtualFile rootCandidate : rootCandidates) {
final Collection<DetectedLibraryRoot> roots = detector.detectRoots(rootCandidate, indicator);
- if (!roots.isEmpty() && allRootsHaveOneTypeAndEqualTo(roots, rootCandidate)) {
+ if (!roots.isEmpty() && allRootsHaveOneTypeAndEqualToOrAreDirectParentOf(roots, rootCandidate)) {
for (DetectedLibraryRoot root : roots) {
final LibraryRootType libraryRootType = root.getTypes().get(0);
result.add(new OrderRoot(root.getFile(), libraryRootType.getType(), libraryRootType.isJarDirectory()));
@@ -81,7 +81,7 @@ public class RootDetectionUtil {
final HashMap<LibraryRootType, String> names = new HashMap<LibraryRootType, String>();
for (LibraryRootType type : root.getTypes()) {
final String typeName = detector.getRootTypeName(type);
- LOG.assertTrue(typeName != null, "Unexpected root type " + type.getType().name() + (type.isJarDirectory() ? " (jar directory)" : "") + ", detectors: " + detector);
+ LOG.assertTrue(typeName != null, "Unexpected root type " + type.getType().name() + (type.isJarDirectory() ? " (JAR directory)" : "") + ", detectors: " + detector);
names.put(type, typeName);
}
suggestedRoots.add(new SuggestedChildRootInfo(rootCandidate, root, names));
@@ -141,9 +141,9 @@ public class RootDetectionUtil {
return result;
}
- private static boolean allRootsHaveOneTypeAndEqualTo(Collection<DetectedLibraryRoot> roots, VirtualFile candidate) {
+ private static boolean allRootsHaveOneTypeAndEqualToOrAreDirectParentOf(Collection<DetectedLibraryRoot> roots, VirtualFile candidate) {
for (DetectedLibraryRoot root : roots) {
- if (root.getTypes().size() > 1 || !root.getFile().equals(candidate)) {
+ if (root.getTypes().size() > 1 || !root.getFile().equals(candidate) && !root.getFile().equals(candidate.getParent())) {
return false;
}
}