Search in sources :

Example 1 with DefaultWorkspaceComponent

use of org.eclipse.che.ide.workspace.DefaultWorkspaceComponent in project che by eclipse.

the class CreateWorkspacePresenter method createWorkspace.

private void createWorkspace() {
    WorkspaceConfigDto workspaceConfig = getWorkspaceConfig();
    workspaceClient.create(workspaceConfig, null).then(new Operation<WorkspaceDto>() {

        @Override
        public void apply(WorkspaceDto workspace) throws OperationException {
            DefaultWorkspaceComponent component = wsComponentProvider.get();
            component.startWorkspace(workspace, callback);
        }
    }).catchError(new Operation<PromiseError>() {

        @Override
        public void apply(PromiseError arg) throws OperationException {
            callback.onFailure(new Exception(arg.getCause()));
        }
    });
}
Also used : DefaultWorkspaceComponent(org.eclipse.che.ide.workspace.DefaultWorkspaceComponent) PromiseError(org.eclipse.che.api.promises.client.PromiseError) WorkspaceConfigDto(org.eclipse.che.api.workspace.shared.dto.WorkspaceConfigDto) WorkspaceDto(org.eclipse.che.api.workspace.shared.dto.WorkspaceDto) Operation(org.eclipse.che.api.promises.client.Operation) OperationException(org.eclipse.che.api.promises.client.OperationException) OperationException(org.eclipse.che.api.promises.client.OperationException)

Example 2 with DefaultWorkspaceComponent

use of org.eclipse.che.ide.workspace.DefaultWorkspaceComponent in project che by eclipse.

the class StartWorkspacePresenter method onWorkspaceSelected.

/** {@inheritDoc} */
@Override
public void onWorkspaceSelected(WorkspaceDto workspace) {
    selectedWorkspace = workspace;
    String wsName = workspace.getConfig().getDefaultEnv();
    view.setWsName(wsName);
    view.setEnableStartButton(!wsName.isEmpty());
    if (RUNNING.equals(workspace.getStatus())) {
        DefaultWorkspaceComponent workspaceComponent = wsComponentProvider.get();
        workspaceComponent.setCurrentWorkspace(workspace);
        workspaceComponent.startWorkspace(workspace, callback);
        view.hide();
    }
}
Also used : DefaultWorkspaceComponent(org.eclipse.che.ide.workspace.DefaultWorkspaceComponent)

Example 3 with DefaultWorkspaceComponent

use of org.eclipse.che.ide.workspace.DefaultWorkspaceComponent in project che by eclipse.

the class StartWorkspacePresenter method onStartWorkspaceClicked.

/** {@inheritDoc} */
@Override
public void onStartWorkspaceClicked() {
    DefaultWorkspaceComponent workspaceComponent = wsComponentProvider.get();
    workspaceComponent.startWorkspace(selectedWorkspace, callback);
    view.hide();
}
Also used : DefaultWorkspaceComponent(org.eclipse.che.ide.workspace.DefaultWorkspaceComponent)

Aggregations

DefaultWorkspaceComponent (org.eclipse.che.ide.workspace.DefaultWorkspaceComponent)3 Operation (org.eclipse.che.api.promises.client.Operation)1 OperationException (org.eclipse.che.api.promises.client.OperationException)1 PromiseError (org.eclipse.che.api.promises.client.PromiseError)1 WorkspaceConfigDto (org.eclipse.che.api.workspace.shared.dto.WorkspaceConfigDto)1 WorkspaceDto (org.eclipse.che.api.workspace.shared.dto.WorkspaceDto)1