branchEditButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent selectionEvent) {
String txt = branchText.getText();
String refToMark = "".equals(txt) ? null : Constants.R_HEADS + txt; //$NON-NLS-1$
AbstractBranchSelectionDialog dlg = new BranchEditDialog(
checkoutGroup.getShell(), repository, refToMark);
if (dlg.open() == Window.OK) {
branchText.setText(Repository.shortenRefName(dlg
.getRefName()));
} else {
// force calling branchText's modify listeners
branchText.setText(branchText.getText());
}