use of com.intellij.diff.requests.SimpleDiffRequest in project intellij-community by JetBrains.
the class FileWithBranchComparer method showResult.
@Override
protected void showResult() {
if (!success.isNull()) {
String title = SvnBundle.message("compare.with.branch.diff.title");
String title1 = remoteTitleBuilder.toString();
String title2 = myVirtualFile.getPresentableUrl();
try {
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);
DiffManager.getInstance().showDiff(myProject, request);
} catch (IOException e) {
reportGeneralException(e);
}
}
}
use of com.intellij.diff.requests.SimpleDiffRequest in project intellij-community by JetBrains.
the class TestDiffRequestProcessor method loadRequest.
@NotNull
private DiffRequest loadRequest() {
if (myIndex < 0 || myIndex >= myRequests.size())
return NoDiffRequest.INSTANCE;
DiffHyperlink hyperlink = myRequests.get(myIndex);
try {
String windowTitle = hyperlink.getDiffTitle();
String text1 = hyperlink.getLeft();
String text2 = hyperlink.getRight();
VirtualFile file1 = findFile(hyperlink.getFilePath());
VirtualFile file2 = findFile(hyperlink.getActualFilePath());
DiffContent content1 = createContentWithTitle(getProject(), text1, file1, file2);
DiffContent content2 = createContentWithTitle(getProject(), text2, file2, file1);
String title1 = getContentTitle("diff.content.expected.title", file1);
String title2 = getContentTitle("diff.content.actual.title", file2);
return new SimpleDiffRequest(windowTitle, content1, content2, title1, title2);
} catch (Exception e) {
return new ErrorDiffRequest(e);
}
}
use of com.intellij.diff.requests.SimpleDiffRequest in project intellij-community by JetBrains.
the class VcsSelectionHistoryDialog method updateDiff.
private void updateDiff() {
if (myIsDisposed || myIsDuringUpdate)
return;
if (myList.getSelectedRowCount() == 0) {
myDiffPanel.setRequest(NoDiffRequest.INSTANCE);
return;
}
int count = myRevisions.size();
IntPair range = getSelectedRevisionsRange();
int revIndex1 = range.val2;
int revIndex2 = range.val1;
if (revIndex1 == count && revIndex2 == count) {
myDiffPanel.setRequest(NoDiffRequest.INSTANCE);
return;
}
BlockData blockData = myBlockLoader.getLoadedData();
DiffContent content1 = createDiffContent(revIndex1, blockData);
DiffContent content2 = createDiffContent(revIndex2, blockData);
String title1 = createDiffContentTitle(revIndex1);
String title2 = createDiffContentTitle(revIndex2);
if (content1 != null && content2 != null) {
myDiffPanel.setRequest(new SimpleDiffRequest(null, content1, content2, title1, title2), new IntPair(revIndex1, revIndex2));
return;
}
if (blockData.isLoading()) {
myDiffPanel.setRequest(new LoadingDiffRequest());
} else {
myDiffPanel.setRequest(new MessageDiffRequest(canNoLoadMessage(blockData.getException())));
}
}
use of com.intellij.diff.requests.SimpleDiffRequest in project intellij-community by JetBrains.
the class PsiDiffContentFactory method comparePsiElements.
@Nullable
public static DiffRequest comparePsiElements(@NotNull PsiElement psiElement1, @NotNull PsiElement psiElement2) {
if (!psiElement1.isValid() || !psiElement2.isValid())
return null;
Project project = psiElement1.getProject();
LOG.assertTrue(project == psiElement2.getProject());
DiffContent content1 = fromPsiElement(psiElement1);
DiffContent content2 = fromPsiElement(psiElement2);
if (content1 == null || content2 == null)
return null;
final ElementPresentation presentation1 = ElementPresentation.forElement(psiElement1);
final ElementPresentation presentation2 = ElementPresentation.forElement(psiElement2);
String title = DiffBundle.message("diff.element.qualified.name.vs.element.qualified.name.dialog.title", presentation1.getQualifiedName(), presentation2.getQualifiedName());
return new SimpleDiffRequest(title, content1, content2, presentation1.getQualifiedName(), presentation2.getQualifiedName());
}
use of com.intellij.diff.requests.SimpleDiffRequest in project intellij-community by JetBrains.
the class DiffRequestFactoryImpl method createFromFiles.
//
// Diff
//
@NotNull
@Override
public ContentDiffRequest createFromFiles(@Nullable Project project, @NotNull VirtualFile file1, @NotNull VirtualFile file2) {
DiffContent content1 = myContentFactory.create(project, file1);
DiffContent content2 = myContentFactory.create(project, file2);
String title1 = getContentTitle(file1);
String title2 = getContentTitle(file2);
String title = getTitle(file1, file2);
return new SimpleDiffRequest(title, content1, content2, title1, title2);
}
Aggregations