diff --git a/platform/diff-api/src/com/intellij/diff/DiffContentFactory.java b/platform/diff-api/src/com/intellij/diff/DiffContentFactory.java index 33ee1745fc92..2ef86fb34119 100644 --- a/platform/diff-api/src/com/intellij/diff/DiffContentFactory.java +++ b/platform/diff-api/src/com/intellij/diff/DiffContentFactory.java @@ -125,12 +125,30 @@ public abstract class DiffContentFactory { @NotNull public abstract DiffContent createFromBytes(@Nullable Project project, - @NotNull VirtualFile highlightFile, - @NotNull byte[] content) throws IOException; + @NotNull byte[] content, + @NotNull VirtualFile highlightFile) throws IOException; @NotNull public abstract DiffContent createBinary(@Nullable Project project, - @NotNull String fileName, + @NotNull byte[] content, @NotNull FileType type, - @NotNull byte[] content) throws IOException; + @NotNull String fileName) throws IOException; + + + @NotNull + @Deprecated + public DiffContent createFromBytes(@Nullable Project project, + @NotNull VirtualFile highlightFile, + @NotNull byte[] content) throws IOException { + return createFromBytes(project, content, highlightFile); + } + + @NotNull + @Deprecated + public DiffContent createBinary(@Nullable Project project, + @NotNull String fileName, + @NotNull FileType type, + @NotNull byte[] content) throws IOException { + return createBinary(project, content, type, fileName); + } } diff --git a/platform/diff-impl/src/com/intellij/diff/DiffContentFactoryEx.java b/platform/diff-impl/src/com/intellij/diff/DiffContentFactoryEx.java index 72d5f78dfb5c..b07b10d32491 100644 --- a/platform/diff-impl/src/com/intellij/diff/DiffContentFactoryEx.java +++ b/platform/diff-impl/src/com/intellij/diff/DiffContentFactoryEx.java @@ -31,6 +31,6 @@ public abstract class DiffContentFactoryEx extends DiffContentFactory { @NotNull public abstract DiffContent createFromBytes(@Nullable Project project, - @NotNull FilePath filePath, - @NotNull byte[] content) throws IOException; + @NotNull byte[] content, + @NotNull FilePath filePath) throws IOException; } diff --git a/platform/diff-impl/src/com/intellij/diff/DiffContentFactoryImpl.java b/platform/diff-impl/src/com/intellij/diff/DiffContentFactoryImpl.java index caec83593ed2..597e8d49a9d3 100644 --- a/platform/diff-impl/src/com/intellij/diff/DiffContentFactoryImpl.java +++ b/platform/diff-impl/src/com/intellij/diff/DiffContentFactoryImpl.java @@ -234,10 +234,10 @@ public class DiffContentFactoryImpl extends DiffContentFactoryEx { @NotNull @Override public DiffContent createFromBytes(@Nullable Project project, - @NotNull FilePath filePath, - @NotNull byte[] content) throws IOException { + @NotNull byte[] content, + @NotNull FilePath filePath) throws IOException { if (filePath.getFileType().isBinary()) { - return createBinary(project, filePath.getName(), filePath.getFileType(), content); + return createBinary(project, content, filePath.getFileType(), filePath.getName()); } return FileAwareDocumentContent.create(project, content, filePath); @@ -246,11 +246,11 @@ public class DiffContentFactoryImpl extends DiffContentFactoryEx { @NotNull @Override public DiffContent createFromBytes(@Nullable Project project, - @NotNull VirtualFile highlightFile, - @NotNull byte[] content) throws IOException { + @NotNull byte[] content, + @NotNull VirtualFile highlightFile) throws IOException { // TODO: check if FileType.UNKNOWN is actually a text ? if (highlightFile.getFileType().isBinary()) { - return createBinary(project, highlightFile.getName(), highlightFile.getFileType(), content); + return createBinary(project, content, highlightFile.getFileType(), highlightFile.getName()); } return FileAwareDocumentContent.create(project, content, highlightFile); @@ -259,9 +259,9 @@ public class DiffContentFactoryImpl extends DiffContentFactoryEx { @NotNull @Override public DiffContent createBinary(@Nullable Project project, - @NotNull String fileName, + @NotNull byte[] content, @NotNull FileType type, - @NotNull byte[] content) throws IOException { + @NotNull String fileName) throws IOException { // workaround - our JarFileSystem and decompilers can't process non-local files boolean useTemporalFile = type instanceof ArchiveFileType || BinaryFileTypeDecompilers.INSTANCE.forFileType(type) != null; diff --git a/platform/diff-impl/src/com/intellij/diff/DiffRequestFactoryImpl.java b/platform/diff-impl/src/com/intellij/diff/DiffRequestFactoryImpl.java index 4a6bc8313289..46c553fc264f 100644 --- a/platform/diff-impl/src/com/intellij/diff/DiffRequestFactoryImpl.java +++ b/platform/diff-impl/src/com/intellij/diff/DiffRequestFactoryImpl.java @@ -284,7 +284,7 @@ public class DiffRequestFactoryImpl extends DiffRequestFactory { List contents = new ArrayList<>(3); for (byte[] bytes : byteContents) { - contents.add(myContentFactory.createFromBytes(project, output, bytes)); + contents.add(myContentFactory.createFromBytes(project, bytes, output)); } return new BinaryMergeRequestImpl(project, outputContent, originalContent, contents, byteContents, title, contentTitles, applyCallback); diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/actions/DiffActionExecutor.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/actions/DiffActionExecutor.java index c4cec14255e3..9c16dde36715 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/actions/DiffActionExecutor.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/actions/DiffActionExecutor.java @@ -78,7 +78,7 @@ public abstract class DiffActionExecutor { final byte[] content = ((BinaryContentRevision)fileRevision).getBinaryContent(); if (content == null) return null; - diffContent = DiffContentFactory.getInstance().createBinary(myProject, filePath.getName(), filePath.getFileType(), content); + diffContent = DiffContentFactory.getInstance().createBinary(myProject, content, filePath.getFileType(), filePath.getName()); } else if (fileRevision instanceof ByteBackedContentRevision) { byte[] content = ((ByteBackedContentRevision)fileRevision).getContentAsBytes(); diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/actions/diff/ChangeDiffRequestProducer.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/actions/diff/ChangeDiffRequestProducer.java index cf752c8151f9..99acbc7c4ee4 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/actions/diff/ChangeDiffRequestProducer.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/actions/diff/ChangeDiffRequestProducer.java @@ -281,9 +281,9 @@ public class ChangeDiffRequestProducer implements DiffRequestProducer { DiffContentFactory contentFactory = DiffContentFactory.getInstance(); List contents = ContainerUtil.list( - contentFactory.createFromBytes(project, file, mergeData.CURRENT), - contentFactory.createFromBytes(project, file, mergeData.ORIGINAL), - contentFactory.createFromBytes(project, file, mergeData.LAST) + contentFactory.createFromBytes(project, mergeData.CURRENT, file), + contentFactory.createFromBytes(project, mergeData.ORIGINAL, file), + contentFactory.createFromBytes(project, mergeData.LAST, file) ); SimpleDiffRequest request = new SimpleDiffRequest(title, contents, titles); @@ -387,7 +387,7 @@ public class ChangeDiffRequestProducer implements DiffRequestProducer { if (content == null) { throw new DiffRequestProducerException("Can't get binary revision content"); } - return DiffContentFactory.getInstance().createBinary(project, filePath.getName(), filePath.getFileType(), content); + return DiffContentFactory.getInstance().createBinary(project, content, filePath.getFileType(), filePath.getName()); } if (revision instanceof ByteBackedContentRevision) { diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/history/VcsHistoryUtil.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/history/VcsHistoryUtil.java index a70642f5b26a..49f6fc375b54 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/history/VcsHistoryUtil.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/history/VcsHistoryUtil.java @@ -171,7 +171,7 @@ public class VcsHistoryUtil { if (isEmpty(revision)) { return contentFactory.createEmpty(); } - return contentFactory.createFromBytes(project, filePath, content); + return contentFactory.createFromBytes(project, content, filePath); } private static boolean isCurrent(VcsFileRevision revision) { diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/update/ShowUpdatedDiffAction.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/update/ShowUpdatedDiffAction.java index 4aa432c76a61..bfae29e0a309 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/update/ShowUpdatedDiffAction.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/update/ShowUpdatedDiffAction.java @@ -188,7 +188,7 @@ public class ShowUpdatedDiffAction extends AnAction implements DumbAware { } else { byte[] bytes1 = loadContent(myFilePointer, myBefore); - content1 = contentFactory.createFromBytes(myProject, myFilePath, bytes1); + content1 = contentFactory.createFromBytes(myProject, bytes1, myFilePath); } if (FileStatus.DELETED.equals(myFileStatus)) { @@ -196,7 +196,7 @@ public class ShowUpdatedDiffAction extends AnAction implements DumbAware { } else { byte[] bytes2 = loadContent(myFilePointer, myAfter); - content2 = contentFactory.createFromBytes(myProject, myFilePath, bytes2); + content2 = contentFactory.createFromBytes(myProject, bytes2, myFilePath); } String title = DiffRequestFactoryImpl.getContentTitle(myFilePath); diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/diff/FileWithBranchComparer.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/diff/FileWithBranchComparer.java index 38b19ef79fff..30a7a01b0da4 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/diff/FileWithBranchComparer.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/diff/FileWithBranchComparer.java @@ -75,7 +75,7 @@ public class FileWithBranchComparer extends ElementWithBranchComparer { String title2 = myVirtualFile.getPresentableUrl(); try { - DiffContent content1 = DiffContentFactory.getInstance().createFromBytes(myProject, myVirtualFile, content.get()); + DiffContent content1 = DiffContentFactory.getInstance().createFromBytes(myProject, content.get(), myVirtualFile); DiffContent content2 = DiffContentFactory.getInstance().create(myProject, myVirtualFile); DiffRequest request = new SimpleDiffRequest(title, content1, content2, title1, title2);