use of org.eclipse.che.ide.websocket.WebSocketException in project che by eclipse.
the class NavigateToFilePresenter method onFileNameChanged.
@Override
public void onFileNameChanged(String fileName) {
if (fileName.isEmpty()) {
view.showItems(new ArrayList<ItemReference>());
return;
}
// add '*' to allow search files by first letters
final String url = SEARCH_URL + "/?name=" + URL.encodePathSegment(fileName + "*");
final Message message = new MessageBuilder(GET, url).header(ACCEPT, APPLICATION_JSON).build();
final Unmarshallable<List<ItemReference>> unmarshaller = dtoUnmarshallerFactory.newWSListUnmarshaller(ItemReference.class);
try {
wsMessageBus.send(message, new RequestCallback<List<ItemReference>>(unmarshaller) {
@Override
protected void onSuccess(List<ItemReference> result) {
view.showItems(result);
}
@Override
protected void onFailure(Throwable exception) {
Log.error(getClass(), exception);
}
});
} catch (WebSocketException e) {
Log.error(getClass(), e);
}
}
use of org.eclipse.che.ide.websocket.WebSocketException in project che by eclipse.
the class ResolvingMavenProjectStateHolder method onWsAgentStarted.
@Override
public void onWsAgentStarted(WsAgentStateEvent event) {
wsAgentStateController.getMessageBus().then(new Operation<MessageBus>() {
@Override
public void apply(MessageBus messageBus) throws OperationException {
try {
messageBus.subscribe(MAVEN_CHANEL_NAME, new MessageHandler() {
@Override
public void onMessage(String message) {
Jso jso = Jso.deserialize(message);
int type = jso.getFieldCastedToInteger("$type");
MessageType messageType = MessageType.valueOf(type);
if (messageType == START_STOP) {
handleStartStop(factory.createDtoFromJson(message, StartStopNotification.class));
}
}
});
} catch (WebSocketException e) {
Log.error(getClass(), e);
}
}
});
}
Aggregations