use of org.eclipse.che.ide.api.component.WsAgentComponent in project che by eclipse.
the class BootstrapController method startWsAgentComponents.
private void startWsAgentComponents(final Iterator<Provider<WsAgentComponent>> componentProviderIterator) {
if (componentProviderIterator.hasNext()) {
Provider<WsAgentComponent> componentProvider = componentProviderIterator.next();
final WsAgentComponent component = componentProvider.get();
component.start(new Callback<WsAgentComponent, Exception>() {
@Override
public void onSuccess(WsAgentComponent result) {
startWsAgentComponents(componentProviderIterator);
}
@Override
public void onFailure(Exception reason) {
Log.error(component.getClass(), reason);
initializationFailed(reason.getMessage());
}
});
}
}
use of org.eclipse.che.ide.api.component.WsAgentComponent in project che by eclipse.
the class BootstrapController method startWsAgentComponents.
@Inject
private void startWsAgentComponents(EventBus eventBus, final Map<String, Provider<WsAgentComponent>> components) {
eventBus.addHandler(WorkspaceStartedEvent.TYPE, new WorkspaceStartedEvent.Handler() {
@Override
public void onWorkspaceStarted(WorkspaceStartedEvent event) {
workspaceService.getWorkspace(event.getWorkspace().getId()).then(new Operation<WorkspaceDto>() {
@Override
public void apply(WorkspaceDto ws) throws OperationException {
MachineDto devMachineDto = ws.getRuntime().getDevMachine();
DevMachine devMachine = new DevMachine(devMachineDto);
if (appContext instanceof AppContextImpl) {
((AppContextImpl) appContext).setProjectsRoot(Path.valueOf(devMachineDto.getRuntime().projectsRoot()));
}
wsAgentStateControllerProvider.get().initialize(devMachine);
wsAgentURLModifier.initialize(devMachine);
SortedMap<String, Provider<WsAgentComponent>> sortedComponents = new TreeMap<>();
sortedComponents.putAll(components);
startWsAgentComponents(sortedComponents.values().iterator());
}
}).catchError(new Operation<PromiseError>() {
@Override
public void apply(PromiseError err) throws OperationException {
Log.error(getClass(), err.getCause());
initializationFailed(err.getMessage());
}
});
}
});
}
Aggregations