use of com.intellij.diff.contents.DiffContent in project intellij-community by JetBrains.
the class DiffActionExecutor method createRemote.
@Nullable
protected DiffContent createRemote(final VcsRevisionNumber revisionNumber) throws IOException, VcsException {
final ContentRevision fileRevision = myDiffProvider.createFileContent(revisionNumber, mySelectedFile);
if (fileRevision == null)
return null;
DiffContentFactoryEx contentFactory = DiffContentFactoryEx.getInstanceEx();
DiffContent diffContent;
if (fileRevision instanceof BinaryContentRevision) {
FilePath filePath = fileRevision.getFile();
final byte[] content = ((BinaryContentRevision) fileRevision).getBinaryContent();
if (content == null)
return null;
diffContent = contentFactory.createBinary(myProject, content, filePath.getFileType(), filePath.getName());
} else if (fileRevision instanceof ByteBackedContentRevision) {
byte[] content = ((ByteBackedContentRevision) fileRevision).getContentAsBytes();
if (content == null)
throw new VcsException("Failed to load content");
diffContent = contentFactory.createFromBytes(myProject, content, fileRevision.getFile());
} else {
String content = fileRevision.getContent();
if (content == null)
throw new VcsException("Failed to load content");
diffContent = contentFactory.create(myProject, content, fileRevision.getFile());
}
diffContent.putUserData(DiffUserDataKeysEx.REVISION_INFO, Pair.create(fileRevision.getFile(), fileRevision.getRevisionNumber()));
return diffContent;
}
use of com.intellij.diff.contents.DiffContent in project intellij-community by JetBrains.
the class AnnotateDiffViewerAction method createThreesideAnnotationsLoader.
@Nullable
private static FileAnnotationLoader createThreesideAnnotationsLoader(@NotNull Project project, @NotNull DiffRequest request, @NotNull ThreeSide side) {
if (request instanceof ContentDiffRequest) {
ContentDiffRequest requestEx = (ContentDiffRequest) request;
if (requestEx.getContents().size() == 3) {
DiffContent content = side.select(requestEx.getContents());
FileAnnotationLoader loader = createAnnotationsLoader(project, content);
if (loader != null)
return loader;
}
}
return null;
}
use of com.intellij.diff.contents.DiffContent in project intellij-community by JetBrains.
the class SmartTextDiffProvider method create.
@Nullable
public static TwosideTextDiffProvider create(@Nullable Project project, @NotNull ContentDiffRequest request, @NotNull TextDiffSettings settings, @NotNull Runnable rediff, @NotNull Disposable disposable) {
DiffContent content1 = Side.LEFT.select(request.getContents());
DiffContent content2 = Side.RIGHT.select(request.getContents());
DiffIgnoredRangeProvider ignoredRangeProvider = getIgnoredRangeProvider(project, content1, content2);
if (ignoredRangeProvider == null)
return null;
return new SmartTextDiffProvider(project, content1, content2, settings, rediff, disposable, ignoredRangeProvider);
}
use of com.intellij.diff.contents.DiffContent in project intellij-community by JetBrains.
the class SmartTextDiffProvider method createNoIgnore.
@Nullable
public static TwosideTextDiffProvider.NoIgnore createNoIgnore(@Nullable Project project, @NotNull ContentDiffRequest request, @NotNull TextDiffSettings settings, @NotNull Runnable rediff, @NotNull Disposable disposable) {
DiffContent content1 = Side.LEFT.select(request.getContents());
DiffContent content2 = Side.RIGHT.select(request.getContents());
DiffIgnoredRangeProvider ignoredRangeProvider = getIgnoredRangeProvider(project, content1, content2);
if (ignoredRangeProvider == null)
return null;
return new SmartTextDiffProvider.NoIgnore(project, content1, content2, settings, rediff, disposable, ignoredRangeProvider);
}
use of com.intellij.diff.contents.DiffContent in project intellij-community by JetBrains.
the class ExternalMergeTool method canShow.
public static boolean canShow(@NotNull MergeRequest request) {
if (request instanceof ThreesideMergeRequest) {
DiffContent outputContent = ((ThreesideMergeRequest) request).getOutputContent();
if (!canProcessOutputContent(outputContent))
return false;
List<? extends DiffContent> contents = ((ThreesideMergeRequest) request).getContents();
if (contents.size() != 3)
return false;
for (DiffContent content : contents) {
if (!ExternalDiffToolUtil.canCreateFile(content))
return false;
}
return true;
}
return false;
}
Aggregations