}
});
}
private void openEditor(final RevisionInformation info) {
AbstractDecoratedTextEditor editor;
try {
if (storage instanceof IFile)
editor = RevisionAnnotationController.openEditor(page,
(IFile) storage);
else
editor = RevisionAnnotationController.openEditor(page, storage,
storage);
} catch (PartInitException e) {
Activator.handleError("Error displaying blame annotations", e, //$NON-NLS-1$
false);
return;
}
if (editor == null)
return;
// Show history view for path
try {
IHistoryView part = (IHistoryView) page.showView(
IHistoryView.VIEW_ID, null, IWorkbenchPage.VIEW_VISIBLE);
HistoryPageInput input = createHistoryPageInputWhenEditorOpened();
part.showHistoryFor(input);
} catch (PartInitException e) {
Activator.handleError("Error displaying blame annotations", e, //$NON-NLS-1$
false);
}
// IRevisionRulerColumn would also be possible but using
// IVerticalRulerInfo seems to work in more situations.
IVerticalRulerInfo rulerInfo = AdapterUtils.adapt(editor,
IVerticalRulerInfo.class);
BlameInformationControlCreator creator = new BlameInformationControlCreator(
rulerInfo);
info.setHoverControlCreator(creator);
info.setInformationPresenterControlCreator(creator);
editor.showRevisionInformation(info,
"org.eclipse.egit.ui.internal.decorators.GitQuickDiffProvider"); //$NON-NLS-1$
if (lineNumberToReveal >= 0) {
IDocument document = editor.getDocumentProvider().getDocument(
editor.getEditorInput());
int offset;
try {
offset = document.getLineOffset(lineNumberToReveal);
editor.selectAndReveal(offset, 0);
} catch (BadLocationException e) {
Activator.logError(
"Error revealing line " + lineNumberToReveal, e); //$NON-NLS-1$
}
}