use of com.intellij.execution.testframework.stacktrace.DiffHyperlink 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.execution.testframework.stacktrace.DiffHyperlink in project intellij-community by JetBrains.
the class ViewAssertEqualsDiffAction method collectAvailableProviders.
private static List<DiffHyperlink> collectAvailableProviders(TestFrameworkRunningModel model) {
final List<DiffHyperlink> providers = new ArrayList<>();
if (model != null) {
final AbstractTestProxy root = model.getRoot();
final List<? extends AbstractTestProxy> allTests = root.getAllTests();
for (AbstractTestProxy test : allTests) {
if (test.isLeaf()) {
providers.addAll(test.getDiffViewerProviders());
}
}
}
return providers;
}
use of com.intellij.execution.testframework.stacktrace.DiffHyperlink in project intellij-community by JetBrains.
the class ViewAssertEqualsDiffAction method openDiff.
public static boolean openDiff(DataContext context, @Nullable DiffHyperlink currentHyperlink) {
final AbstractTestProxy testProxy = AbstractTestProxy.DATA_KEY.getData(context);
final Project project = CommonDataKeys.PROJECT.getData(context);
if (testProxy != null) {
DiffHyperlink diffViewerProvider = testProxy.getDiffViewerProvider();
if (diffViewerProvider != null) {
final List<DiffHyperlink> providers = collectAvailableProviders(TestTreeView.MODEL_DATA_KEY.getData(context));
int index = currentHyperlink != null ? providers.indexOf(currentHyperlink) : -1;
if (index == -1)
index = providers.indexOf(diffViewerProvider);
new MyDiffWindow(project, providers, Math.max(0, index)).show();
return true;
}
}
if (currentHyperlink != null) {
new MyDiffWindow(project, currentHyperlink).show();
return true;
}
return false;
}
Aggregations