public Change getChange(Project project) { // todo unify with if (myChange == null) { File baseDir = new File(project.getBaseDir().getPath()); File file = getAbsolutePath(baseDir, myBeforePath); FilePath beforePath = VcsUtil.getFilePath(file, false); beforePath.refresh(); ContentRevision beforeRevision = null; if (myFileStatus != FileStatus.ADDED) { beforeRevision = new CurrentContentRevision(beforePath) { @Override @NotNull public VcsRevisionNumber getRevisionNumber() { return new TextRevisionNumber(VcsBundle.message("local.version.title")); } }; } ContentRevision afterRevision = null; if (myFileStatus != FileStatus.DELETED) { FilePath afterPath = VcsUtil.getFilePath(getAbsolutePath(baseDir, myAfterPath), false); afterRevision = new PatchedContentRevision(project, beforePath, afterPath); } myChange = new Change(beforeRevision, afterRevision, myFileStatus); } return myChange; }
private String getBaseContent() { myBeforeFilePath.refresh(); return ApplicationManager.getApplication() .runReadAction( new Computable<String>() { @Override public String compute() { final Document doc = FileDocumentManager.getInstance() .getDocument(myBeforeFilePath.getVirtualFile()); return doc.getText(); } }); }