summaryrefslogtreecommitdiff
path: root/platform/core-api/src/com/intellij/openapi/vfs/VfsUtilCore.java
diff options
context:
space:
mode:
Diffstat (limited to 'platform/core-api/src/com/intellij/openapi/vfs/VfsUtilCore.java')
-rw-r--r--platform/core-api/src/com/intellij/openapi/vfs/VfsUtilCore.java14
1 files changed, 14 insertions, 0 deletions
diff --git a/platform/core-api/src/com/intellij/openapi/vfs/VfsUtilCore.java b/platform/core-api/src/com/intellij/openapi/vfs/VfsUtilCore.java
index cd0f15f3796c..9e8c37880589 100644
--- a/platform/core-api/src/com/intellij/openapi/vfs/VfsUtilCore.java
+++ b/platform/core-api/src/com/intellij/openapi/vfs/VfsUtilCore.java
@@ -84,6 +84,20 @@ public class VfsUtilCore {
return false;
}
+ /**
+ * @return {@code true} if {@code url} is located under one of {@code rootUrls} or equal to one of them
+ */
+ public static boolean isUnder(@NotNull String url, @Nullable Collection<String> rootUrls) {
+ if (rootUrls == null || rootUrls.isEmpty()) return false;
+
+ for (String excludesUrl : rootUrls) {
+ if (isEqualOrAncestor(excludesUrl, url)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
public static boolean isEqualOrAncestor(@NotNull String ancestorUrl, @NotNull String fileUrl) {
if (ancestorUrl.equals(fileUrl)) return true;
if (StringUtil.endsWithChar(ancestorUrl, '/')) {