use of org.eclipse.che.api.promises.client.OperationException in project che by eclipse.
the class AbstractDebugger method deleteAllBreakpoints.
@Override
public void deleteAllBreakpoints() {
if (!isConnected()) {
return;
}
Promise<Void> promise = service.deleteAllBreakpoints(debugSessionDto.getId());
promise.then(new Operation<Void>() {
@Override
public void apply(Void arg) throws OperationException {
for (DebuggerObserver observer : observers) {
observer.onAllBreakpointsDeleted();
}
}
}).catchError(new Operation<PromiseError>() {
@Override
public void apply(PromiseError arg) throws OperationException {
Log.error(AbstractDebugger.class, arg.getMessage());
}
});
}
use of org.eclipse.che.api.promises.client.OperationException in project che by eclipse.
the class AbstractDebugger method suspend.
@Override
public void suspend() {
if (!isConnected()) {
return;
}
SuspendActionDto suspendAction = dtoFactory.createDto(SuspendActionDto.class);
suspendAction.setType(Action.TYPE.SUSPEND);
service.suspend(debugSessionDto.getId(), suspendAction).catchError(new Operation<PromiseError>() {
@Override
public void apply(PromiseError arg) throws OperationException {
notificationManager.notify(arg.getMessage(), FAIL, FLOAT_MODE);
}
});
}
use of org.eclipse.che.api.promises.client.OperationException in project che by eclipse.
the class BasicActiveFileHandler method tryFindFileInProject.
protected void tryFindFileInProject(final Location location, final AsyncCallback<VirtualFile> callback) {
Resource resource = appContext.getResource();
if (resource == null) {
callback.onFailure(new IllegalStateException("Resource is undefined"));
return;
}
Optional<Project> project = resource.getRelatedProject();
if (!project.isPresent()) {
callback.onFailure(new IllegalStateException("Project is undefined"));
return;
}
project.get().getFile(location.getTarget()).then(new Operation<Optional<File>>() {
@Override
public void apply(Optional<File> file) throws OperationException {
if (file.isPresent()) {
openFileAndScrollToLine(file.get(), location.getLineNumber(), callback);
} else {
callback.onFailure(new IllegalArgumentException(location.getTarget() + " not found."));
}
}
}).catchError(new Operation<PromiseError>() {
@Override
public void apply(PromiseError error) throws OperationException {
callback.onFailure(new IllegalArgumentException(location.getTarget() + " not found."));
}
});
}
use of org.eclipse.che.api.promises.client.OperationException in project che by eclipse.
the class DebuggerPresenter method onExpandVariablesTree.
@Override
public void onExpandVariablesTree() {
List<? extends Variable> rootVariables = selectedVariable.getVariables();
if (rootVariables.isEmpty()) {
Debugger debugger = debuggerManager.getActiveDebugger();
if (debugger != null) {
Promise<SimpleValue> promise = debugger.getValue(selectedVariable);
promise.then(new Operation<SimpleValue>() {
@Override
public void apply(SimpleValue arg) throws OperationException {
selectedVariable.setValue(arg.getValue());
view.setVariablesIntoSelectedVariable(arg.getVariables());
view.updateSelectedVariable();
}
}).catchError(new Operation<PromiseError>() {
@Override
public void apply(PromiseError arg) throws OperationException {
notificationManager.notify(constant.failedToGetVariableValueTitle(), arg.getMessage(), FAIL, FLOAT_MODE);
}
});
}
}
}
use of org.eclipse.che.api.promises.client.OperationException in project che by eclipse.
the class AbstractDebugger method stepInto.
@Override
public void stepInto() {
if (isConnected()) {
for (DebuggerObserver observer : observers) {
observer.onPreStepInto();
}
removeCurrentLocation();
preserveDebuggerState();
StepIntoActionDto action = dtoFactory.createDto(StepIntoActionDto.class);
action.setType(Action.TYPE.STEP_INTO);
Promise<Void> promise = service.stepInto(debugSessionDto.getId(), action);
promise.catchError(new Operation<PromiseError>() {
@Override
public void apply(PromiseError arg) throws OperationException {
Log.error(AbstractDebugger.class, arg.getCause());
}
});
}
}
Aggregations