- MyCheckpointContentRevision before = new MyCheckpointContentRevision(pointer, myBeforeLoader, true, myProject);
- MyCheckpointContentRevision after = new MyCheckpointContentRevision(pointer, myAfterLoader, false, myProject);
- if (FileStatus.ADDED.equals(pair.getSecond())) {
- before = null;
- } else if (FileStatus.DELETED.equals(pair.getSecond())) {
- after = null;
+ @NotNull
+ @Override
+ public String getName() {
+ return myFilePointer.getUrl();
+ }
+
+ @NotNull
+ public FilePath getFilePath() {
+ return myFilePath;
+ }
+
+ @NotNull
+ public FileStatus getFileStatus() {
+ return myFileStatus;
+ }
+
+ @NotNull
+ @Override
+ public DiffRequest process(@NotNull UserDataHolder context, @NotNull ProgressIndicator indicator)
+ throws DiffRequestProducerException, ProcessCanceledException {
+ try {
+ DiffContent content1;
+ DiffContent content2;
+
+ if (FileStatus.ADDED.equals(myFileStatus)) {
+ content1 = DiffContentFactory.getInstance().createEmpty();
+ }
+ else {
+ byte[] bytes1 = loadContent(myFilePointer, myBefore);
+ content1 = DiffContentFactoryImpl.getInstanceImpl().createFromBytes(myProject, myFilePath, bytes1);
+ }
+
+ if (FileStatus.DELETED.equals(myFileStatus)) {
+ content2 = DiffContentFactory.getInstance().createEmpty();
+ }
+ else {
+ byte[] bytes2 = loadContent(myFilePointer, myAfter);
+ content2 = DiffContentFactoryImpl.getInstanceImpl().createFromBytes(myProject, myFilePath, bytes2);
+ }
+
+ String title = DiffRequestFactoryImpl.getContentTitle(myFilePath);
+ return new SimpleDiffRequest(title, content1, content2, "Before update", "After update");
+ }
+ catch (IOException e) {
+ throw new DiffRequestProducerException("Can't load content", e);
+ }