mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
stop button working to initiate stops
This commit is contained in:
@@ -1111,14 +1111,15 @@ public class Editor extends JFrame {
|
|||||||
if (!sketch.handleCompile()) return;
|
if (!sketch.handleCompile()) return;
|
||||||
|
|
||||||
//SwingUtilities.invokeLater(new Runnable() {
|
//SwingUtilities.invokeLater(new Runnable() {
|
||||||
|
runtime = new Runner(Editor.this, presenting);
|
||||||
Thread t = new Thread(new Runnable() {
|
Thread t = new Thread(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
// try {
|
||||||
runtime = new Runner(Editor.this, presenting);
|
runtime.poo();
|
||||||
//runtime.go();
|
//runtime.go();
|
||||||
} catch (RunnerException e) {
|
// } catch (RunnerException e) {
|
||||||
error(e);
|
// error(e);
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
t.start();
|
t.start();
|
||||||
@@ -1129,7 +1130,7 @@ public class Editor extends JFrame {
|
|||||||
//watcher = new RunButtonWatcher();
|
//watcher = new RunButtonWatcher();
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
System.err.println("exception reached editor");
|
// System.err.println("exception reached editor");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1237,7 +1238,7 @@ public class Editor extends JFrame {
|
|||||||
* Stop the applet but don't kill its window.
|
* Stop the applet but don't kill its window.
|
||||||
*/
|
*/
|
||||||
public void stopRunner() {
|
public void stopRunner() {
|
||||||
//System.out.println("stopRunner 1");
|
// System.out.println("stopRunner " + runtime);
|
||||||
if (runtime != null) runtime.stop();
|
if (runtime != null) runtime.stop();
|
||||||
//System.out.println("stopRunner 2");
|
//System.out.println("stopRunner 2");
|
||||||
//if (watcher != null) watcher.stop();
|
//if (watcher != null) watcher.stop();
|
||||||
@@ -1256,7 +1257,7 @@ public class Editor extends JFrame {
|
|||||||
* mode, this will always be called instead of doStop().
|
* mode, this will always be called instead of doStop().
|
||||||
*/
|
*/
|
||||||
public void closeRunner() {
|
public void closeRunner() {
|
||||||
//System.out.println("closing runner");
|
// System.out.println("closing runner");
|
||||||
|
|
||||||
//if (presenting) {
|
//if (presenting) {
|
||||||
//presentationWindow.hide();
|
//presentationWindow.hide();
|
||||||
@@ -1277,6 +1278,7 @@ public class Editor extends JFrame {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
if (runtime != null) {
|
if (runtime != null) {
|
||||||
|
// System.out.println("runtime closing");
|
||||||
runtime.close(); // kills the window
|
runtime.close(); // kills the window
|
||||||
runtime = null; // will this help?
|
runtime = null; // will this help?
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -92,12 +92,11 @@ public class Runner implements MessageConsumer {
|
|||||||
public Runner(Editor editor, boolean presenting) throws RunnerException {
|
public Runner(Editor editor, boolean presenting) throws RunnerException {
|
||||||
this.editor = editor;
|
this.editor = editor;
|
||||||
this.sketch = editor.sketch;
|
this.sketch = editor.sketch;
|
||||||
this.presenting = presenting;
|
this.presenting = presenting;
|
||||||
|
}
|
||||||
// }
|
|
||||||
//
|
|
||||||
//
|
public void poo() {
|
||||||
// public void go2() {
|
|
||||||
|
|
||||||
// this as prefix made the code folder bug go away, but killed stdio
|
// this as prefix made the code folder bug go away, but killed stdio
|
||||||
//"cmd", "/c", "start",
|
//"cmd", "/c", "start",
|
||||||
@@ -121,13 +120,14 @@ public class Runner implements MessageConsumer {
|
|||||||
vm = launch(vmParamList, appletParamList);
|
vm = launch(vmParamList, appletParamList);
|
||||||
|
|
||||||
// PrintWriter writer = new PrintWriter(System.out);
|
// PrintWriter writer = new PrintWriter(System.out);
|
||||||
PrintWriter writer = null;
|
// PrintWriter writer = null;
|
||||||
try {
|
// try {
|
||||||
writer = new PrintWriter(new FileWriter("/Users/fry/Desktop/runner.txt"));
|
// writer = new PrintWriter(new FileWriter("/Users/fry/Desktop/runner.txt"));
|
||||||
} catch (IOException e) {
|
// } catch (IOException e) {
|
||||||
e.printStackTrace();
|
// e.printStackTrace();
|
||||||
}
|
// }
|
||||||
generateTrace(writer);
|
//generateTrace(writer);
|
||||||
|
generateTrace(null);
|
||||||
|
|
||||||
// String[] guiParams = PApplet.concat(vmParamList, appletParamList);
|
// String[] guiParams = PApplet.concat(vmParamList, appletParamList);
|
||||||
// for (int i = 0; i < guiParams.length; i++) {
|
// for (int i = 0; i < guiParams.length; i++) {
|
||||||
@@ -342,21 +342,26 @@ public class Runner implements MessageConsumer {
|
|||||||
*/
|
*/
|
||||||
void generateTrace(PrintWriter writer) {
|
void generateTrace(PrintWriter writer) {
|
||||||
vm.setDebugTraceMode(debugTraceMode);
|
vm.setDebugTraceMode(debugTraceMode);
|
||||||
EventThread eventThread = new EventThread(vm, excludes, writer);
|
|
||||||
eventThread.setEventRequests(watchFields);
|
EventThread eventThread = null;
|
||||||
eventThread.start();
|
if (writer != null) {
|
||||||
|
eventThread = new EventThread(vm, excludes, writer);
|
||||||
|
eventThread.setEventRequests(watchFields);
|
||||||
|
eventThread.start();
|
||||||
|
}
|
||||||
|
|
||||||
redirectOutput();
|
redirectOutput();
|
||||||
vm.resume();
|
vm.resume();
|
||||||
|
|
||||||
// Shutdown begins when event thread terminates
|
// Shutdown begins when event thread terminates
|
||||||
try {
|
try {
|
||||||
eventThread.join();
|
if (eventThread != null) eventThread.join();
|
||||||
errThread.join(); // Make sure output is forwarded
|
errThread.join(); // Make sure output is forwarded
|
||||||
outThread.join(); // before we exit
|
outThread.join(); // before we exit
|
||||||
} catch (InterruptedException exc) {
|
} catch (InterruptedException exc) {
|
||||||
// we don't interrupt
|
// we don't interrupt
|
||||||
}
|
}
|
||||||
writer.close();
|
if (writer != null) writer.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -714,7 +719,7 @@ public class Runner implements MessageConsumer {
|
|||||||
|
|
||||||
|
|
||||||
public void stop() {
|
public void stop() {
|
||||||
System.out.println("external stop not implemented");
|
//System.out.println("external stop not implemented");
|
||||||
close();
|
close();
|
||||||
|
|
||||||
//EventQueue eq = vm.eventQueue();
|
//EventQueue eq = vm.eventQueue();
|
||||||
@@ -780,7 +785,7 @@ public class Runner implements MessageConsumer {
|
|||||||
|
|
||||||
} catch (com.sun.jdi.VMDisconnectedException vmde) {
|
} catch (com.sun.jdi.VMDisconnectedException vmde) {
|
||||||
// if the vm has disconnected on its own, ignore message
|
// if the vm has disconnected on its own, ignore message
|
||||||
System.out.println("harmless disconnect " + vmde.getMessage());
|
//System.out.println("harmless disconnect " + vmde.getMessage());
|
||||||
// TODO shouldn't need to do this, need to do more cleanup
|
// TODO shouldn't need to do this, need to do more cleanup
|
||||||
}
|
}
|
||||||
vm = null;
|
vm = null;
|
||||||
|
|||||||
Reference in New Issue
Block a user