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();
}
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);
}
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);
}
});
}
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);
}
});
}
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);
}
});
}
Aggregations