use of com.intellij.diff.requests.ErrorDiffRequest 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.ErrorDiffRequest in project intellij-community by JetBrains.
the class ChangeDiffRequestProducer method loadCurrentContents.
@NotNull
protected DiffRequest loadCurrentContents(@NotNull UserDataHolder context, @NotNull ProgressIndicator indicator) throws DiffRequestProducerException {
DiffRequestProducerException wrapperException = null;
DiffRequestProducerException requestException = null;
DiffViewerWrapper wrapper = null;
try {
for (ChangeDiffViewerWrapperProvider provider : ChangeDiffViewerWrapperProvider.EP_NAME.getExtensions()) {
if (provider.canCreate(myProject, myChange)) {
wrapper = provider.process(this, context, indicator);
break;
}
}
} catch (DiffRequestProducerException e) {
wrapperException = e;
}
DiffRequest request = null;
try {
for (ChangeDiffRequestProvider provider : ChangeDiffRequestProvider.EP_NAME.getExtensions()) {
if (provider.canCreate(myProject, myChange)) {
request = provider.process(this, context, indicator);
break;
}
}
if (request == null)
request = createRequest(myProject, myChange, context, indicator);
} catch (DiffRequestProducerException e) {
requestException = e;
}
if (requestException != null && wrapperException != null) {
String message = requestException.getMessage() + "\n\n" + wrapperException.getMessage();
throw new DiffRequestProducerException(message);
}
if (requestException != null) {
request = new ErrorDiffRequest(getRequestTitle(myChange), requestException);
LOG.info("Request: " + requestException.getMessage());
}
if (wrapperException != null) {
LOG.info("Wrapper: " + wrapperException.getMessage());
}
request.putUserData(CHANGE_KEY, myChange);
request.putUserData(DiffViewerWrapper.KEY, wrapper);
for (Map.Entry<Key, Object> entry : myChangeContext.entrySet()) {
request.putUserData(entry.getKey(), entry.getValue());
}
DiffUtil.putDataKey(request, VcsDataKeys.CURRENT_CHANGE, myChange);
return request;
}
Aggregations