if (event.getSource() == addQueryDialog.actionButton) {
addQueryDialog.hide();
JSONObject args = new JSONObject();
args.put("name", new JSONString(addQueryDialog.widget.getText()));
args.put("url_token", new JSONString(CustomHistory.getLastHistoryToken().toString()));
rpcProxy.rpcCall("add_saved_query", args, new JsonRpcCallback() {
@Override
public void onSuccess(JSONValue result) {
notifyManager.showMessage("Query saved");
populateMainList();
}
});
} else {
assert event.getSource() == deleteQueryDialog.actionButton;
deleteQueryDialog.hide();
String idString =
deleteQueryDialog.widget.getValue(deleteQueryDialog.widget.getSelectedIndex());
JSONObject args = new JSONObject();
JSONArray ids = new JSONArray();
ids.set(0, new JSONNumber(Integer.parseInt(idString)));
args.put("id_list", ids);
rpcProxy.rpcCall("delete_saved_queries", args, new JsonRpcCallback() {
@Override
public void onSuccess(JSONValue result) {
notifyManager.showMessage("Query deleted");
populateMainList();
}