WI-8640 recursive remote file sync needs the ability to sync on selected files
authorShaverdova Elena <eshaverdova@gmail.com>
Fri, 20 Jan 2012 18:58:21 +0000 (22:58 +0400)
committerShaverdova Elena <eshaverdova@gmail.com>
Mon, 23 Jan 2012 15:20:44 +0000 (19:20 +0400)
platform/platform-impl/src/com/intellij/ide/diff/VirtualFileDiffElement.java

index 67ef51bd45b5ec8fb98c6c65be82b8220cf7fefc..c1aeecb5e5eb89e4c06dc3f7fbcfbc6a65b9485d 100644 (file)
@@ -224,12 +224,16 @@ public class VirtualFileDiffElement extends DiffElement<VirtualFile> {
 
   @Override
   public void refresh(boolean userInitiated) {
+    refreshFile(userInitiated, myFile);
+  }
+
+  public static void refreshFile(boolean userInitiated, VirtualFile virtualFile) {
     if (userInitiated) {
       final List<Document> docsToSave = new ArrayList<Document>();
       final FileDocumentManager manager = FileDocumentManager.getInstance();
       for (Document document : manager.getUnsavedDocuments()) {
         VirtualFile file = manager.getFile(document);
-        if (file!=null && VfsUtilCore.isAncestor(myFile, file, false)) {
+        if (file!=null && VfsUtilCore.isAncestor(virtualFile, file, false)) {
           docsToSave.add(document);
         }
       }
@@ -251,9 +255,9 @@ public class VirtualFileDiffElement extends DiffElement<VirtualFile> {
         }, ModalityState.defaultModalityState());
       }
     }
-    if (!FileWatcher.getInstance().isWatched(myFile)) {
-      ((NewVirtualFile)myFile).markDirtyRecursively();
+    if (!FileWatcher.getInstance().isWatched(virtualFile)) {
+      ((NewVirtualFile)virtualFile).markDirtyRecursively();
     }
-    myFile.refresh(false, true);
+    virtualFile.refresh(false, true);
   }
 }