Skip to content

Commit 45c300b

Browse files
committed
changing a bit of how monitoring works
1 parent f9a7958 commit 45c300b

5 files changed

Lines changed: 73 additions & 45 deletions

File tree

app/src/processing/app/Editor.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2060,6 +2060,16 @@ public void startIndeterminate() {
20602060
public void stopIndeterminate() {
20612061
status.stopIndeterminate();
20622062
}
2063+
2064+
2065+
public void statusHalt() {
2066+
// stop called by someone else
2067+
}
2068+
2069+
2070+
public boolean isHalted() {
2071+
return false;
2072+
}
20632073

20642074

20652075
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

app/src/processing/app/RunnerListener.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,16 @@ public interface RunnerListener {
3030
public void statusError(Exception exception);
3131

3232
public void statusNotice(String message);
33-
34-
//
33+
34+
//
3535

3636
public void startIndeterminate();
3737

3838
public void stopIndeterminate();
39+
40+
//
41+
42+
public void statusHalt();
43+
44+
public boolean isHalted();
3945
}

app/src/processing/mode/android/AndroidBuild.java

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -96,21 +96,21 @@ public File createProject(String target, File coreZipFile) throws IOException, S
9696
// PApplet.saveStream(new File(libsFolder, "processing-core.jar"), input);
9797
Base.copyFile(coreZipFile, new File(libsFolder, "processing-core.jar"));
9898

99-
try {
100-
// Copy any imported libraries or code folder contents to the project
101-
copyLibraries(libsFolder, assetsFolder);
102-
copyCodeFolder(libsFolder);
103-
104-
// Copy the data folder, if one exists, to the 'assets' folder of the
105-
// project
106-
final File sketchDataFolder = sketch.getDataFolder();
107-
if (sketchDataFolder.exists()) {
108-
Base.copyDir(sketchDataFolder, assetsFolder);
109-
}
110-
} catch (final IOException e) {
111-
e.printStackTrace();
112-
throw new SketchException(e.getMessage());
99+
// try {
100+
// Copy any imported libraries or code folder contents to the project
101+
copyLibraries(libsFolder, assetsFolder);
102+
copyCodeFolder(libsFolder);
103+
104+
// Copy the data folder, if one exists, to the 'assets' folder of the
105+
// project
106+
final File sketchDataFolder = sketch.getDataFolder();
107+
if (sketchDataFolder.exists()) {
108+
Base.copyDir(sketchDataFolder, assetsFolder);
113109
}
110+
// } catch (final IOException e) {
111+
// e.printStackTrace();
112+
// throw new SketchException(e.getMessage());
113+
// }
114114
}
115115
// } catch (final SketchException e) {
116116
// editor.statusError(e);

app/src/processing/mode/android/AndroidEditor.java

Lines changed: 32 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -328,10 +328,11 @@ private boolean startSketch(final Device device) {
328328
}
329329

330330

331-
private Device waitForDevice(final Future<Device> deviceFuture,
332-
final IndeterminateProgressMonitor monitor) throws MonitorCanceled {
331+
private Device waitForDevice(Future<Device> deviceFuture, RunnerListener listener) throws MonitorCanceled {
332+
// final IndeterminateProgressMonitor monitor)
333333
for (int i = 0; i < 120; i++) {
334-
if (monitor.isCanceled()) {
334+
// if (monitor.isCanceled()) {
335+
if (listener.isHalted()) {
335336
deviceFuture.cancel(true);
336337
throw new MonitorCanceled();
337338
}
@@ -360,13 +361,13 @@ private Device waitForDevice(final Future<Device> deviceFuture,
360361
private void runSketchOnDevice(final Future<Device> deviceFuture,
361362
final String target,
362363
RunnerListener listener) throws MonitorCanceled {
363-
final IndeterminateProgressMonitor monitor =
364-
new IndeterminateProgressMonitor(this,
365-
"Building and launching...",
366-
"Creating project...");
364+
// final IndeterminateProgressMonitor monitor =
365+
// new IndeterminateProgressMonitor(this,
366+
// "Building and launching...",
367+
// "Creating project...");
367368

368369
listener.startIndeterminate();
369-
listener.statusNotice("Building and launching...");
370+
listener.statusNotice("Creating project...");
370371

371372
build = new AndroidBuild(sketch, amode.getSDK());
372373
try {
@@ -380,10 +381,11 @@ private void runSketchOnDevice(final Future<Device> deviceFuture,
380381
statusError(e);
381382
}
382383
try {
383-
if (monitor.isCanceled()) {
384-
throw new MonitorCanceled();
385-
}
386-
monitor.setNote("Building...");
384+
// if (monitor.isCanceled()) {
385+
// throw new MonitorCanceled();
386+
// }
387+
// monitor.setNote("Building...");
388+
listener.statusNotice("Building...");
387389
try {
388390
if (!build.antBuild(target)) {
389391
return;
@@ -392,31 +394,36 @@ private void runSketchOnDevice(final Future<Device> deviceFuture,
392394
statusError(se);
393395
}
394396

395-
if (monitor.isCanceled()) {
396-
throw new MonitorCanceled();
397-
}
398-
monitor.setNote("Waiting for device to become available...");
399-
final Device device = waitForDevice(deviceFuture, monitor);
397+
// if (monitor.isCanceled()) {
398+
// throw new MonitorCanceled();
399+
// }
400+
// monitor.setNote("Waiting for device to become available...");
401+
listener.statusNotice("Waiting for device to become available...");
402+
// final Device device = waitForDevice(deviceFuture, monitor);
403+
final Device device = waitForDevice(deviceFuture, listener);
400404
if (device == null || !device.isAlive()) {
401405
statusError("Device killed or disconnected.");
402406
return;
403407
}
404408

405409
device.addListener(this);
406410

407-
if (monitor.isCanceled()) {
411+
if (listener.isHalted()) {
412+
// if (monitor.isCanceled()) {
408413
throw new MonitorCanceled();
409414
}
410-
monitor.setNote("Installing sketch on " + device.getId());
415+
// monitor.setNote("Installing sketch on " + device.getId());
416+
statusNotice("Installing sketch on " + device.getId());
411417
if (!device.installApp(build.getPathForAPK(target), this)) {
412418
statusError("Device killed or disconnected.");
413419
return;
414420
}
415421

416-
if (monitor.isCanceled()) {
417-
throw new MonitorCanceled();
418-
}
419-
monitor.setNote("Starting sketch on " + device.getId());
422+
// if (monitor.isCanceled()) {
423+
// throw new MonitorCanceled();
424+
// }
425+
// monitor.setNote("Starting sketch on " + device.getId());
426+
listener.statusNotice("Starting sketch on " + device.getId());
420427
if (startSketch(device)) {
421428
statusNotice("Sketch launched on the "
422429
+ (device.isEmulator() ? "emulator" : "phone") + ".");
@@ -429,7 +436,8 @@ private void runSketchOnDevice(final Future<Device> deviceFuture,
429436
build.cleanup();
430437
}
431438
} finally {
432-
monitor.close();
439+
// monitor.close();
440+
listener.stopIndeterminate();
433441
}
434442
}
435443

todo.txt

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,15 @@ _ test code folder on android
103103
_ test libraries on android
104104
_ test opengl on android
105105

106+
ugliness
107+
_ inside AndroidPreprocessor
108+
_ processing.mode.java.JavaBuild.scrubComments(sketch.getCode(0).getProgram())
109+
_ PApplet.match(scrubbed, processing.mode.java.JavaBuild.SIZE_REGEX);
110+
_ remove PdeKeyListener, roll it into the Java InputHandler for JEditTextArea
111+
_ remove any reference to 'Editor' from Sketch.java
112+
_ or is that excessive, since Document is in there, etc
113+
_ Build does the heavy lifting anyway...
114+
106115
_ don't make examples read-only
107116
_ just do them from psk files
108117

@@ -113,11 +122,6 @@ _ make sure that android is working again
113122
_ the build is broken! the build is broken!
114123
_ http://code.google.com/p/processing/issues/detail?id=519
115124

116-
_ remove PdeKeyListener, roll it into the Java InputHandler for JEditTextArea
117-
_ remove any reference to 'Editor' from Sketch.java
118-
_ or is that excessive, since Document is in there, etc
119-
_ Build does the heavy lifting anyway...
120-
121125
_ export is broken in 0192
122126
_ http://code.google.com/p/processing/issues/detail?id=487
123127

0 commit comments

Comments
 (0)