File tree Expand file tree Collapse file tree 2 files changed +75
-0
lines changed
Expand file tree Collapse file tree 2 files changed +75
-0
lines changed Original file line number Diff line number Diff line change 1+ import java.util.Arrays ;
2+ import java.io.FileInputStream ;
3+ import java.io.ByteArrayOutputStream ;
4+ import java.awt.EventQueue ;
5+ import org.freeplane.plugin.script.proxy.ScriptUtils
6+
7+ /* *****************************************************************/
8+ def threads = new Thread [Thread . activeCount()]
9+ Thread . currentThread(). getThreadGroup(). enumerate(threads)
10+
11+ // (@metacoma) sleep interuppted error workaround
12+ // Arrays.stream(threads).forEach(Thread::interrupt)
13+
14+ /* *****************************************************************/
15+ def name = node. id
16+ new Thread (() -> {
17+ FP . runShell(node. id)
18+ Thread . sleep(10000 )
19+
20+ def pipeLog = new BufferedReader (new FileReader (new File (" /tmp/LOG" )));
21+ while (true ) {
22+ while ((groovy_code_base64 = pipeLog. readLine()) != null ) {
23+ String groovy_code = new String (groovy_code_base64. decodeBase64())
24+ println groovy_code
25+ String groovy_script = """
26+ import org.freeplane.plugin.script.proxy.ScriptUtils;
27+ def c = ScriptUtils.c();
28+ def node = ScriptUtils.node();
29+ //node.children.each{ it.delete() }
30+ """ + groovy_code;
31+ println groovy_script
32+ EventQueue . invokeAndWait(() -> Eval . me(groovy_script))
33+
34+ }
35+ }
36+
37+ },name). start()
Original file line number Diff line number Diff line change 1+ import java.util.Arrays ;
2+ import java.io.FileInputStream ;
3+ import java.io.ByteArrayOutputStream ;
4+ import java.awt.EventQueue ;
5+ import org.freeplane.plugin.script.proxy.ScriptUtils
6+
7+ /* *****************************************************************/
8+ def threads = new Thread [Thread . activeCount()]
9+ Thread . currentThread(). getThreadGroup(). enumerate(threads)
10+
11+ // (@metacoma) sleep interuppted error workaround
12+ // Arrays.stream(threads).forEach(Thread::interrupt)
13+
14+ /* *****************************************************************/
15+ def name = node. id
16+ new Thread (() -> {
17+ FP . runShell(node. id)
18+ Thread . sleep(10000 )
19+ InputStream Fifo = new FileInputStream (" /tmp/freeplane-" + name + " .fifo" );
20+ int buffer_size = 1048576 ; // # FIXME, buffer too small
21+ byte [] bytes = new byte [0x100000 ];
22+ int bytes_read = -1 ;
23+ while (1 ) {
24+ while ((bytes_read = Fifo . read(bytes, 0 , buffer_size)) == -1 ) {
25+ // print "."
26+ Thread . sleep(1000 )
27+ }
28+ String text = new String (bytes, 0 , bytes_read)
29+ String groovy_script = """
30+ import org.freeplane.plugin.script.proxy.ScriptUtils;
31+ def c = ScriptUtils.c();
32+ def node = ScriptUtils.node();
33+ //node.children.each{ it.delete() }
34+ """ + text;
35+ println groovy_script
36+ EventQueue . invokeAndWait(() -> Eval . me(groovy_script))
37+ }
38+ },name). start()
You can’t perform that action at this time.
0 commit comments