private void markContentRootsForRefresh() {
   for (Module module : ModuleManager.getInstance(myProject).getModules()) {
     for (VirtualFile contentRoot : ModuleRootManager.getInstance(module).getContentRoots()) {
       if (contentRoot instanceof NewVirtualFile) {
         ((NewVirtualFile) contentRoot).markDirtyRecursively();
       }
     }
   }
 }
Beispiel #2
0
  public static void markDirtyAndRefresh(
      boolean async, boolean recursive, boolean loadChildren, VirtualFile... files) {
    List<VirtualFile> list = ContainerUtil.filter(Condition.NOT_NULL, files);
    if (list.isEmpty()) {
      return;
    }

    for (VirtualFile file : list) {
      if (loadChildren) {
        file.getChildren();
      }

      if (file instanceof NewVirtualFile) {
        if (recursive) {
          ((NewVirtualFile) file).markDirtyRecursively();
        } else {
          ((NewVirtualFile) file).markDirty();
        }
      }
    }

    LocalFileSystem.getInstance().refreshFiles(list, async, recursive, null);
  }