use of org.eclipse.che.plugin.svn.shared.CLIOutputResponse in project che by eclipse.
the class CleanupPresenter method cleanup.
public void cleanup() {
final Project project = appContext.getRootProject();
checkState(project != null);
final Resource[] resources = appContext.getResources();
checkState(!Arrays.isNullOrEmpty(resources));
service.cleanup(project.getLocation(), toRelative(project, resources)).then(new Operation<CLIOutputResponse>() {
@Override
public void apply(CLIOutputResponse result) throws OperationException {
printResponse(result.getCommand(), result.getOutput(), result.getErrOutput(), constants.commandCleanup());
notificationManager.notify(constants.cleanupSuccessful());
}
}).catchError(new Operation<PromiseError>() {
@Override
public void apply(PromiseError error) throws OperationException {
notificationManager.notify(constants.cleanupFailed() + ": " + error.getMessage(), FAIL, FLOAT_MODE);
}
});
}
use of org.eclipse.che.plugin.svn.shared.CLIOutputResponse in project che by eclipse.
the class CommitPresenter method loadAllChanges.
private void loadAllChanges() {
final Project project = appContext.getRootProject();
checkState(project != null);
service.status(project.getLocation(), new Path[0], null, false, false, false, true, false, null).then(new Operation<CLIOutputResponse>() {
@Override
public void apply(CLIOutputResponse response) throws OperationException {
List<StatusItem> statusItems = parseChangesList(response);
view.setChangesList(statusItems);
view.onShow();
cache.put(Changes.ALL, statusItems);
}
}).catchError(new Operation<PromiseError>() {
@Override
public void apply(PromiseError error) throws OperationException {
Log.error(CommitPresenter.class, error.getMessage());
}
});
}
use of org.eclipse.che.plugin.svn.shared.CLIOutputResponse in project che by eclipse.
the class CommitPresenter method showDiff.
/** {@inheritDoc} */
@Override
public void showDiff(final String path) {
final Project project = appContext.getRootProject();
checkState(project != null);
performOperationWithCredentialsRequestIfNeeded(new RemoteSubversionOperation<CLIOutputResponse>() {
@Override
public Promise<CLIOutputResponse> perform(Credentials credentials) {
return service.showDiff(project.getLocation(), new Path[] { valueOf(path) }, "HEAD", credentials);
}
}, null).then(new Operation<CLIOutputResponse>() {
@Override
public void apply(CLIOutputResponse response) throws OperationException {
String content = Joiner.on('\n').join(response.getOutput());
diffViewerPresenter.showDiff(content);
}
}).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 SubversionApi method revert.
/**
* Perform an "svn revert" 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 revert(RevertRequest request) throws IOException, SubversionException, UnauthorizedException {
final File projectPath = new File(request.getProjectPath());
final List<String> cliArgs = defaultArgs();
addOption(cliArgs, "--depth", request.getDepth());
cliArgs.add("revert");
final CommandLineResult result = runCommand(null, cliArgs, projectPath, addWorkingCopyPathIfNecessary(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 RemovePresenter method showRemove.
public void showRemove() {
final Project project = appContext.getRootProject();
checkState(project != null);
final Resource[] resources = appContext.getResources();
checkState(!Arrays.isNullOrEmpty(resources));
final StatusNotification notification = new StatusNotification(constants.removeStarted(resources.length), PROGRESS, FLOAT_MODE);
notificationManager.notify(notification);
service.remove(project.getLocation(), toRelative(project, resources)).then(new Operation<CLIOutputResponse>() {
@Override
public void apply(CLIOutputResponse response) throws OperationException {
printResponse(response.getCommand(), response.getOutput(), response.getErrOutput(), constants.commandRemove());
notification.setTitle(constants.removeSuccessful());
notification.setStatus(SUCCESS);
}
}).catchError(new Operation<PromiseError>() {
@Override
public void apply(PromiseError arg) throws OperationException {
notification.setTitle(constants.removeFailed());
notification.setStatus(FAIL);
}
});
}
Aggregations