fix(java): async content(), moved select_buffer

This commit is contained in:
zaaarf 2024-08-13 21:58:40 +02:00
parent ab9c6530cd
commit ada6ed49c1
No known key found for this signature in database
GPG key ID: 102E445F4C3F829B
3 changed files with 5 additions and 4 deletions

View file

@ -18,8 +18,8 @@ public class BufferController {
return get_name(this.ptr);
}
public static native String get_content(long self);
public String getContent() {
public static native String get_content(long self) throws CodeMPException;
public String getContent() throws CodeMPException {
return get_content(this.ptr);
}

View file

@ -26,7 +26,8 @@ pub extern "system" fn Java_mp_code_BufferController_get_1content(
self_ptr: jlong,
) -> jstring {
let controller = unsafe { Box::leak(Box::from_raw(self_ptr as *mut crate::buffer::Controller)) };
let content = controller.content();
let content = RT.block_on(controller.content())
.jexcept(&mut env);
env.new_string(content)
.jexcept(&mut env)
.as_raw()

View file

@ -245,7 +245,7 @@ pub extern "system" fn Java_mp_code_Workspace_select_1buffer(
}
}
RT.block_on(crate::buffer::tools::select_buffer(
RT.block_on(crate::ext::select_buffer(
&controllers,
Some(std::time::Duration::from_millis(timeout as u64)),
&RT,