Search in sources :

Example 11 with CLIOutputResponse

use of org.eclipse.che.plugin.svn.shared.CLIOutputResponse in project che by eclipse.

the class ResolvePresenter method onResolveClicked.

@Override
public void onResolveClicked() {
    final Project project = appContext.getRootProject();
    checkState(project != null);
    HashMap<String, String> filesConflictResolutionActions = new HashMap<String, String>();
    Iterator<String> iterConflicts = conflictsList.iterator();
    while (iterConflicts.hasNext()) {
        String path = iterConflicts.next();
        String resolutionActionText = view.getConflictResolutionAction(path);
        if (!resolutionActionText.equals(ConflictResolutionAction.POSTPONE.getText())) {
            filesConflictResolutionActions.put(path, resolutionActionText);
            iterConflicts.remove();
        }
    }
    if (filesConflictResolutionActions.size() > 0) {
        service.resolve(project.getLocation(), filesConflictResolutionActions, "infinity").then(new Operation<CLIOutputResponseList>() {

            @Override
            public void apply(CLIOutputResponseList response) throws OperationException {
                for (CLIOutputResponse outputResponse : response.getCLIOutputResponses()) {
                    printResponse(outputResponse.getCommand(), outputResponse.getOutput(), null, constants.commandResolve());
                }
            }
        }).catchError(new Operation<PromiseError>() {

            @Override
            public void apply(PromiseError error) throws OperationException {
                notificationManager.notify(error.getMessage(), FAIL, FLOAT_MODE);
            }
        });
    }
    view.close();
}
Also used : Project(org.eclipse.che.ide.api.resources.Project) CLIOutputResponseList(org.eclipse.che.plugin.svn.shared.CLIOutputResponseList) PromiseError(org.eclipse.che.api.promises.client.PromiseError) HashMap(java.util.HashMap) Operation(org.eclipse.che.api.promises.client.Operation) CLIOutputResponse(org.eclipse.che.plugin.svn.shared.CLIOutputResponse) OperationException(org.eclipse.che.api.promises.client.OperationException)

Example 12 with CLIOutputResponse

use of org.eclipse.che.plugin.svn.shared.CLIOutputResponse in project che by eclipse.

the class RevertPresenter method createConfirmDialog.

private ConfirmDialog createConfirmDialog(final Project project, final Resource[] resources) {
    final ConfirmCallback okCallback = new ConfirmCallback() {

        @Override
        public void accepted() {
            final StatusNotification notification = new StatusNotification(constants.revertStarted(), PROGRESS, FLOAT_MODE);
            notificationManager.notify(notification);
            service.revert(project.getLocation(), toRelative(project, resources), "infinity").then(new Operation<CLIOutputResponse>() {

                @Override
                public void apply(CLIOutputResponse response) throws OperationException {
                    List<String> errOutput = response.getErrOutput();
                    printResponse(response.getCommand(), response.getOutput(), errOutput, "svn revert");
                    if (errOutput == null || errOutput.size() == 0) {
                        notification.setTitle(constants.revertSuccessful());
                        notification.setStatus(SUCCESS);
                    } else {
                        notification.setTitle(constants.revertWarning());
                        notification.setStatus(SUCCESS);
                    }
                }
            }).catchError(new Operation<PromiseError>() {

                @Override
                public void apply(PromiseError error) throws OperationException {
                    notification.setTitle(constants.revertFailed());
                    notification.setStatus(FAIL);
                }
            });
        }
    };
    final CancelCallback cancelCallback = new CancelCallback() {

        @Override
        public void cancelled() {
        }
    };
    String pathsString = null;
    for (Resource resource : resources) {
        if (pathsString == null) {
            pathsString = resource.getLocation().toString();
        } else {
            pathsString += ", " + resource.getLocation().toString();
        }
    }
    String confirmText = resources.length > 0 ? constants.revertConfirmText(" to " + pathsString) : constants.revertConfirmText("");
    return dialogFactory.createConfirmDialog(constants.revertTitle(), confirmText, okCallback, cancelCallback);
}
Also used : ConfirmCallback(org.eclipse.che.ide.api.dialogs.ConfirmCallback) PromiseError(org.eclipse.che.api.promises.client.PromiseError) StatusNotification(org.eclipse.che.ide.api.notification.StatusNotification) Resource(org.eclipse.che.ide.api.resources.Resource) CancelCallback(org.eclipse.che.ide.api.dialogs.CancelCallback) Operation(org.eclipse.che.api.promises.client.Operation) CLIOutputResponse(org.eclipse.che.plugin.svn.shared.CLIOutputResponse) OperationException(org.eclipse.che.api.promises.client.OperationException)

Example 13 with CLIOutputResponse

use of org.eclipse.che.plugin.svn.shared.CLIOutputResponse in project che by eclipse.

the class StatusPresenter method showStatus.

public void showStatus() {
    final Project project = appContext.getRootProject();
    checkState(project != null);
    final Resource[] resources = appContext.getResources();
    checkState(!Arrays.isNullOrEmpty(resources));
    service.status(project.getLocation(), toRelative(project, resources), null, false, false, false, true, false, null).then(new Operation<CLIOutputResponse>() {

        @Override
        public void apply(CLIOutputResponse response) throws OperationException {
            printResponse(response.getCommand(), response.getOutput(), response.getErrOutput(), constants.commandStatus());
        }
    }).catchError(new Operation<PromiseError>() {

        @Override
        public void apply(PromiseError error) throws OperationException {
            notificationManager.notify(constants.statusFailed(), FAIL, FLOAT_MODE);
        }
    });
}
Also used : Project(org.eclipse.che.ide.api.resources.Project) PromiseError(org.eclipse.che.api.promises.client.PromiseError) Resource(org.eclipse.che.ide.api.resources.Resource) Operation(org.eclipse.che.api.promises.client.Operation) CLIOutputResponse(org.eclipse.che.plugin.svn.shared.CLIOutputResponse) OperationException(org.eclipse.che.api.promises.client.OperationException)

Example 14 with CLIOutputResponse

use of org.eclipse.che.plugin.svn.shared.CLIOutputResponse in project che by eclipse.

the class PropertyEditorPresenter method onPropertyNameChanged.

@Override
public void onPropertyNameChanged(String propertyName) {
    final Project project = appContext.getRootProject();
    checkState(project != null);
    final Resource[] resources = appContext.getResources();
    checkState(!Arrays.isNullOrEmpty(resources));
    checkState(resources.length == 1);
    service.propertyGet(project.getLocation(), propertyName, toRelative(project, resources[0])).then(new Operation<CLIOutputResponse>() {

        @Override
        public void apply(CLIOutputResponse response) throws OperationException {
            view.setPropertyCurrentValue(response.getOutput());
        }
    }).catchError(new Operation<PromiseError>() {

        @Override
        public void apply(PromiseError error) throws OperationException {
            notificationManager.notify(error.getMessage(), FAIL, FLOAT_MODE);
        }
    });
}
Also used : Project(org.eclipse.che.ide.api.resources.Project) PromiseError(org.eclipse.che.api.promises.client.PromiseError) Resource(org.eclipse.che.ide.api.resources.Resource) Operation(org.eclipse.che.api.promises.client.Operation) CLIOutputResponse(org.eclipse.che.plugin.svn.shared.CLIOutputResponse) OperationException(org.eclipse.che.api.promises.client.OperationException)

Example 15 with CLIOutputResponse

use of org.eclipse.che.plugin.svn.shared.CLIOutputResponse in project che by eclipse.

the class PropertyEditorPresenter method deleteProperty.

private void deleteProperty(Project project) {
    final String propertyName = view.getSelectedProperty();
    final Depth depth = view.getDepth();
    final boolean force = view.isForceSelected();
    final Resource[] resources = appContext.getResources();
    checkState(!Arrays.isNullOrEmpty(resources));
    checkState(resources.length == 1);
    final StatusNotification notification = new StatusNotification(constants.propertyRemoveStart(), PROGRESS, FLOAT_MODE);
    notificationManager.notify(notification);
    service.propertyDelete(project.getLocation(), propertyName, depth, force, toRelative(project, resources[0])).then(new Operation<CLIOutputResponse>() {

        @Override
        public void apply(CLIOutputResponse response) throws OperationException {
            printResponse(response.getCommand(), response.getOutput(), response.getErrOutput(), constants.commandProperty());
            notification.setTitle(constants.propertyRemoveFinished());
            notification.setStatus(SUCCESS);
        }
    }).catchError(new Operation<PromiseError>() {

        @Override
        public void apply(PromiseError error) throws OperationException {
            notification.setTitle(constants.propertyRemoveFailed());
            notification.setStatus(FAIL);
        }
    });
}
Also used : PromiseError(org.eclipse.che.api.promises.client.PromiseError) Resource(org.eclipse.che.ide.api.resources.Resource) StatusNotification(org.eclipse.che.ide.api.notification.StatusNotification) Operation(org.eclipse.che.api.promises.client.Operation) CLIOutputResponse(org.eclipse.che.plugin.svn.shared.CLIOutputResponse) Depth(org.eclipse.che.plugin.svn.shared.Depth) OperationException(org.eclipse.che.api.promises.client.OperationException)

Aggregations

CLIOutputResponse (org.eclipse.che.plugin.svn.shared.CLIOutputResponse)49 Operation (org.eclipse.che.api.promises.client.Operation)21 OperationException (org.eclipse.che.api.promises.client.OperationException)21 PromiseError (org.eclipse.che.api.promises.client.PromiseError)21 Project (org.eclipse.che.ide.api.resources.Project)18 File (java.io.File)14 Resource (org.eclipse.che.ide.api.resources.Resource)14 CommandLineResult (org.eclipse.che.plugin.svn.server.upstream.CommandLineResult)14 StatusNotification (org.eclipse.che.ide.api.notification.StatusNotification)7 Promise (org.eclipse.che.api.promises.client.Promise)6 Credentials (org.eclipse.che.ide.api.subversion.Credentials)6 ArrayList (java.util.ArrayList)5 CheckoutRequest (org.eclipse.che.plugin.svn.shared.CheckoutRequest)5 Test (org.junit.Test)4 Path (org.eclipse.che.ide.resource.Path)3 ListRequest (org.eclipse.che.plugin.svn.shared.ListRequest)3 PropertyListRequest (org.eclipse.che.plugin.svn.shared.PropertyListRequest)3 CLIOutputResponseList (org.eclipse.che.plugin.svn.shared.CLIOutputResponseList)2 Depth (org.eclipse.che.plugin.svn.shared.Depth)2 LockRequest (org.eclipse.che.plugin.svn.shared.LockRequest)2