File tree Expand file tree Collapse file tree
src/com/reveal/codetimemachine Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -310,6 +310,8 @@ public void actionPerformed(ActionEvent e)
310310 final Runnable readRunner = new Runnable () {
311311 @ Override
312312 public void run () {
313+
314+ updateVirtualFileIfNeeded ();
313315 Document document = FileDocumentManager .getInstance ().getDocument (virtualFile );
314316 document .setText (commitList .get (TTMWindow .activeCommit_cIndex ).getFileContent ());
315317 }
@@ -400,23 +402,20 @@ public void actionPerformed(ActionEvent e)
400402
401403 void updateVirtualFileIfNeeded ()
402404 {
403- Document document = FileDocumentManager .getInstance ().getDocument (virtualFile );
404405 // if after reverting project, package names or ... changes the virtualFile path get invalid.
405406 // So we search for the new path of file.
406407 // Since we assume filename has not changed, we use valid part of old virtualFile (the filename).
407- if (document == null )
408+ if (virtualFile . isValid ()== false )
408409 {
409410 PsiFile [] filesByName = FilenameIndex .getFilesByName (project , virtualFile .getName (), new EverythingGlobalScope (project ));
410411 if (filesByName .length >0 )
411412 {
412413 virtualFile = filesByName [0 ].getVirtualFile ();
413- document = FileDocumentManager .getInstance ().getDocument (virtualFile );
414-
415- if (document == null )
416- {
417- // It means that the filename has also changed.
418- //#TODO: in such case, we can't renew virtualFile variable.
419- }
414+ }
415+ else
416+ {
417+ // It means that the filename has also changed.
418+ //#TODO: in such case, we can't renew virtualFile variable.
420419 }
421420 }
422421 }
You can’t perform that action at this time.
0 commit comments