save document before creating student file
authorliana.bakradze <liana.bakradze@jetbrains.com>
Thu, 28 Jul 2016 08:30:58 +0000 (11:30 +0300)
committerliana.bakradze <liana.bakradze@jetbrains.com>
Thu, 28 Jul 2016 08:30:58 +0000 (11:30 +0300)
python/educational-core/student/src/com/jetbrains/edu/learning/core/EduUtils.java

index 4a2e549ac7be63558ef78e33ee615032b8249b72..9966a7b80ebd3dd005255664a2d16555d074e8e1 100644 (file)
@@ -111,6 +111,10 @@ public class EduUtils {
 
 
   public static VirtualFile copyFile(Object requestor, VirtualFile toDir, VirtualFile file) {
+    Document document = FileDocumentManager.getInstance().getDocument(file);
+    if (document != null) {
+      FileDocumentManager.getInstance().saveDocument(document);
+    }
     String name = file.getName();
     try {
       VirtualFile userFile = toDir.findChild(name);