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 RnwChunkOptions method getOptionValues.
public final ArrayList<String> getOptionValues(String name) {
JSONArray arr = new JSONArray(getOptionTypeNative(name));
ArrayList<String> values = new ArrayList<String>();
for (int i = 0; i < arr.size(); i++) {
JSONArray array = arr.get(i).isArray();
if (array == null)
break;
if (array.size() == 0)
break;
JSONString string = array.get(0).isString();
if (string == null)
break;
values.add(string.stringValue());
}
return values;
}
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);
}
}
});
}
use of com.google.gwt.json.client.JSONString in project rstudio by rstudio.
the class RemoteServer method getSlideNavigationForCode.
@Override
public void getSlideNavigationForCode(String code, String baseDir, ServerRequestCallback<SlideNavigation> requestCallback) {
JSONArray params = new JSONArray();
params.set(0, new JSONString(code));
params.set(1, new JSONString(baseDir));
sendRequest(RPC_SCOPE, GET_SLIDE_NAVIGATION_FOR_CODE, params, requestCallback);
}
Aggregations