use of com.intellij.openapi.diff.SimpleDiffRequest in project intellij-community by JetBrains.
the class OpenPartialDiffAction method actionPerformed.
public void actionPerformed(AnActionEvent e) {
DataContext dataContext = e.getDataContext();
MergePanel2 mergePanel = MergePanel2.fromDataContext(dataContext);
Project project = projectFromDataContext(dataContext);
Editor leftEditor = mergePanel.getEditor(myLeftIndex);
Editor rightEditor = mergePanel.getEditor(myRightIndex);
FileType type = mergePanel.getContentType();
SimpleDiffRequest diffData = new SimpleDiffRequest(project, composeName());
diffData.setContents(new DocumentContent(project, leftEditor.getDocument(), type), new DocumentContent(project, rightEditor.getDocument(), type));
diffData.setContentTitles(mergePanel.getVersionTitle(myLeftIndex), mergePanel.getVersionTitle(myRightIndex));
LOG.assertTrue(DiffManagerImpl.INTERNAL_DIFF.canShow(diffData));
DiffManagerImpl.INTERNAL_DIFF.show(diffData);
}
use of com.intellij.openapi.diff.SimpleDiffRequest in project intellij-community by JetBrains.
the class CompareFiles method getDiffRequest.
@Nullable
private static DiffRequest getDiffRequest(Project project, VirtualFile[] files) {
if (files == null || files.length != 2)
return null;
if (files[0].isDirectory() || files[1].isDirectory() || files[0].getFileType() instanceof ArchiveFileType || files[1].getFileType() instanceof ArchiveFileType) {
return null;
}
String title = DiffBundle.message("diff.element.qualified.name.vs.element.qualified.name.dialog.title", getVirtualFileContentTitle(files[0]), getVirtualFileContentTitle(files[1]));
SimpleDiffRequest diffRequest = DiffContentFactory.compareVirtualFiles(project, files[0], files[1], title);
if (diffRequest == null)
return null;
diffRequest.setContentTitles(getVirtualFileContentTitle(files[0]), getVirtualFileContentTitle(files[1]));
return diffRequest;
}
use of com.intellij.openapi.diff.SimpleDiffRequest in project intellij-community by JetBrains.
the class DiffContentFactory method compareVirtualFiles.
@Nullable
public static SimpleDiffRequest compareVirtualFiles(Project project, VirtualFile file1, VirtualFile file2, String title) {
DiffContent content1 = DiffContent.fromFile(project, file1);
DiffContent content2 = DiffContent.fromFile(project, file2);
if (content1 == null || content2 == null)
return null;
SimpleDiffRequest diffRequest = new SimpleDiffRequest(project, title);
diffRequest.setContents(content1, content2);
return diffRequest;
}
Aggregations