ColumnViewerToolTipSupport.enableFor(refLogTableTreeViewer);
TreeViewerColumn toColumn = createColumn(layout,
UIText.ReflogView_CommitColumnHeader, 10, SWT.LEFT);
toColumn.setLabelProvider(new ColumnLabelProvider() {
@Override
public String getText(Object element) {
final ReflogEntry entry = (ReflogEntry) element;
return entry.getNewId().abbreviate(7).name();
}
@Override
public String getToolTipText(Object element) {
final ReflogEntry entry = (ReflogEntry) element;
return entry.getNewId().name();
}
@Override
public Image getImage(Object element) {
return branchImage;
}
});
TreeViewerColumn commitMessageColumn = createColumn(layout,
UIText.ReflogView_CommitMessageColumnHeader, 40, SWT.LEFT);
commitMessageColumn.setLabelProvider(new ColumnLabelProvider() {
@Override
public String getText(Object element) {
final ReflogEntry entry = (ReflogEntry) element;
RevCommit c = getCommit(entry);
return c == null ? "" : c.getShortMessage(); //$NON-NLS-1$
}
private RevCommit getCommit(final ReflogEntry entry) {
RevWalk walk = new RevWalk(getRepository());
walk.setRetainBody(true);
RevCommit c = null;
try {
c = walk.parseCommit(entry.getNewId());
} catch (IOException ignored) {
// ignore
} finally {
walk.release();
}
return c;
}
});
TreeViewerColumn dateColumn = createColumn(layout,
UIText.ReflogView_DateColumnHeader, 15, SWT.LEFT);
dateColumn.setLabelProvider(new ColumnLabelProvider() {
@Override
public String getText(Object element) {
final ReflogEntry entry = (ReflogEntry) element;
final PersonIdent who = entry.getWho();
// TODO add option to use RelativeDateFormatter
return absoluteFormatter.format(who.getWhen());
}
@Override
public Image getImage(Object element) {
return null;
}
});
TreeViewerColumn messageColumn = createColumn(layout,
UIText.ReflogView_MessageColumnHeader, 40, SWT.LEFT);
messageColumn.setLabelProvider(new ColumnLabelProvider() {
private ResourceManager resourceManager = new LocalResourceManager(
JFaceResources.getResources());
@Override