Skip to content

Commit 8df1c5a

Browse files
committed
Fixing a new case of last commit's bug
1 parent 45d0689 commit 8df1c5a

1 file changed

Lines changed: 8 additions & 9 deletions

File tree

src/com/reveal/codetimemachine/Commits3DView.java

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff 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
}

0 commit comments

Comments
 (0)