UIText.RebaseInteractiveView_HeadingCommitDate };
ColumnViewerToolTipSupport.enableFor(planTreeViewer,
ToolTip.NO_RECREATE);
TreeViewerColumn infoColumn = createColumn(headings[0], 70);
infoColumn.setLabelProvider(new HighlightingColumnLabelProvider() {
@Override
public Image getImage(Object element) {
ElementType t = getType(element);
if (t != null) {
switch (t) {
case DONE_CURRENT:
return UIIcons
.getImage(resources, UIIcons.CURRENT_STEP);
case DONE:
return UIIcons.getImage(resources, UIIcons.DONE_STEP);
default:
// fall through
}
}
return null;
}
@Override
public String getToolTipText(Object element) {
ElementType t = getType(element);
if (t != null) {
switch (t) {
case DONE:
return UIText.RebaseInteractiveView_StatusDone;
case DONE_CURRENT:
return UIText.RebaseInteractiveView_StatusCurrent;
case TODO:
return UIText.RebaseInteractiveView_StatusTodo;
default:
// fall through
}
}
return ""; //$NON-NLS-1$
}
@Override
public String getText(Object element) {
return ""; //$NON-NLS-1$
}
});
TreeViewerColumn stepColumn = createColumn(headings[1], 55);
stepColumn.setLabelProvider(new HighlightingColumnLabelProvider() {
@Override
public String getText(Object element) {
if (element instanceof PlanElement) {
PlanElement planLine = (PlanElement) element;
return (planIndexer.indexOf(planLine) + 1) + "."; //$NON-NLS-1$
}
return super.getText(element);
}
});
stepColumn.getColumn().addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
Tree tree = planTreeViewer.getTree();
boolean orderReversed = tree.getSortDirection() == SWT.DOWN;
RebaseInteractivePreferences.setOrderReversed(!orderReversed);
int newDirection = (orderReversed ? SWT.UP : SWT.DOWN);
tree.setSortDirection(newDirection);
TreeItem topmostVisibleItem = tree.getTopItem();
refreshUI();
if (topmostVisibleItem != null)
tree.showItem(topmostVisibleItem);
}
});
int direction = (RebaseInteractivePreferences.isOrderReversed() ? SWT.DOWN
: SWT.UP);
Tree planTree = planTreeViewer.getTree();
planTree.setSortColumn(stepColumn.getColumn());
planTree.setSortDirection(direction);
TreeViewerColumn actionColumn = createColumn(headings[2], 90);
actionColumn.setLabelProvider(new HighlightingColumnLabelProvider() {
@Override
public Image getImage(Object element) {
ElementAction a = getAction(element);
if (a != null) {
switch (a) {
case EDIT:
return UIIcons.getImage(resources, UIIcons.EDITCONFIG);
case FIXUP:
if (RebaseInteractivePreferences.isOrderReversed())
return UIIcons.getImage(resources,
UIIcons.FIXUP_DOWN);
else
return UIIcons.getImage(resources,
UIIcons.FIXUP_UP);
case PICK:
return UIIcons.getImage(resources, UIIcons.CHERRY_PICK);
case REWORD:
return UIIcons.getImage(resources, UIIcons.REWORD);
case SKIP:
return UIIcons.getImage(resources, UIIcons.REBASE_SKIP);
case SQUASH:
if (RebaseInteractivePreferences.isOrderReversed())
return UIIcons.getImage(resources,
UIIcons.SQUASH_DOWN);
else
return UIIcons.getImage(resources,
UIIcons.SQUASH_UP);
default:
// fall through
}
}
return super.getImage(element);
}
@Override
public String getText(Object element) {
ElementAction a = getAction(element);
return (a != null) ? a.name() : super.getText(element);
}
private ElementAction getAction(Object element) {
if (element instanceof PlanElement) {
PlanElement planLine = (PlanElement) element;
return planLine.getPlanElementAction();
} else
return null;
}
});
TreeViewerColumn commitIDColumn = createColumn(headings[3], 70);
commitIDColumn.setLabelProvider(new HighlightingColumnLabelProvider() {
@Override
public String getText(Object element) {
if (element instanceof PlanElement) {
PlanElement planLine = (PlanElement) element;
return planLine.getCommit().name();
}
return super.getText(element);
}
});
TreeViewerColumn commitMessageColumn = createColumn(headings[4], 200);
commitMessageColumn
.setLabelProvider(new HighlightingColumnLabelProvider() {
@Override
public String getText(Object element) {
if (element instanceof PlanElement) {
PlanElement planLine = (PlanElement) element;
return planLine.getShortMessage();
}
return super.getText(element);
}
});
TreeViewerColumn authorColumn = createColumn(headings[5], 120);
authorColumn.setLabelProvider(new HighlightingColumnLabelProvider() {
@Override
public String getText(Object element) {
if (element instanceof PlanElement) {
PlanElement planLine = (PlanElement) element;
return planLine.getAuthor();
}
return super.getText(element);
}
});
TreeViewerColumn authoredDateColumn = createColumn(headings[6], 80);
authoredDateColumn
.setLabelProvider(new HighlightingColumnLabelProvider() {
@Override
public String getText(Object element) {
if (element instanceof PlanElement) {
PlanElement planLine = (PlanElement) element;
return planLine.getAuthoredDate(dateFormatter);
}
return super.getText(element);
}
});
TreeViewerColumn committerColumn = createColumn(headings[7], 120);
committerColumn.setLabelProvider(new HighlightingColumnLabelProvider() {
@Override
public String getText(Object element) {
if (element instanceof PlanElement) {
PlanElement planLine = (PlanElement) element;
return planLine.getCommitter();
}
return super.getText(element);
}
});
TreeViewerColumn commitDateColumn = createColumn(headings[8], 80);
commitDateColumn
.setLabelProvider(new HighlightingColumnLabelProvider() {
@Override
public String getText(Object element) {
if (element instanceof PlanElement) {
PlanElement planLine = (PlanElement) element;