Search in sources :

Example 16 with CLIOutputResponse

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

the class PropertyEditorPresenter method editProperty.

private void editProperty(Project project) {
    final String propertyName = view.getSelectedProperty();
    final Depth depth = view.getDepth();
    final String propertyValue = view.getPropertyValue();
    final boolean force = view.isForceSelected();
    final Resource[] resources = appContext.getResources();
    checkState(!Arrays.isNullOrEmpty(resources));
    checkState(resources.length == 1);
    final StatusNotification notification = new StatusNotification(constants.propertyModifyStart(), PROGRESS, FLOAT_MODE);
    notificationManager.notify(notification);
    service.propertySet(project.getLocation(), propertyName, propertyValue, 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.propertyModifyFinished());
            notification.setStatus(SUCCESS);
        }
    }).catchError(new Operation<PromiseError>() {

        @Override
        public void apply(PromiseError error) throws OperationException {
            notification.setTitle(constants.propertyModifyFailed());
            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)

Example 17 with CLIOutputResponse

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

the class SubversionApiITest method testPropDel.

/**
     * Tests for {@link SubversionApi#propdel(org.eclipse.che.plugin.svn.shared.PropertyDeleteRequest)}.
     *
     * @throws Exception
     *         if anything goes wrong
     */
@Test
public void testPropDel() throws Exception {
    this.subversionApi.checkout(DtoFactory.getInstance().createDto(CheckoutRequest.class).withProjectPath(tmpAbsolutePath).withUrl(repoUrl));
    CLIOutputResponse response = this.subversionApi.propdel(DtoFactory.getInstance().createDto(PropertyDeleteRequest.class).withProjectPath(tmpAbsolutePath).withPath("trunk/A/B").withForce(true).withDepth(Depth.DIRS_ONLY).withName("owner"));
    assertEquals(response.getOutput().size(), 1);
    assertEquals(response.getOutput().get(0), "property 'owner' deleted from 'trunk" + File.separator + "A" + File.separator + "B'.");
}
Also used : CheckoutRequest(org.eclipse.che.plugin.svn.shared.CheckoutRequest) CLIOutputResponse(org.eclipse.che.plugin.svn.shared.CLIOutputResponse) Test(org.junit.Test)

Example 18 with CLIOutputResponse

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

the class SubversionApiITest method testCopy.

/**
     * Tests for {@link SubversionApi#copy(CopyRequest)}.
     *
     * @throws Exception
     *         if anything goes wrong
     */
@Test
public void testCopy() throws Exception {
    this.subversionApi.checkout(DtoFactory.getInstance().createDto(CheckoutRequest.class).withProjectPath(tmpAbsolutePath).withUrl(repoUrl));
    CLIOutputResponse response = this.subversionApi.copy(DtoFactory.getInstance().createDto(CopyRequest.class).withProjectPath(tmpAbsolutePath).withSource("trunk/A/B/lambda").withDestination("trunk/A/B/E/lambda"));
    assertEquals(response.getOutput().size(), 1);
    assertTrue(response.getErrOutput().isEmpty());
    String expectedPath = "trunk" + File.separator + "A" + File.separator + "B" + File.separator + "E" + File.separator + "lambda";
    assertEquals(response.getOutput().get(0), "A         " + expectedPath);
}
Also used : CheckoutRequest(org.eclipse.che.plugin.svn.shared.CheckoutRequest) CLIOutputResponse(org.eclipse.che.plugin.svn.shared.CLIOutputResponse) Test(org.junit.Test)

Example 19 with CLIOutputResponse

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

the class SubversionApiITest method testMove.

/**
     * Tests for {@link SubversionApi#move(MoveRequest)}.
     *
     * @throws Exception
     *         if anything goes wrong
     */
@Test
public void testMove() throws Exception {
    this.subversionApi.checkout(DtoFactory.getInstance().createDto(CheckoutRequest.class).withProjectPath(tmpAbsolutePath).withUrl(repoUrl));
    CLIOutputResponse response = this.subversionApi.move(DtoFactory.getInstance().createDto(MoveRequest.class).withProjectPath(tmpAbsolutePath).withSource(Collections.singletonList("trunk/A/B/lambda")).withDestination("trunk/A/B/E/lambda"));
    assertEquals(response.getOutput().size(), 2);
    assertTrue(response.getErrOutput().isEmpty());
    String expectedPath1 = "trunk" + File.separator + "A" + File.separator + "B" + File.separator + "E" + File.separator + "lambda";
    assertEquals(response.getOutput().get(0), "A         " + expectedPath1);
    String expectedPath2 = "trunk" + File.separator + "A" + File.separator + "B" + File.separator + "lambda";
    assertEquals(response.getOutput().get(1), "D         " + expectedPath2);
}
Also used : CheckoutRequest(org.eclipse.che.plugin.svn.shared.CheckoutRequest) CLIOutputResponse(org.eclipse.che.plugin.svn.shared.CLIOutputResponse) Test(org.junit.Test)

Example 20 with CLIOutputResponse

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

the class SubversionApi method remove.

/**
     * Perform an "svn remove" based on the request.
     *
     * @param request
     *         the request
     * @return the response
     * @throws IOException
     *         if there is a problem executing the command
     * @throws SubversionException
     *         if there is a Subversion issue
     */
public CLIOutputResponse remove(final RemoveRequest request) throws IOException, SubversionException, UnauthorizedException {
    final File projectPath = new File(request.getProjectPath());
    final List<String> cliArgs = defaultArgs();
    // Command Name
    cliArgs.add("remove");
    final CommandLineResult result = runCommand(null, cliArgs, projectPath, request.getPaths());
    return DtoFactory.getInstance().createDto(CLIOutputResponse.class).withCommand(result.getCommandLine().toString()).withOutput(result.getStdout()).withErrOutput(result.getStderr());
}
Also used : CommandLineResult(org.eclipse.che.plugin.svn.server.upstream.CommandLineResult) CLIOutputResponse(org.eclipse.che.plugin.svn.shared.CLIOutputResponse) File(java.io.File)

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