use of com.intellij.openapi.vcs.history.ShortVcsRevisionNumber in project intellij-community by JetBrains.
the class VcsVirtualFile method loadContent.
private void loadContent() throws IOException {
if (myContent != null)
return;
assert myFileRevision != null;
final VcsFileSystem vcsFileSystem = ((VcsFileSystem) getFileSystem());
try {
myFileRevision.loadContent();
fireBeforeContentsChange();
myModificationStamp++;
final VcsRevisionNumber revisionNumber = myFileRevision.getRevisionNumber();
if (revisionNumber instanceof ShortVcsRevisionNumber) {
setRevision(((ShortVcsRevisionNumber) revisionNumber).toShortString());
} else {
setRevision(revisionNumber.asString());
}
myContent = myFileRevision.getContent();
myCharset = new CharsetToolkit(myContent).guessEncoding(myContent.length);
ApplicationManager.getApplication().runWriteAction(new Runnable() {
public void run() {
vcsFileSystem.fireContentsChanged(this, VcsVirtualFile.this, 0);
}
});
} catch (VcsException e) {
myContentLoadFailed = true;
ApplicationManager.getApplication().runWriteAction(new Runnable() {
public void run() {
vcsFileSystem.fireBeforeFileDeletion(this, VcsVirtualFile.this);
}
});
myContent = ArrayUtil.EMPTY_BYTE_ARRAY;
setRevision("0");
Messages.showMessageDialog(VcsBundle.message("message.text.could.not.load.virtual.file.content", getPresentableUrl(), e.getLocalizedMessage()), VcsBundle.message("message.title.could.not.load.content"), Messages.getInformationIcon());
ApplicationManager.getApplication().runWriteAction(new Runnable() {
public void run() {
vcsFileSystem.fireFileDeleted(this, VcsVirtualFile.this, getName(), getParent());
}
});
} catch (ProcessCanceledException ex) {
myContent = null;
}
}
Aggregations