Search in sources :

Example 11 with OperationException

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());
        }
    });
}
Also used : JsPromiseError(org.eclipse.che.api.promises.client.js.JsPromiseError) PromiseError(org.eclipse.che.api.promises.client.PromiseError) Operation(org.eclipse.che.api.promises.client.Operation) DebuggerObserver(org.eclipse.che.ide.debug.DebuggerObserver) OperationException(org.eclipse.che.api.promises.client.OperationException)

Example 12 with OperationException

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);
        }
    });
}
Also used : JsPromiseError(org.eclipse.che.api.promises.client.js.JsPromiseError) PromiseError(org.eclipse.che.api.promises.client.PromiseError) SuspendActionDto(org.eclipse.che.api.debug.shared.dto.action.SuspendActionDto) OperationException(org.eclipse.che.api.promises.client.OperationException)

Example 13 with OperationException

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."));
        }
    });
}
Also used : Project(org.eclipse.che.ide.api.resources.Project) Optional(com.google.common.base.Optional) PromiseError(org.eclipse.che.api.promises.client.PromiseError) Resource(org.eclipse.che.ide.api.resources.Resource) Operation(org.eclipse.che.api.promises.client.Operation) File(org.eclipse.che.ide.api.resources.File) VirtualFile(org.eclipse.che.ide.api.resources.VirtualFile) OperationException(org.eclipse.che.api.promises.client.OperationException)

Example 14 with OperationException

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);
                }
            });
        }
    }
}
Also used : Debugger(org.eclipse.che.ide.debug.Debugger) PromiseError(org.eclipse.che.api.promises.client.PromiseError) Operation(org.eclipse.che.api.promises.client.Operation) OperationException(org.eclipse.che.api.promises.client.OperationException) SimpleValue(org.eclipse.che.api.debug.shared.model.SimpleValue)

Example 15 with OperationException

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());
            }
        });
    }
}
Also used : JsPromiseError(org.eclipse.che.api.promises.client.js.JsPromiseError) PromiseError(org.eclipse.che.api.promises.client.PromiseError) DebuggerObserver(org.eclipse.che.ide.debug.DebuggerObserver) StepIntoActionDto(org.eclipse.che.api.debug.shared.dto.action.StepIntoActionDto) OperationException(org.eclipse.che.api.promises.client.OperationException)

Aggregations

OperationException (org.eclipse.che.api.promises.client.OperationException)158 PromiseError (org.eclipse.che.api.promises.client.PromiseError)123 Operation (org.eclipse.che.api.promises.client.Operation)115 Project (org.eclipse.che.ide.api.resources.Project)53 Resource (org.eclipse.che.ide.api.resources.Resource)48 StatusNotification (org.eclipse.che.ide.api.notification.StatusNotification)21 CLIOutputResponse (org.eclipse.che.plugin.svn.shared.CLIOutputResponse)21 List (java.util.List)19 Promise (org.eclipse.che.api.promises.client.Promise)17 VirtualFile (org.eclipse.che.ide.api.resources.VirtualFile)15 Path (org.eclipse.che.ide.resource.Path)15 JsPromiseError (org.eclipse.che.api.promises.client.js.JsPromiseError)14 ArrayList (java.util.ArrayList)13 GitOutputConsole (org.eclipse.che.ide.ext.git.client.outputconsole.GitOutputConsole)13 EditorPartPresenter (org.eclipse.che.ide.api.editor.EditorPartPresenter)12 DebuggerObserver (org.eclipse.che.ide.debug.DebuggerObserver)11 Optional (com.google.common.base.Optional)10 HashMap (java.util.HashMap)10 File (org.eclipse.che.ide.api.resources.File)10 Credentials (org.eclipse.che.ide.api.subversion.Credentials)10