more todo items, and implement multiple editors at once

This commit is contained in:
benfry
2011-04-16 19:29:39 +00:00
parent 09643d5574
commit 05aa42c313
6 changed files with 67 additions and 47 deletions

View File

@@ -9,12 +9,17 @@ import javax.swing.*;
import javax.swing.border.*;
import processing.app.*;
import processing.mode.java.runner.Runner;
public class JavaEditor extends Editor {
JavaMode jmode;
// TODO this needs prefs to be applied when necessary
PdeKeyListener listener;
// Runner associated with this editor window
private Runner runtime;
protected JavaEditor(Base base, String path, int[] location, Mode mode) {
@@ -502,7 +507,11 @@ public class JavaEditor extends Editor {
toolbar.activate(JavaToolbar.STOP);
try {
jmode.handleStop();
//jmode.handleStop();
if (runtime != null) {
runtime.close(); // kills the window
runtime = null; // will this help?
}
} catch (Exception e) {
statusError(e);
}
@@ -517,15 +526,15 @@ public class JavaEditor extends Editor {
public void handleSave() {
toolbar.activate(JavaToolbar.SAVE);
handleStop();
//handleStop();
super.handleSave();
toolbar.deactivate(JavaToolbar.SAVE);
}
public boolean handleSaveAs() {
toolbar.activate(JavaToolbar.SAVE);
handleStop();
//handleStop();
boolean result = super.handleSaveAs();
toolbar.deactivate(JavaToolbar.SAVE);
return result;
@@ -589,6 +598,7 @@ public class JavaEditor extends Editor {
public void internalCloseRunner() {
jmode.handleStop();
//jmode.handleStop();
handleStop();
}
}

View File

@@ -38,8 +38,6 @@ import processing.mode.java.runner.Runner;
public class JavaMode extends Mode {
private Runner runtime;
// classpath for all known libraries for p5
// (both those in the p5/libs folder and those with lib subfolders
// found in the sketchbook)
@@ -173,32 +171,36 @@ public class JavaMode extends Mode {
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
public void handleRun(Sketch sketch, RunnerListener listener) throws SketchException {
public Runner handleRun(Sketch sketch, RunnerListener listener) throws SketchException {
Runner runtime = null;
JavaBuild build = new JavaBuild(sketch);
String appletClassName = build.build();
if (appletClassName != null) {
runtime = new Runner(build, listener);
runtime.launch(false);
}
return runtime;
}
public void handlePresent(Sketch sketch, RunnerListener listener) throws SketchException {
public Runner handlePresent(Sketch sketch, RunnerListener listener) throws SketchException {
Runner runtime = null;
JavaBuild build = new JavaBuild(sketch);
String appletClassName = build.build();
if (appletClassName != null) {
runtime = new Runner(build, listener);
runtime.launch(true);
}
return runtime;
}
public void handleStop() {
if (runtime != null) {
runtime.close(); // kills the window
runtime = null; // will this help?
}
}
// public void handleStop() {
// if (runtime != null) {
// runtime.close(); // kills the window
// runtime = null; // will this help?
// }
// }
public boolean handleExportApplet(Sketch sketch) throws SketchException, IOException {