use of org.eclipse.egit.ui.internal.branch.BranchOperationUI in project egit by eclipse.
the class CheckoutCommand method execute.
@Override
public Object execute(final ExecutionEvent event) throws ExecutionException {
final RepositoryTreeNode node = getSelectedNodes(event).get(0);
if (!(node.getObject() instanceof Ref))
return null;
final Ref ref = (Ref) node.getObject();
Repository repo = node.getRepository();
BranchOperationUI op = BranchOperationUI.checkout(repo, ref.getName());
op.start();
return null;
}
use of org.eclipse.egit.ui.internal.branch.BranchOperationUI in project egit by eclipse.
the class CheckoutHandler method execute.
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
Repository repo = getRepository(event);
RevCommit commit = getSelectedCommit(event, repo);
if (commit != null) {
final BranchOperationUI op = BranchOperationUI.checkout(repo, commit.name());
if (op != null)
op.start();
}
return null;
}
use of org.eclipse.egit.ui.internal.branch.BranchOperationUI in project egit by eclipse.
the class CheckoutCommitHandler method execute.
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
ObjectId commitId = getSelectedCommitId(event);
Repository repo = getRepository(event);
final BranchOperationUI op;
List<Ref> nodes;
try {
nodes = getBranchesOfCommit(getSelection(event), repo, true);
} catch (IOException e) {
throw new ExecutionException(UIText.AbstractHistoryCommitHandler_cantGetBranches, e);
}
if (nodes.isEmpty()) {
op = BranchOperationUI.checkout(repo, commitId.name());
} else if (nodes.size() == 1) {
op = BranchOperationUI.checkout(repo, nodes.get(0).getName());
} else {
BranchSelectionDialog<Ref> dlg = new BranchSelectionDialog<>(HandlerUtil.getActiveShellChecked(event), nodes, UIText.CheckoutHandler_SelectBranchTitle, UIText.CheckoutHandler_SelectBranchMessage, SWT.SINGLE);
if (dlg.open() == Window.OK) {
op = BranchOperationUI.checkout(repo, dlg.getSelectedNode().getName());
} else {
op = null;
}
}
if (op == null)
return null;
op.start();
return null;
}
Aggregations