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);
}
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);
}
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);
}
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));
}
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);
}
}
});
}
Aggregations