use of org.eclipse.egit.ui.internal.repository.CreateBranchWizard in project egit by eclipse.
the class CreateBranchCommand method execute.
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
final RepositoryTreeNode node = getSelectedNodes(event).get(0);
if (node.getType() == RepositoryTreeNodeType.ADDITIONALREF) {
Ref ref = (Ref) node.getObject();
try (RevWalk rw = new RevWalk(node.getRepository())) {
RevCommit baseCommit = rw.parseCommit(ref.getLeaf().getObjectId());
WizardDialog dlg = new WizardDialog(getShell(event), new CreateBranchWizard(node.getRepository(), baseCommit.name()));
dlg.setHelpAvailable(false);
dlg.open();
} catch (IOException e) {
Activator.handleError(e.getMessage(), e, true);
}
return null;
}
String base = null;
if (node.getObject() instanceof Ref)
base = ((Ref) node.getObject()).getName();
new WizardDialog(getShell(event), new CreateBranchWizard(node.getRepository(), base)).open();
return null;
}
Aggregations