}
void _on_create_buf(JsonObject obj) {
Gson gson = new Gson();
GetBufResponse res = gson.fromJson(obj, (Type) CreateBufResponse.class);
Buf buf;
if (res.encoding.equals(Encoding.BASE64.toString())) {
buf = new BinaryBuf(res.path, res.id, new Base64().decode(res.buf.getBytes()), res.md5, context, outbound);
} else {
buf = new TextBuf(res.path, res.id, res.buf, res.md5, context, outbound);
}
editor.queue(buf, new RunLater<Buf>() {
@Override
public void run(Buf buf) {
if (state.bufs == null) {
return;
}
state.bufs.put(buf.id, buf);
state.pathsToIds.put(buf.path, buf.id);
buf.write();
fileAddedMessageThrottler.statusMessage(String.format("Added the file, %s, to the workspace.", buf.path));
}
});
}