Search in sources :

Example 1 with WorkspaceStoppedEvent

use of org.eclipse.che.ide.api.workspace.event.WorkspaceStoppedEvent in project che by eclipse.

the class MavenMessagesHandler method handleOperations.

private void handleOperations(final DtoFactory factory, final WsAgentStateController wsAgentStateController) {
    eventBus.addHandler(WsAgentStateEvent.TYPE, new WsAgentStateHandler() {

        @Override
        public void onWsAgentStarted(WsAgentStateEvent event) {
            wsAgentStateController.getMessageBus().then(new Operation<MessageBus>() {

                @Override
                public void apply(MessageBus messageBus) throws OperationException {
                    try {
                        handleMavenServerEvents(messageBus);
                        handleMavenArchetype(messageBus);
                    } catch (WebSocketException e) {
                        dependencyResolver.hide();
                        Log.error(getClass(), e);
                    }
                }
            });
        }

        @Override
        public void onWsAgentStopped(WsAgentStateEvent event) {
            dependencyResolver.hide();
        }
    });
    eventBus.addHandler(WorkspaceStoppedEvent.TYPE, new WorkspaceStoppedEvent.Handler() {

        @Override
        public void onWorkspaceStopped(WorkspaceStoppedEvent event) {
            dependencyResolver.hide();
        }
    });
}
Also used : MessageBus(org.eclipse.che.ide.websocket.MessageBus) WebSocketException(org.eclipse.che.ide.websocket.WebSocketException) WsAgentStateHandler(org.eclipse.che.ide.api.machine.events.WsAgentStateHandler) Operation(org.eclipse.che.api.promises.client.Operation) WsAgentStateEvent(org.eclipse.che.ide.api.machine.events.WsAgentStateEvent) WorkspaceStoppedEvent(org.eclipse.che.ide.api.workspace.event.WorkspaceStoppedEvent)

Aggregations

Operation (org.eclipse.che.api.promises.client.Operation)1 WsAgentStateEvent (org.eclipse.che.ide.api.machine.events.WsAgentStateEvent)1 WsAgentStateHandler (org.eclipse.che.ide.api.machine.events.WsAgentStateHandler)1 WorkspaceStoppedEvent (org.eclipse.che.ide.api.workspace.event.WorkspaceStoppedEvent)1 MessageBus (org.eclipse.che.ide.websocket.MessageBus)1 WebSocketException (org.eclipse.che.ide.websocket.WebSocketException)1