mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
VCS: if virtual file was not created when creating file path object, try to find it when gettings its document current contents
This commit is contained in:
@@ -39,11 +39,16 @@ public class CurrentContentRevision implements ContentRevision {
|
||||
|
||||
@Nullable
|
||||
public String getContent() {
|
||||
final VirtualFile vFile = getVirtualFile();
|
||||
if (vFile == null) return null;
|
||||
VirtualFile vFile = getVirtualFile();
|
||||
if (vFile == null) {
|
||||
myFile.refresh();
|
||||
vFile = getVirtualFile();
|
||||
if (vFile == null) return null;
|
||||
}
|
||||
final VirtualFile finalVFile = vFile;
|
||||
final Document doc = ApplicationManager.getApplication().runReadAction(new Computable<Document>() {
|
||||
public Document compute() {
|
||||
return FileDocumentManager.getInstance().getDocument(vFile);
|
||||
return FileDocumentManager.getInstance().getDocument(finalVFile);
|
||||
}});
|
||||
if (doc == null) return null;
|
||||
return doc.getText();
|
||||
|
||||
Reference in New Issue
Block a user