Search in sources :

Example 11 with Credentials

use of org.eclipse.che.ide.api.subversion.Credentials in project che by eclipse.

the class MovePresenter method onMoveClicked.

/** {@inheritDoc} */
@Override
public void onMoveClicked() {
    final Project project = appContext.getRootProject();
    checkState(project != null);
    final Path source = getSource();
    final String comment = view.isURLSelected() ? view.getComment() : null;
    final StatusNotification notification = new StatusNotification(locale.moveNotificationStarted(source.toString()), PROGRESS, FLOAT_MODE);
    notificationManager.notify(notification);
    performOperationWithCredentialsRequestIfNeeded(new RemoteSubversionOperation<CLIOutputResponse>() {

        @Override
        public Promise<CLIOutputResponse> perform(Credentials credentials) {
            notification.setStatus(PROGRESS);
            notification.setTitle(locale.moveNotificationStarted(source.toString()));
            return service.move(project.getLocation(), source, getTarget(), comment, credentials);
        }
    }, notification).then(new Operation<CLIOutputResponse>() {

        @Override
        public void apply(CLIOutputResponse response) throws OperationException {
            notification.setTitle(locale.moveNotificationSuccessful());
            notification.setStatus(SUCCESS);
        }
    }).catchError(new Operation<PromiseError>() {

        @Override
        public void apply(PromiseError arg) throws OperationException {
            notification.setTitle(locale.moveNotificationFailed());
            notification.setStatus(FAIL);
        }
    });
    view.onClose();
}
Also used : Path(org.eclipse.che.ide.resource.Path) StatusNotification(org.eclipse.che.ide.api.notification.StatusNotification) Operation(org.eclipse.che.api.promises.client.Operation) Project(org.eclipse.che.ide.api.resources.Project) Promise(org.eclipse.che.api.promises.client.Promise) PromiseError(org.eclipse.che.api.promises.client.PromiseError) CLIOutputResponse(org.eclipse.che.plugin.svn.shared.CLIOutputResponse) Credentials(org.eclipse.che.ide.api.subversion.Credentials) OperationException(org.eclipse.che.api.promises.client.OperationException)

Aggregations

Credentials (org.eclipse.che.ide.api.subversion.Credentials)11 Operation (org.eclipse.che.api.promises.client.Operation)10 OperationException (org.eclipse.che.api.promises.client.OperationException)10 Promise (org.eclipse.che.api.promises.client.Promise)10 PromiseError (org.eclipse.che.api.promises.client.PromiseError)10 Project (org.eclipse.che.ide.api.resources.Project)10 CLIOutputResponse (org.eclipse.che.plugin.svn.shared.CLIOutputResponse)6 Resource (org.eclipse.che.ide.api.resources.Resource)4 Path (org.eclipse.che.ide.resource.Path)4 StatusNotification (org.eclipse.che.ide.api.notification.StatusNotification)3 InfoResponse (org.eclipse.che.plugin.svn.shared.InfoResponse)3 SubversionItem (org.eclipse.che.plugin.svn.shared.SubversionItem)3 ArrayList (java.util.ArrayList)1 AbstractTreeNode (org.eclipse.che.ide.api.data.tree.AbstractTreeNode)1 Node (org.eclipse.che.ide.api.data.tree.Node)1 CLIOutputWithRevisionResponse (org.eclipse.che.plugin.svn.shared.CLIOutputWithRevisionResponse)1