mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
diff: cleanup - use consistent parameter order
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -284,7 +284,7 @@ public class DiffRequestFactoryImpl extends DiffRequestFactory {
|
||||
|
||||
List<DiffContent> 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);
|
||||
|
||||
@@ -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();
|
||||
|
||||
+4
-4
@@ -281,9 +281,9 @@ public class ChangeDiffRequestProducer implements DiffRequestProducer {
|
||||
|
||||
DiffContentFactory contentFactory = DiffContentFactory.getInstance();
|
||||
List<DiffContent> 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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user