protected CommonViewer createCommonViewer(Composite aParent) {
CommonViewer viewer = super.createCommonViewer(aParent);
// handle the double-click event for tags and branches
viewer.addDoubleClickListener(new IDoubleClickListener() {
public void doubleClick(DoubleClickEvent event) {
TreeSelection sel = (TreeSelection) event.getSelection();
RepositoryTreeNode element = (RepositoryTreeNode) sel
.getFirstElement();
// Disable checkout for bare repositories
if (element.getRepository().isBare())
return;
if (element instanceof RefNode)
executeOpenCommandWithConfirmation(((RefNode) element)
.getObject().getName());
if (element instanceof TagNode)
executeOpenCommandWithConfirmation(((TagNode) element)
.getObject().getName());
}
});
// handle open event for the working directory
viewer.addOpenListener(new IOpenListener() {
public void open(OpenEvent event) {
TreeSelection sel = (TreeSelection) event.getSelection();
RepositoryTreeNode element = (RepositoryTreeNode) sel
.getFirstElement();
if (element instanceof FileNode
|| element instanceof StashedCommitNode)
executeOpenCommand();
}