use of org.eclipse.che.ide.api.resources.Project in project che by eclipse.
the class LockUnlockPresenter method showDialog.
private void showDialog(final boolean lock) {
final Project project = appContext.getRootProject();
checkState(project != null);
final Resource[] resources = appContext.getResources();
checkState(!Arrays.isNullOrEmpty(resources));
final String withoutForceLabel = getWithoutForceLabel(lock);
final String withForceLabel = getWithForceLabel(lock);
final String cancelLabel = getCancelLabel(lock);
final ConfirmCallback withoutForceCallback = new ConfirmCallback() {
@Override
public void accepted() {
doAction(lock, false, toRelative(project, resources));
}
};
final ConfirmCallback withForceCallback = new ConfirmCallback() {
@Override
public void accepted() {
doAction(lock, true, toRelative(project, resources));
}
};
final ChoiceDialog dialog = this.choiceDialogFactory.createChoiceDialog(getTitle(lock), getContent(lock), withoutForceLabel, withForceLabel, cancelLabel, withoutForceCallback, withForceCallback, null);
dialog.show();
}
use of org.eclipse.che.ide.api.resources.Project 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.ide.api.resources.Project 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);
}
});
}
use of org.eclipse.che.ide.api.resources.Project in project che by eclipse.
the class CommitPresenter method doCommit.
private void doCommit(String message, Path[] paths, boolean keepLocks) {
final Project project = appContext.getRootProject();
checkState(project != null);
service.commit(project.getLocation(), paths, message, false, keepLocks).then(new Operation<CLIOutputWithRevisionResponse>() {
@Override
public void apply(CLIOutputWithRevisionResponse response) throws OperationException {
printResponse(response.getCommand(), response.getOutput(), response.getErrOutput(), constants.commandCommit());
}
}).catchError(new Operation<PromiseError>() {
@Override
public void apply(PromiseError error) throws OperationException {
final StatusNotification notification = new StatusNotification(error.getMessage(), FAIL, FLOAT_MODE);
notificationManager.notify(notification);
}
});
view.onClose();
}
use of org.eclipse.che.ide.api.resources.Project in project che by eclipse.
the class CommitPresenter method commitSelection.
private void commitSelection(String message, boolean keepLocks) {
final Project project = appContext.getRootProject();
checkState(project != null);
final Resource[] resources = appContext.getResources();
checkState(!Arrays.isNullOrEmpty(resources));
doCommit(message, toRelative(project, resources), keepLocks);
}
Aggregations