use of org.eclipse.che.plugin.svn.shared.CLIOutputResponse in project che by eclipse.
the class SubversionApi method add.
/**
* Perform an "svn add" 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 add(final AddRequest request) throws IOException, SubversionException, UnauthorizedException {
final File projectPath = new File(request.getProjectPath());
final List<String> args = defaultArgs();
// Flags
addFlag(args, "--no-ignore", request.isAddIgnored());
addFlag(args, "--parents", request.isAddParents());
if (request.isAutoProps()) {
args.add("--auto-props");
}
if (request.isNotAutoProps()) {
args.add("--no-auto-props");
}
// Options
addOption(args, "--depth", request.getDepth());
// Command Name
args.add("add");
// Command Arguments
final CommandLineResult result = runCommand(null, args, projectPath, request.getPaths());
return DtoFactory.getInstance().createDto(CLIOutputResponse.class).withCommand(result.getCommandLine().toString()).withOutput(result.getStdout()).withErrOutput(result.getStderr());
}
use of org.eclipse.che.plugin.svn.shared.CLIOutputResponse in project che by eclipse.
the class CopyPresenter method onCopyClicked.
/** {@inheritDoc} */
@Override
public void onCopyClicked() {
final Project project = appContext.getRootProject();
Preconditions.checkState(project != null);
final Path src = view.isSourceCheckBoxSelected() ? Path.valueOf(view.getSourcePath()) : toRelative(project, sourceNode);
final Path target = view.isTargetCheckBoxSelected() ? Path.valueOf(view.getTargetUrl()) : toRelative(project, this.target);
final String comment = view.isTargetCheckBoxSelected() ? view.getComment() : null;
final StatusNotification notification = new StatusNotification(constants.copyNotificationStarted(src.toString()), PROGRESS, FLOAT_MODE);
notificationManager.notify(notification);
view.hide();
performOperationWithCredentialsRequestIfNeeded(new RemoteSubversionOperation<CLIOutputResponse>() {
@Override
public Promise<CLIOutputResponse> perform(Credentials credentials) {
notification.setStatus(PROGRESS);
notification.setTitle(constants.copyNotificationStarted(src.toString()));
return service.copy(project.getLocation(), src, target, comment, credentials);
}
}, notification).then(new Operation<CLIOutputResponse>() {
@Override
public void apply(CLIOutputResponse response) throws OperationException {
printResponse(response.getCommand(), response.getOutput(), response.getErrOutput(), constants.commandCopy());
notification.setTitle(constants.copyNotificationSuccessful());
notification.setStatus(SUCCESS);
}
}).catchError(new Operation<PromiseError>() {
@Override
public void apply(PromiseError error) throws OperationException {
notification.setTitle(constants.copyNotificationFailed());
notification.setStatus(FAIL);
}
});
}
use of org.eclipse.che.plugin.svn.shared.CLIOutputResponse in project che by eclipse.
the class LockUnlockPresenter method doLockAction.
private void doLockAction(final boolean force, final Path[] paths) {
final Project project = appContext.getRootProject();
checkState(project != null);
performOperationWithCredentialsRequestIfNeeded(new RemoteSubversionOperation<CLIOutputResponse>() {
@Override
public Promise<CLIOutputResponse> perform(Credentials credentials) {
return service.lock(project.getLocation(), paths, force, credentials);
}
}, null).then(new Operation<CLIOutputResponse>() {
@Override
public void apply(CLIOutputResponse response) throws OperationException {
printResponse(response.getCommand(), response.getOutput(), response.getErrOutput(), constants.commandLock());
}
}).catchError(new Operation<PromiseError>() {
@Override
public void apply(PromiseError error) throws OperationException {
notificationManager.notify(error.getMessage(), FAIL, FLOAT_MODE);
}
});
}
use of org.eclipse.che.plugin.svn.shared.CLIOutputResponse in project che by eclipse.
the class SubversionClientServiceImpl method listTags.
@Override
public Promise<CLIOutputResponse> listTags(Path project, @Nullable Credentials credentials) {
ListRequest request = dtoFactory.createDto(ListRequest.class).withProjectPath(project.toString());
if (credentials != null) {
request.setUsername(credentials.getUsername());
request.setPassword(credentials.getPassword());
}
return asyncRequestFactory.createPostRequest(getBaseUrl() + "/tags", request).loader(loader).send(dtoUnmarshallerFactory.newUnmarshaller(CLIOutputResponse.class));
}
use of org.eclipse.che.plugin.svn.shared.CLIOutputResponse in project che by eclipse.
the class AddPresenter method showAdd.
public void showAdd() {
final Project project = appContext.getRootProject();
checkState(project != null);
final Resource[] resources = appContext.getResources();
checkState(!Arrays.isNullOrEmpty(resources));
final StatusNotification notification = new StatusNotification(constants.addStarted(resources.length), PROGRESS, FLOAT_MODE);
notificationManager.notify(notification);
service.add(project.getLocation(), toRelative(project, resources), null, false, true, false, false).then(new Operation<CLIOutputResponse>() {
@Override
public void apply(CLIOutputResponse response) throws OperationException {
printResponse(response.getCommand(), response.getOutput(), response.getErrOutput(), constants.commandAdd());
if (response.getErrOutput() == null || response.getErrOutput().size() == 0) {
notification.setTitle(constants.addSuccessful());
notification.setStatus(SUCCESS);
} else {
notification.setTitle(constants.addWarning());
notification.setStatus(FAIL);
}
}
}).catchError(new Operation<PromiseError>() {
@Override
public void apply(PromiseError error) throws OperationException {
notification.setTitle(constants.addFailed() + ": " + error.getMessage());
notification.setStatus(FAIL);
}
});
}
Aggregations