use of org.eclipse.che.plugin.svn.shared.CLIOutputResponse in project che by eclipse.
the class ShowLogPresenter method showLogs.
/**
* Fetches and displays commit log messages for specified range.
*
* @param range
* range to be logged
*/
private void showLogs(String range) {
final Project project = appContext.getRootProject();
checkState(project != null);
final Resource[] resources = appContext.getResources();
checkState(!Arrays.isNullOrEmpty(resources));
service.showLog(project.getLocation(), toRelative(project, resources), range).then(new Operation<CLIOutputResponse>() {
@Override
public void apply(CLIOutputResponse response) throws OperationException {
printResponse(response.getCommand(), response.getOutput(), null, constants.commandLog());
}
}).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 MergePresenter method mergeClicked.
/**
* Performs actions when clicking Merge button.
*/
@Override
public void mergeClicked() {
view.hide();
final Project project = appContext.getRootProject();
checkState(project != null);
final Resource[] resources = appContext.getResources();
checkState(resources != null && resources.length == 1);
service.merge(project.getLocation(), resources[0].getLocation(), Path.valueOf(sourceURL)).then(new Operation<CLIOutputResponse>() {
@Override
public void apply(CLIOutputResponse response) throws OperationException {
printResponse(response.getCommand(), response.getOutput(), null, constants.commandMerge());
}
}).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 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();
}
use of org.eclipse.che.plugin.svn.shared.CLIOutputResponse in project che by eclipse.
the class PropertyEditorPresenter method obtainExistingPropertiesForPath.
@Override
public void obtainExistingPropertiesForPath() {
final Project project = appContext.getRootProject();
checkState(project != null);
final Resource[] resources = appContext.getResources();
checkState(!Arrays.isNullOrEmpty(resources));
checkState(resources.length == 1);
service.propertyList(project.getLocation(), toRelative(project, resources[0])).then(new Operation<CLIOutputResponse>() {
@Override
public void apply(CLIOutputResponse response) throws OperationException {
List<String> properties = new ArrayList<String>();
for (String property : response.getOutput()) {
properties.add(property.trim());
}
view.setExistingPropertiesForPath(properties);
}
}).catchError(new Operation<PromiseError>() {
@Override
public void apply(PromiseError error) throws OperationException {
notificationManager.notify(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 list.
@Override
public Promise<CLIOutputResponse> list(Path project, String target, @Nullable Credentials credentials) {
ListRequest request = dtoFactory.createDto(ListRequest.class).withProjectPath(project.toString()).withTargetPath(target);
if (credentials != null) {
request.setUsername(credentials.getUsername());
request.setPassword(credentials.getPassword());
}
return asyncRequestFactory.createPostRequest(getBaseUrl() + "/list", request).loader(loader).send(dtoUnmarshallerFactory.newUnmarshaller(CLIOutputResponse.class));
}
Aggregations