mirror of
https://github.com/hexedtech/codemp.git
synced 2024-11-22 15:24:48 +01:00
Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
88f4ace04a
2 changed files with 19 additions and 8 deletions
14
dist/java/src/mp/code/Workspace.java
vendored
14
dist/java/src/mp/code/Workspace.java
vendored
|
@ -28,14 +28,14 @@ public class Workspace {
|
|||
return Optional.ofNullable(get_buffer(this.ptr, path));
|
||||
}
|
||||
|
||||
private static native String[] get_file_tree(long self);
|
||||
public String[] getFileTree() {
|
||||
return get_file_tree(this.ptr);
|
||||
private static native String[] get_file_tree(long self, String filter);
|
||||
public String[] getFileTree(Optional<String> filter) {
|
||||
return get_file_tree(this.ptr, filter.orElse(null));
|
||||
}
|
||||
|
||||
private static native long create_buffer(String path) throws CodeMPException;
|
||||
public BufferController createBuffer(String path) throws CodeMPException {
|
||||
return new BufferController(create_buffer(path));
|
||||
private static native void create_buffer(String path) throws CodeMPException;
|
||||
public void createBuffer(String path) throws CodeMPException {
|
||||
create_buffer(path);
|
||||
}
|
||||
|
||||
private static native BufferController attach_to_buffer(long self, String path) throws CodeMPException;
|
||||
|
@ -93,7 +93,7 @@ public class Workspace {
|
|||
this.argument = argument;
|
||||
}
|
||||
|
||||
public Optional<String> getUserJoined() {
|
||||
public Optional<String > getUserJoined() {
|
||||
if(this.type == Type.USER_JOIN) {
|
||||
return Optional.of(this.argument);
|
||||
} else return Optional.empty();
|
||||
|
|
|
@ -69,9 +69,20 @@ pub extern "system" fn Java_mp_code_Workspace_get_1file_1tree(
|
|||
mut env: JNIEnv,
|
||||
_class: JClass,
|
||||
self_ptr: jlong,
|
||||
filter: JString
|
||||
) -> jobjectArray {
|
||||
let workspace = unsafe { Box::leak(Box::from_raw(self_ptr as *mut Workspace)) };
|
||||
let file_tree = workspace.filetree();
|
||||
let filter: Option<String> = if filter.is_null() {
|
||||
None
|
||||
} else {
|
||||
Some(
|
||||
env.get_string(&filter)
|
||||
.map(|s| s.into())
|
||||
.jexcept(&mut env)
|
||||
)
|
||||
};
|
||||
|
||||
let file_tree = workspace.filetree(filter.as_deref());
|
||||
env.find_class("java/lang/String")
|
||||
.and_then(|class| env.new_object_array(file_tree.len() as i32, class, JObject::null()))
|
||||
.map(|arr| {
|
||||
|
|
Loading…
Reference in a new issue