Search in sources :

Example 1 with AbstractRebaseCommandHandler

use of org.eclipse.egit.ui.internal.commands.shared.AbstractRebaseCommandHandler in project egit by eclipse.

the class AbstractRebaseHistoryCommandHandler method execute.

@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    RevCommit revCommit = AdapterUtils.adapt(getSelection(event).getFirstElement(), RevCommit.class);
    if (!(revCommit instanceof PlotCommit)) {
        return null;
    }
    PlotCommit commit = (PlotCommit) revCommit;
    final Repository repository = getRepository(event);
    if (repository == null)
        return null;
    String currentBranch = getCurrentBranch(repository);
    final Ref ref = getRef(commit, repository, currentBranch);
    String jobname = NLS.bind(UIText.RebaseCurrentRefCommand_RebasingCurrentJobName, currentBranch, ref.getName());
    AbstractRebaseCommandHandler rebaseCurrentRef = new AbstractRebaseCommandHandler(jobname, UIText.RebaseCurrentRefCommand_RebaseCanceledMessage) {

        @Override
        protected RebaseOperation createRebaseOperation(Repository repository2) throws ExecutionException {
            return AbstractRebaseHistoryCommandHandler.this.createRebaseOperation(repository2, ref);
        }
    };
    rebaseCurrentRef.execute(repository);
    return null;
}
Also used : Repository(org.eclipse.jgit.lib.Repository) ObjectIdRef(org.eclipse.jgit.lib.ObjectIdRef) Ref(org.eclipse.jgit.lib.Ref) PlotCommit(org.eclipse.jgit.revplot.PlotCommit) AbstractRebaseCommandHandler(org.eclipse.egit.ui.internal.commands.shared.AbstractRebaseCommandHandler) RevCommit(org.eclipse.jgit.revwalk.RevCommit)

Aggregations

AbstractRebaseCommandHandler (org.eclipse.egit.ui.internal.commands.shared.AbstractRebaseCommandHandler)1 ObjectIdRef (org.eclipse.jgit.lib.ObjectIdRef)1 Ref (org.eclipse.jgit.lib.Ref)1 Repository (org.eclipse.jgit.lib.Repository)1 PlotCommit (org.eclipse.jgit.revplot.PlotCommit)1 RevCommit (org.eclipse.jgit.revwalk.RevCommit)1