compareWithSelectedVersion(dialog.getSelectedEntry());
}
}
private void compareWithSelectedVersion(ResourceHistoryEntry revision) {
IResponse response = null;
try {
IWorkbenchPage page = targetPart.getSite().getPage();
String leftContents = StreamProcessingUtils.getStreamContents(selectedFile.getContents());
GuvnorResourceEdition left =
new GuvnorResourceEdition(selectedFile.getName(),
ITypedElement.TEXT_TYPE,
leftContents, selectedFile.getCharset());
response = client.getResourceVersionInputStream(props.getFullpath(), revision.getRevision());
String rightContents = StreamProcessingUtils.getStreamContents(response.getInputStream());
//Assuming UTF-8 for Guvnor resources...
GuvnorResourceEdition right =
new GuvnorResourceEdition(selectedFile.getName() + ", " + revision.getRevision(), //$NON-NLS-1$
ITypedElement.TEXT_TYPE,
rightContents, "UTF-8"); //$NON-NLS-1$
CompareUI.openCompareEditorOnPage(new GuvnorCompareEditorInput(left, right), page);
} catch (Exception e) {
Activator.getDefault().displayError(IStatus.ERROR, e.getMessage(), e, true);
} finally {
if (response != null) {
try {
response.close();
} catch (IOException ioe) {
Activator.getDefault().writeLog(IStatus.ERROR, ioe.getMessage(), ioe);
}
}
}