예제 #1
0
 @Nullable
 private static ContentEntry findContentEntry(ModuleRootModel rootModel, VirtualFile file) {
   return ContainerUtil.find(
       rootModel.getContentEntries(),
       object -> {
         VirtualFile entryRoot = object.getFile();
         return entryRoot != null && VfsUtilCore.isAncestor(entryRoot, file, false);
       });
 }
 @Nullable
 public static ContentEntry findContentEntryForRoot(
     @NotNull ModifiableRootModel model, @NotNull VirtualFile root) {
   ContentEntry contentEntry = null;
   for (ContentEntry candidate : model.getContentEntries()) {
     VirtualFile contentRoot = candidate.getFile();
     if (contentRoot != null && VfsUtilCore.isAncestor(contentRoot, root, false)) {
       contentEntry = candidate;
     }
   }
   return contentEntry;
 }