Search in sources :

Example 16 with JSONString

use of com.google.gwt.json.client.JSONString in project rstudio by rstudio.

the class RemoteServer method renameFile.

public void renameFile(FileSystemItem file, FileSystemItem targetFile, ServerRequestCallback<Void> requestCallback) {
    JSONArray paramArray = new JSONArray();
    paramArray.set(0, new JSONString(file.getPath()));
    paramArray.set(1, new JSONString(targetFile.getPath()));
    sendRequest(RPC_SCOPE, RENAME_FILE, paramArray, requestCallback);
}
Also used : JSONArray(com.google.gwt.json.client.JSONArray) JSONString(com.google.gwt.json.client.JSONString)

Example 17 with JSONString

use of com.google.gwt.json.client.JSONString in project rstudio by rstudio.

the class RemoteServer method readJSON.

public void readJSON(String path, boolean logErrorIfNotFound, ServerRequestCallback<JavaScriptObject> requestCallback) {
    JSONArray params = new JSONArray();
    params.set(0, new JSONString(path));
    params.set(1, JSONBoolean.getInstance(logErrorIfNotFound));
    sendRequest(RPC_SCOPE, "read_json", params, requestCallback);
}
Also used : JSONArray(com.google.gwt.json.client.JSONArray) JSONString(com.google.gwt.json.client.JSONString)

Example 18 with JSONString

use of com.google.gwt.json.client.JSONString in project rstudio by rstudio.

the class RemoteServer method svnApplyPatch.

@Override
public void svnApplyPatch(String path, String patch, String sourceEncoding, ServerRequestCallback<Void> requestCallback) {
    JSONArray params = new JSONArray();
    params.set(0, new JSONString(path));
    params.set(1, new JSONString(patch));
    params.set(2, new JSONString(sourceEncoding));
    sendRequest(RPC_SCOPE, SVN_APPLY_PATCH, params, requestCallback);
}
Also used : JSONArray(com.google.gwt.json.client.JSONArray) JSONString(com.google.gwt.json.client.JSONString)

Example 19 with JSONString

use of com.google.gwt.json.client.JSONString in project rstudio by rstudio.

the class RemoteServer method gitCreateBranch.

@Override
public void gitCreateBranch(String branch, ServerRequestCallback<ConsoleProcess> requestCallback) {
    JSONArray params = new JSONArray();
    params.set(0, new JSONString(branch));
    sendRequest(RPC_SCOPE, GIT_CREATE_BRANCH, params, new ConsoleProcessCallbackAdapter(requestCallback));
}
Also used : JSONArray(com.google.gwt.json.client.JSONArray) JSONString(com.google.gwt.json.client.JSONString)

Example 20 with JSONString

use of com.google.gwt.json.client.JSONString in project rstudio by rstudio.

the class RemoteServer method sendRequestViaMainWorkbench.

// call made from satellite -- this delegates to a native method which
// sets up a javascript callback and then calls the main workbench
private <T> void sendRequestViaMainWorkbench(String scope, String method, JSONArray params, boolean redactLog, final ServerRequestCallback<T> requestCallback) {
    JSONObject request = new JSONObject();
    request.put("method", new JSONString(method));
    if (params != null)
        request.put("params", params);
    final RequestLogEntry requestLogEntry = RequestLog.log(Integer.toString(Random.nextInt()), redactLog ? "[REDACTED]" : request.toString());
    sendRequestViaMainWorkbench(scope, method, params.getJavaScriptObject(), redactLog, new RpcResponseHandler() {

        @Override
        public void onResponseReceived(RpcResponse response) {
            String responseText = response.toString();
            requestLogEntry.logResponse(ResponseType.Normal, responseText);
            if (response.getError() != null) {
                RpcError error = response.getError();
                requestCallback.onError(new RemoteServerError(error));
            } else {
                T result = response.<T>getResult();
                requestCallback.onResponseReceived(result);
            }
        }
    });
}
Also used : JSONObject(com.google.gwt.json.client.JSONObject) RequestLogEntry(org.rstudio.core.client.jsonrpc.RequestLogEntry) GWT(com.google.gwt.core.client.GWT) RpcResponseHandler(org.rstudio.core.client.jsonrpc.RpcResponseHandler) RpcError(org.rstudio.core.client.jsonrpc.RpcError) JSONString(com.google.gwt.json.client.JSONString) JsArrayString(com.google.gwt.core.client.JsArrayString) RpcResponse(org.rstudio.core.client.jsonrpc.RpcResponse) JSONString(com.google.gwt.json.client.JSONString)

Aggregations

JSONString (com.google.gwt.json.client.JSONString)230 JSONArray (com.google.gwt.json.client.JSONArray)179 JSONNumber (com.google.gwt.json.client.JSONNumber)71 JSONObject (com.google.gwt.json.client.JSONObject)69 JavaScriptObject (com.google.gwt.core.client.JavaScriptObject)6 HashMap (java.util.HashMap)6 Breakpoint (org.rstudio.studio.client.common.debugging.model.Breakpoint)6 Point (org.rstudio.studio.client.workbench.views.plots.model.Point)6 JSONValue (com.google.gwt.json.client.JSONValue)5 JsonCallbackEvents (cz.metacentrum.perun.webgui.json.JsonCallbackEvents)5 PerunError (cz.metacentrum.perun.webgui.model.PerunError)5 ArrayList (java.util.ArrayList)5 JsArrayString (com.google.gwt.core.client.JsArrayString)4 Map (java.util.Map)4 JsonPostClient (cz.metacentrum.perun.webgui.json.JsonPostClient)3 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)2 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)2 JSONBoolean (com.google.gwt.json.client.JSONBoolean)2 GwtTestTest (com.googlecode.gwt.test.GwtTestTest)2 GetFacilityState (cz.metacentrum.perun.webgui.json.propagationStatsReader.GetFacilityState)2