Search in sources :

Example 1 with CheckoutRequest

use of org.eclipse.che.api.git.shared.CheckoutRequest in project che by eclipse.

the class BranchPresenter method onCheckoutClicked.

/** {@inheritDoc} */
@Override
public void onCheckoutClicked() {
    final CheckoutRequest checkoutRequest = dtoFactory.createDto(CheckoutRequest.class);
    if (selectedBranch.isRemote()) {
        checkoutRequest.setTrackBranch(selectedBranch.getDisplayName());
    } else {
        checkoutRequest.setName(selectedBranch.getDisplayName());
    }
    service.checkout(appContext.getDevMachine(), project.getLocation(), checkoutRequest).then(new Operation<Void>() {

        @Override
        public void apply(Void ignored) throws OperationException {
            getBranches();
            project.synchronize();
        }
    }).catchError(new Operation<PromiseError>() {

        @Override
        public void apply(PromiseError error) throws OperationException {
            handleError(error.getCause(), BRANCH_CHECKOUT_COMMAND_NAME);
        }
    });
}
Also used : PromiseError(org.eclipse.che.api.promises.client.PromiseError) CheckoutRequest(org.eclipse.che.api.git.shared.CheckoutRequest) Operation(org.eclipse.che.api.promises.client.Operation) OperationException(org.eclipse.che.api.promises.client.OperationException)

Aggregations

CheckoutRequest (org.eclipse.che.api.git.shared.CheckoutRequest)1 Operation (org.eclipse.che.api.promises.client.Operation)1 OperationException (org.eclipse.che.api.promises.client.OperationException)1 PromiseError (org.eclipse.che.api.promises.client.PromiseError)1