Search in sources :

Example 6 with Message

use of org.eclipse.che.ide.websocket.Message in project che by eclipse.

the class GitServiceClientImpl method init.

@Override
public void init(DevMachine devMachine, ProjectConfigDto project, boolean bare, final RequestCallback<Void> callback) throws WebSocketException {
    String url = INIT + "?projectPath=" + project.getPath() + "&bare=" + bare;
    Message message = new MessageBuilder(POST, url).header(ACCEPT, TEXT_PLAIN).build();
    sendMessageToWS(message, callback);
}
Also used : Message(org.eclipse.che.ide.websocket.Message) MessageBuilder(org.eclipse.che.ide.websocket.MessageBuilder)

Example 7 with Message

use of org.eclipse.che.ide.websocket.Message 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);
    }
}
Also used : ItemReference(org.eclipse.che.api.project.shared.dto.ItemReference) Message(org.eclipse.che.ide.websocket.Message) MessageBuilder(org.eclipse.che.ide.websocket.MessageBuilder) WebSocketException(org.eclipse.che.ide.websocket.WebSocketException) ArrayList(java.util.ArrayList) List(java.util.List)

Aggregations

Message (org.eclipse.che.ide.websocket.Message)7 MessageBuilder (org.eclipse.che.ide.websocket.MessageBuilder)7 List (java.util.List)2 ItemReference (org.eclipse.che.api.project.shared.dto.ItemReference)2 WebSocketException (org.eclipse.che.ide.websocket.WebSocketException)2 Strings.isNullOrEmpty (com.google.common.base.Strings.isNullOrEmpty)1 DELETE (com.google.gwt.http.client.RequestBuilder.DELETE)1 POST (com.google.gwt.http.client.RequestBuilder.POST)1 PUT (com.google.gwt.http.client.RequestBuilder.PUT)1 URL (com.google.gwt.http.client.URL)1 Inject (com.google.inject.Inject)1 ArrayList (java.util.ArrayList)1 Map (java.util.Map)1 AddRequest (org.eclipse.che.api.git.shared.AddRequest)1 CloneRequest (org.eclipse.che.api.git.shared.CloneRequest)1 FetchRequest (org.eclipse.che.api.git.shared.FetchRequest)1 RemoteAddRequest (org.eclipse.che.api.git.shared.RemoteAddRequest)1 CopyOptions (org.eclipse.che.api.project.shared.dto.CopyOptions)1 MoveOptions (org.eclipse.che.api.project.shared.dto.MoveOptions)1 SourceEstimation (org.eclipse.che.api.project.shared.dto.SourceEstimation)1