From 461ceb6be22ae508eb0b434d6d984289c8437413 Mon Sep 17 00:00:00 2001 From: jdf Date: Wed, 24 Feb 2010 17:53:00 +0000 Subject: [PATCH] Fix incorrect format --- .../app/tools/android/AndroidRunner.java | 803 +++++++++--------- .../processing/app/tools/android/Reset.java | 1 - 2 files changed, 390 insertions(+), 414 deletions(-) diff --git a/android/tool/src/processing/app/tools/android/AndroidRunner.java b/android/tool/src/processing/app/tools/android/AndroidRunner.java index 5935312a1..7d2a1a54f 100644 --- a/android/tool/src/processing/app/tools/android/AndroidRunner.java +++ b/android/tool/src/processing/app/tools/android/AndroidRunner.java @@ -26,12 +26,10 @@ package processing.app.tools.android; import java.io.IOException; import java.io.PrintWriter; import java.util.Map; - import processing.app.Sketch; import processing.app.debug.EventThread; import processing.app.debug.Runner; import processing.app.debug.RunnerListener; - import com.sun.jdi.Field; import com.sun.jdi.ObjectReference; import com.sun.jdi.ReferenceType; @@ -42,477 +40,456 @@ import com.sun.jdi.connect.Connector; import com.sun.jdi.connect.IllegalConnectorArgumentsException; import com.sun.jdi.event.ExceptionEvent; -public class AndroidRunner extends Runner -{ +public class AndroidRunner extends Runner { - public AndroidRunner(final RunnerListener listener, final Sketch sketch) - { - super(listener, sketch); - } + public AndroidRunner(final RunnerListener listener, final Sketch sketch) { + super(listener, sketch); + } - public boolean launch(final String port) - { - vm = launchVirtualMachine(port); - // System.out.println("vm launched"); - if (vm != null) - { - // System.out.println("starting trace"); - generateTrace(null); - // System.out.println("done starting trace"); - return true; - } - // System.out.println("no trace for you"); - return false; - } + public boolean launch(final String port) { + vm = launchVirtualMachine(port); + // System.out.println("vm launched"); + if (vm != null) { + // System.out.println("starting trace"); + generateTrace(null); + // System.out.println("done starting trace"); + return true; + } + // System.out.println("no trace for you"); + return false; + } - /* - public void launch(Sketch sketch, String appletClassName, - boolean presenting) { - this.sketch = sketch; - this.appletClassName = appletClassName; - this.presenting = presenting; - - // TODO entire class is a total mess as of release 0136. - // This will be cleaned up significantly over the next couple months. + /* + public void launch(Sketch sketch, String appletClassName, + boolean presenting) { + this.sketch = sketch; + this.appletClassName = appletClassName; + this.presenting = presenting; + + // TODO entire class is a total mess as of release 0136. + // This will be cleaned up significantly over the next couple months. - // all params have to be stored as separate items, - // so a growable array needs to be used. i.e. -Xms128m -Xmx1024m - // will throw an error if it's shoved into a single array element - //Vector params = new Vector(); + // all params have to be stored as separate items, + // so a growable array needs to be used. i.e. -Xms128m -Xmx1024m + // will throw an error if it's shoved into a single array element + //Vector params = new Vector(); - // get around Apple's Java 1.5 bugs - //params.add("/System/Library/Frameworks/JavaVM.framework/Versions/1.4.2/Commands/java"); - //params.add("java"); - //System.out.println("0"); + // get around Apple's Java 1.5 bugs + //params.add("/System/Library/Frameworks/JavaVM.framework/Versions/1.4.2/Commands/java"); + //params.add("java"); + //System.out.println("0"); - String[] machineParamList = getMachineParams(); - String[] sketchParamList = getSketchParams(); + String[] machineParamList = getMachineParams(); + String[] sketchParamList = getSketchParams(); - vm = launchVirtualMachine(machineParamList, sketchParamList); - if (vm != null) { - generateTrace(null); - // try { - // generateTrace(new PrintWriter("/Users/fry/Desktop/output.txt")); - // } catch (Exception e) { - // e.printStackTrace(); - // } - } - } + vm = launchVirtualMachine(machineParamList, sketchParamList); + if (vm != null) { + generateTrace(null); + // try { + // generateTrace(new PrintWriter("/Users/fry/Desktop/output.txt")); + // } catch (Exception e) { + // e.printStackTrace(); + // } + } + } - protected String[] getMachineParams() { - ArrayList params = new ArrayList(); + protected String[] getMachineParams() { + ArrayList params = new ArrayList(); - //params.add("-Xint"); // interpreted mode - //params.add("-Xprof"); // profiler - //params.add("-Xaprof"); // allocation profiler - //params.add("-Xrunhprof:cpu=samples"); // old-style profiler + //params.add("-Xint"); // interpreted mode + //params.add("-Xprof"); // profiler + //params.add("-Xaprof"); // allocation profiler + //params.add("-Xrunhprof:cpu=samples"); // old-style profiler - // TODO change this to use run.args = true, run.args.0, run.args.1, etc. - // so that spaces can be included in the arg names - String options = Preferences.get("run.options"); - if (options.length() > 0) { - String pieces[] = PApplet.split(options, ' '); - for (int i = 0; i < pieces.length; i++) { - String p = pieces[i].trim(); - if (p.length() > 0) { - params.add(p); - } - } - } + // TODO change this to use run.args = true, run.args.0, run.args.1, etc. + // so that spaces can be included in the arg names + String options = Preferences.get("run.options"); + if (options.length() > 0) { + String pieces[] = PApplet.split(options, ' '); + for (int i = 0; i < pieces.length; i++) { + String p = pieces[i].trim(); + if (p.length() > 0) { + params.add(p); + } + } + } - // params.add("-Djava.ext.dirs=nuffing"); + // params.add("-Djava.ext.dirs=nuffing"); - if (Preferences.getBoolean("run.options.memory")) { - params.add("-Xms" + Preferences.get("run.options.memory.initial") + "m"); - params.add("-Xmx" + Preferences.get("run.options.memory.maximum") + "m"); - } + if (Preferences.getBoolean("run.options.memory")) { + params.add("-Xms" + Preferences.get("run.options.memory.initial") + "m"); + params.add("-Xmx" + Preferences.get("run.options.memory.maximum") + "m"); + } - if (Base.isMacOS()) { - params.add("-Xdock:name=" + appletClassName); - // params.add("-Dcom.apple.mrj.application.apple.menu.about.name=" + - // sketch.getMainClassName()); - } - // sketch.libraryPath might be "" - // librariesClassPath will always have sep char prepended - params.add("-Djava.library.path=" + - sketch.getLibraryPath() + - File.pathSeparator + - System.getProperty("java.library.path")); + if (Base.isMacOS()) { + params.add("-Xdock:name=" + appletClassName); + // params.add("-Dcom.apple.mrj.application.apple.menu.about.name=" + + // sketch.getMainClassName()); + } + // sketch.libraryPath might be "" + // librariesClassPath will always have sep char prepended + params.add("-Djava.library.path=" + + sketch.getLibraryPath() + + File.pathSeparator + + System.getProperty("java.library.path")); - params.add("-cp"); - params.add(sketch.getClassPath()); - // params.add(sketch.getClassPath() + - // File.pathSeparator + - // Base.librariesClassPath); + params.add("-cp"); + params.add(sketch.getClassPath()); + // params.add(sketch.getClassPath() + + // File.pathSeparator + + // Base.librariesClassPath); - //PApplet.println(PApplet.split(sketch.classPath, ':')); + //PApplet.println(PApplet.split(sketch.classPath, ':')); - String outgoing[] = new String[params.size()]; - params.toArray(outgoing); + String outgoing[] = new String[params.size()]; + params.toArray(outgoing); - //PApplet.println(outgoing); - // PApplet.println(PApplet.split(outgoing[0], ":")); - // PApplet.println(); - // PApplet.println("class path"); - // PApplet.println(PApplet.split(outgoing[2], ":")); + //PApplet.println(outgoing); + // PApplet.println(PApplet.split(outgoing[0], ":")); + // PApplet.println(); + // PApplet.println("class path"); + // PApplet.println(PApplet.split(outgoing[2], ":")); - return outgoing; - //return (String[]) params.toArray(); + return outgoing; + //return (String[]) params.toArray(); - // System.out.println("sketch class path"); - // PApplet.println(PApplet.split(sketch.classPath, ';')); - // System.out.println(); - // System.out.println("libraries class path"); - // PApplet.println(PApplet.split(Base.librariesClassPath, ';')); - // System.out.println(); - } + // System.out.println("sketch class path"); + // PApplet.println(PApplet.split(sketch.classPath, ';')); + // System.out.println(); + // System.out.println("libraries class path"); + // PApplet.println(PApplet.split(Base.librariesClassPath, ';')); + // System.out.println(); + } - protected String[] getSketchParams() { - ArrayList params = new ArrayList(); + protected String[] getSketchParams() { + ArrayList params = new ArrayList(); - params.add("processing.core.PApplet"); + params.add("processing.core.PApplet"); - // If there was a saved location (this guy has been run more than once) - // then the location will be set to the last position of the sketch window. - // This will be passed to the PApplet runner using something like - // --location=30,20 - // Otherwise, the editor location will be passed, and the applet will - // figure out where to place itself based on the editor location. - // --editor-location=150,20 - if (editor != null) { // if running processing-cmd, don't do placement - Point windowLocation = editor.getSketchLocation(); - if (windowLocation != null) { - params.add(PApplet.ARGS_LOCATION + "=" + - windowLocation.x + "," + windowLocation.y); - } else { - Point editorLocation = editor.getLocation(); - params.add(PApplet.ARGS_EDITOR_LOCATION + "=" + - editorLocation.x + "," + editorLocation.y); - } - params.add(PApplet.ARGS_EXTERNAL); - } + // If there was a saved location (this guy has been run more than once) + // then the location will be set to the last position of the sketch window. + // This will be passed to the PApplet runner using something like + // --location=30,20 + // Otherwise, the editor location will be passed, and the applet will + // figure out where to place itself based on the editor location. + // --editor-location=150,20 + if (editor != null) { // if running processing-cmd, don't do placement + Point windowLocation = editor.getSketchLocation(); + if (windowLocation != null) { + params.add(PApplet.ARGS_LOCATION + "=" + + windowLocation.x + "," + windowLocation.y); + } else { + Point editorLocation = editor.getLocation(); + params.add(PApplet.ARGS_EDITOR_LOCATION + "=" + + editorLocation.x + "," + editorLocation.y); + } + params.add(PApplet.ARGS_EXTERNAL); + } - params.add(PApplet.ARGS_DISPLAY + "=" + - Preferences.get("run.display")); - params.add(PApplet.ARGS_SKETCH_FOLDER + "=" + - sketch.getFolder().getAbsolutePath()); + params.add(PApplet.ARGS_DISPLAY + "=" + + Preferences.get("run.display")); + params.add(PApplet.ARGS_SKETCH_FOLDER + "=" + + sketch.getFolder().getAbsolutePath()); - if (presenting) { - params.add(PApplet.ARGS_PRESENT); - if (Preferences.getBoolean("run.present.exclusive")) { - params.add(PApplet.ARGS_EXCLUSIVE); - } - params.add(PApplet.ARGS_STOP_COLOR + "=" + - Preferences.get("run.present.stop.color")); - params.add(PApplet.ARGS_BGCOLOR + "=" + - Preferences.get("run.present.bgcolor")); - } + if (presenting) { + params.add(PApplet.ARGS_PRESENT); + if (Preferences.getBoolean("run.present.exclusive")) { + params.add(PApplet.ARGS_EXCLUSIVE); + } + params.add(PApplet.ARGS_STOP_COLOR + "=" + + Preferences.get("run.present.stop.color")); + params.add(PApplet.ARGS_BGCOLOR + "=" + + Preferences.get("run.present.bgcolor")); + } - params.add(appletClassName); + params.add(appletClassName); - // String outgoing[] = new String[params.size()]; - // params.toArray(outgoing); - // return outgoing; - return (String[]) params.toArray(new String[0]); - } - */ + // String outgoing[] = new String[params.size()]; + // params.toArray(outgoing); + // return outgoing; + return (String[]) params.toArray(new String[0]); + } + */ - // http://java.sun.com/j2se/1.5.0/docs/guide/jpda/conninv.html - protected VirtualMachine launchVirtualMachine(final String localPort) - { - // hostname, port, and timeout (ms) are the only items needed here - final AttachingConnector connector = (AttachingConnector) findConnector("com.sun.jdi.SocketAttach"); - //PApplet.println(connector); // gets the defaults + // http://java.sun.com/j2se/1.5.0/docs/guide/jpda/conninv.html + protected VirtualMachine launchVirtualMachine(final String localPort) { + // hostname, port, and timeout (ms) are the only items needed here + final AttachingConnector connector = (AttachingConnector) findConnector("com.sun.jdi.SocketAttach"); + //PApplet.println(connector); // gets the defaults - final Map arguments = connector.defaultArguments(); + final Map arguments = connector + .defaultArguments(); - // Connector.Argument portArg = - // (Connector.Argument)arguments.get("port"); - // portArg.setValue(port); - arguments.get("port").setValue(localPort); - arguments.get("hostname").setValue("127.0.0.1"); - // ((Connector.Argument) arguments.get("hostname")).setValue("localhost"); - // ((Connector.Argument) arguments.get("timeout")).setValue("5000"); + // Connector.Argument portArg = + // (Connector.Argument)arguments.get("port"); + // portArg.setValue(port); + arguments.get("port").setValue(localPort); + arguments.get("hostname").setValue("127.0.0.1"); + // ((Connector.Argument) arguments.get("hostname")).setValue("localhost"); + // ((Connector.Argument) arguments.get("timeout")).setValue("5000"); - try - { - // PApplet.println(connector); - // PApplet.println(arguments); - // PApplet.println("attaching now..."); - //return connector.attach(arguments); - System.err.println("Attaching to the debugger. If this command hangs, "); - System.err.println("you may need to use Tools \u2192 " + Reset.MENU_TITLE - + "."); - final VirtualMachine machine = connector.attach(arguments); - System.err - .println("Debugger successfully attached, nevermind that last bit."); - // PApplet.println("attached"); - return machine; + try { + // PApplet.println(connector); + // PApplet.println(arguments); + // PApplet.println("attaching now..."); + //return connector.attach(arguments); + System.err.println("Attaching to the debugger. If this command hangs, "); + System.err.println("you may need to use Tools \u2192 " + Reset.MENU_TITLE + + "."); + final VirtualMachine machine = connector.attach(arguments); + System.err + .println("Debugger successfully attached, nevermind that last bit."); + // PApplet.println("attached"); + return machine; - } - catch (final IOException ioe) - { - //throw new Error("Unable to launch target VM: " + exc); - ioe.printStackTrace(); - editor.statusError(ioe); + } catch (final IOException ioe) { + //throw new Error("Unable to launch target VM: " + exc); + ioe.printStackTrace(); + editor.statusError(ioe); - } - catch (final IllegalConnectorArgumentsException icae) - { - //throw new Error("Internal error: " + exc); - editor.statusError(icae); - } - return null; - } + } catch (final IllegalConnectorArgumentsException icae) { + //throw new Error("Internal error: " + exc); + editor.statusError(icae); + } + return null; + } - /** - * Generate the trace. - * Enable events, start thread to display events, - * start threads to forward remote error and output streams, - * resume the remote VM, wait for the final event, and shutdown. - */ - @Override - protected void generateTrace(final PrintWriter writer) - { - vm.setDebugTraceMode(debugTraceMode); + /** + * Generate the trace. + * Enable events, start thread to display events, + * start threads to forward remote error and output streams, + * resume the remote VM, wait for the final event, and shutdown. + */ + @Override + protected void generateTrace(final PrintWriter writer) { + vm.setDebugTraceMode(debugTraceMode); - final EventThread eventThread = new EventThread(this, vm, excludes, writer); - eventThread.setEventRequests(watchFields); - eventThread.start(); + final EventThread eventThread = new EventThread(this, vm, excludes, writer); + eventThread.setEventRequests(watchFields); + eventThread.start(); - vm.resume(); - System.err.println("done with resume"); + vm.resume(); + System.err.println("done with resume"); - final Thread logcatter = new Thread(new Runnable() { - public void run() - { - try - { - new SketchLogCatter().start(); - System.err.println("logcatter exited normally"); - } - catch (final InterruptedException e) - { - System.err.println("logcat interrupted"); - } - catch (final Exception e) - { - throw new RuntimeException(e); - } - } - }, "logcatter"); - logcatter.start(); + final Thread logcatter = new Thread(new Runnable() { + public void run() { + try { + new SketchLogCatter().start(); + System.err.println("logcatter exited normally"); + } catch (final InterruptedException e) { + System.err.println("logcat interrupted"); + } catch (final Exception e) { + throw new RuntimeException(e); + } + } + }, "logcatter"); + logcatter.start(); - // Shutdown begins when event thread terminates - try - { - if (eventThread != null) - eventThread.join(); - logcatter.interrupt(); - // At this point, disable the run button. - // This happens when the sketch is exited by hitting ESC, - // or the user manually closes the sketch window. - // TODO this should be handled better, should it not? - if (editor != null) - editor.internalRunnerClosed(); + // Shutdown begins when event thread terminates + try { + if (eventThread != null) + eventThread.join(); + logcatter.interrupt(); + // At this point, disable the run button. + // This happens when the sketch is exited by hitting ESC, + // or the user manually closes the sketch window. + // TODO this should be handled better, should it not? + if (editor != null) + editor.internalRunnerClosed(); - } - catch (final InterruptedException exc) - { - // we don't interrupt - } - //System.out.println("and leaving"); - if (writer != null) - writer.close(); - } + } catch (final InterruptedException exc) { + // we don't interrupt + } + //System.out.println("and leaving"); + if (writer != null) + writer.close(); + } - /** - * Find a com.sun.jdi.CommandLineLaunch connector - */ - /* - LaunchingConnector findLaunchingConnector(String connectorName) { - //VirtualMachineManager mgr = Bootstrap.virtualMachineManager(); + /** + * Find a com.sun.jdi.CommandLineLaunch connector + */ + /* + LaunchingConnector findLaunchingConnector(String connectorName) { + //VirtualMachineManager mgr = Bootstrap.virtualMachineManager(); - // Get the default connector. - // Not useful here since they all need different args. - // System.out.println(Bootstrap.virtualMachineManager().defaultConnector()); - // return Bootstrap.virtualMachineManager().defaultConnector(); + // Get the default connector. + // Not useful here since they all need different args. + // System.out.println(Bootstrap.virtualMachineManager().defaultConnector()); + // return Bootstrap.virtualMachineManager().defaultConnector(); - List connectors = Bootstrap.virtualMachineManager().allConnectors(); + List connectors = Bootstrap.virtualMachineManager().allConnectors(); - // code to list available connectors - // Iterator iter2 = connectors.iterator(); - // while (iter2.hasNext()) { - // Connector connector = (Connector)iter2.next(); - // System.out.println("connector name is " + connector.name()); - // } + // code to list available connectors + // Iterator iter2 = connectors.iterator(); + // while (iter2.hasNext()) { + // Connector connector = (Connector)iter2.next(); + // System.out.println("connector name is " + connector.name()); + // } - Iterator iter = connectors.iterator(); - while (iter.hasNext()) { - Connector connector = (Connector)iter.next(); - if (connector.name().equals(connectorName)) { - return (LaunchingConnector)connector; - } - } - throw new Error("No launching connector"); - } - */ + Iterator iter = connectors.iterator(); + while (iter.hasNext()) { + Connector connector = (Connector)iter.next(); + if (connector.name().equals(connectorName)) { + return (LaunchingConnector)connector; + } + } + throw new Error("No launching connector"); + } + */ - @Override - public void exception(final ExceptionEvent event) - { - // System.out.println(event); - final ObjectReference or = event.exception(); - final ReferenceType rt = or.referenceType(); - final String exceptionName = rt.name(); - //Field messageField = Throwable.class.getField("detailMessage"); - final Field messageField = rt.fieldByName("detailMessage"); - // System.out.println("field " + messageField); - final Value messageValue = or.getValue(messageField); - // System.out.println("mess val " + messageValue); + @Override + public void exception(final ExceptionEvent event) { + // System.out.println(event); + final ObjectReference or = event.exception(); + final ReferenceType rt = or.referenceType(); + final String exceptionName = rt.name(); + //Field messageField = Throwable.class.getField("detailMessage"); + final Field messageField = rt.fieldByName("detailMessage"); + // System.out.println("field " + messageField); + final Value messageValue = or.getValue(messageField); + // System.out.println("mess val " + messageValue); - final int last = exceptionName.lastIndexOf('.'); - String message = exceptionName.substring(last + 1); - if (messageValue != null) - { - String messageStr = messageValue.toString(); - if (messageStr.startsWith("\"")) - messageStr = messageStr.substring(1, messageStr.length() - 1); - message += ": " + messageStr; - } - // System.out.println("mess type " + messageValue.type()); - //StringReference messageReference = (StringReference) messageValue.type(); - // System.out.println(or.referenceType().fields()); + final int last = exceptionName.lastIndexOf('.'); + String message = exceptionName.substring(last + 1); + if (messageValue != null) { + String messageStr = messageValue.toString(); + if (messageStr.startsWith("\"")) + messageStr = messageStr.substring(1, messageStr.length() - 1); + message += ": " + messageStr; + } + // System.out.println("mess type " + messageValue.type()); + //StringReference messageReference = (StringReference) messageValue.type(); + // System.out.println(or.referenceType().fields()); - reportException(message, event.thread()); + reportException(message, event.thread()); - if (editor != null) - editor.internalRunnerClosed(); - } + if (editor != null) + editor.internalRunnerClosed(); + } - // This may be called more than one time per error in the VM, - // presumably because exceptions might be wrapped inside others, - // and this will fire for both. - /* - protected void reportException(String message, ThreadReference thread) { - try { - Sketch sketch = editor.getSketch(); - - // a bit for debugging - // for (StackFrame frame : thread.frames()) { - // System.out.println("frame: " + frame); - // } + // This may be called more than one time per error in the VM, + // presumably because exceptions might be wrapped inside others, + // and this will fire for both. + /* + protected void reportException(String message, ThreadReference thread) { + try { + Sketch sketch = editor.getSketch(); + + // a bit for debugging + // for (StackFrame frame : thread.frames()) { + // System.out.println("frame: " + frame); + // } - List frames = thread.frames(); - for (StackFrame frame : frames) { - // System.out.println("frame: " + frame); - Location location = frame.location(); - String filename = null; - filename = location.sourceName(); - int lineNumber = location.lineNumber() - 1; - RunnerException rex = - sketch.placeException(message, filename, lineNumber); - if (rex != null) { - listener.statusError(rex); - return; - } - } - // Give up, nothing found inside the pile of stack frames - listener.statusError(message); + List frames = thread.frames(); + for (StackFrame frame : frames) { + // System.out.println("frame: " + frame); + Location location = frame.location(); + String filename = null; + filename = location.sourceName(); + int lineNumber = location.lineNumber() - 1; + RunnerException rex = + sketch.placeException(message, filename, lineNumber); + if (rex != null) { + listener.statusError(rex); + return; + } + } + // Give up, nothing found inside the pile of stack frames + listener.statusError(message); - } catch (AbsentInformationException e) { - // Any of the thread.blah() methods can throw an AbsentInformationEx - // if that bit of data is missing. If so, just write out the error - // message to the console. - //e.printStackTrace(); // not useful - exception = new RunnerException(message); - exception.hideStackTrace(); - listener.statusError(exception); + } catch (AbsentInformationException e) { + // Any of the thread.blah() methods can throw an AbsentInformationEx + // if that bit of data is missing. If so, just write out the error + // message to the console. + //e.printStackTrace(); // not useful + exception = new RunnerException(message); + exception.hideStackTrace(); + listener.statusError(exception); - } catch (IncompatibleThreadStateException e) { - e.printStackTrace(); - } - } - */ + } catch (IncompatibleThreadStateException e) { + e.printStackTrace(); + } + } + */ - /* - public void close() { - // TODO make sure stop() has already been called to exit the sketch + /* + public void close() { + // TODO make sure stop() has already been called to exit the sketch - // TODO actually kill off the vm here - if (vm != null) { - try { - vm.exit(0); + // TODO actually kill off the vm here + if (vm != null) { + try { + vm.exit(0); - } catch (com.sun.jdi.VMDisconnectedException vmde) { - // if the vm has disconnected on its own, ignore message - //System.out.println("harmless disconnect " + vmde.getMessage()); - // TODO shouldn't need to do this, need to do more cleanup - } - vm = null; - } - } - */ + } catch (com.sun.jdi.VMDisconnectedException vmde) { + // if the vm has disconnected on its own, ignore message + //System.out.println("harmless disconnect " + vmde.getMessage()); + // TODO shouldn't need to do this, need to do more cleanup + } + vm = null; + } + } + */ - // made synchronized for rev 87 - // attempted to remove synchronized for 0136 to fix bug #775 (no luck tho) - // http://dev.processing.org/bugs/show_bug.cgi?id=775 - /* - synchronized public void message(String s) { - //System.out.println("M" + s.length() + ":" + s.trim()); // + "MMM" + s.length()); + // made synchronized for rev 87 + // attempted to remove synchronized for 0136 to fix bug #775 (no luck tho) + // http://dev.processing.org/bugs/show_bug.cgi?id=775 + /* + synchronized public void message(String s) { + //System.out.println("M" + s.length() + ":" + s.trim()); // + "MMM" + s.length()); - // this eats the CRLFs on the lines.. oops.. do it later - //if (s.trim().length() == 0) return; + // this eats the CRLFs on the lines.. oops.. do it later + //if (s.trim().length() == 0) return; - // this is PApplet sending a message (via System.out.println) - // that signals that the applet has been quit. - if (s.indexOf(PApplet.EXTERNAL_STOP) == 0) { - //System.out.println("external: quit"); - if (editor != null) { - //editor.internalCloseRunner(); // [091124] - editor.handleStop(); - } - return; - } + // this is PApplet sending a message (via System.out.println) + // that signals that the applet has been quit. + if (s.indexOf(PApplet.EXTERNAL_STOP) == 0) { + //System.out.println("external: quit"); + if (editor != null) { + //editor.internalCloseRunner(); // [091124] + editor.handleStop(); + } + return; + } - // this is the PApplet sending us a message that the applet - // is being moved to a new window location - if (s.indexOf(PApplet.EXTERNAL_MOVE) == 0) { - String nums = s.substring(s.indexOf(' ') + 1).trim(); - int space = nums.indexOf(' '); - int left = Integer.parseInt(nums.substring(0, space)); - int top = Integer.parseInt(nums.substring(space + 1)); - // this is only fired when connected to an editor - editor.setSketchLocation(new Point(left, top)); - //System.out.println("external: move to " + left + " " + top); - return; - } + // this is the PApplet sending us a message that the applet + // is being moved to a new window location + if (s.indexOf(PApplet.EXTERNAL_MOVE) == 0) { + String nums = s.substring(s.indexOf(' ') + 1).trim(); + int space = nums.indexOf(' '); + int left = Integer.parseInt(nums.substring(0, space)); + int top = Integer.parseInt(nums.substring(space + 1)); + // this is only fired when connected to an editor + editor.setSketchLocation(new Point(left, top)); + //System.out.println("external: move to " + left + " " + top); + return; + } - // Removed while doing cleaning for 0145, - // it seems that this is never actually printed out. - // this is PApplet sending a message saying "i'm about to spew - // a stack trace because an error occurred during PApplet.run()" - // if (s.indexOf(PApplet.LEECH_WAKEUP) == 0) { - // // newMessage being set to 'true' means that the next time - // // message() is called, expect the first line of the actual - // // error message & stack trace to be sent from the applet. - // newMessage = true; - // return; // this line ignored - // } + // Removed while doing cleaning for 0145, + // it seems that this is never actually printed out. + // this is PApplet sending a message saying "i'm about to spew + // a stack trace because an error occurred during PApplet.run()" + // if (s.indexOf(PApplet.LEECH_WAKEUP) == 0) { + // // newMessage being set to 'true' means that the next time + // // message() is called, expect the first line of the actual + // // error message & stack trace to be sent from the applet. + // newMessage = true; + // return; // this line ignored + // } - // these are used for debugging, in case there are concerns - // that some errors aren't coming through properly - // if (s.length() > 2) { - // System.err.println(newMessage); - // System.err.println("message " + s.length() + ":" + s); - // } - // always shove out the mesage, since it might not fall under - // the same setup as we're expecting - System.err.print(s); - //System.err.println("[" + s.length() + "] " + s); - System.err.flush(); - } - */ + // these are used for debugging, in case there are concerns + // that some errors aren't coming through properly + // if (s.length() > 2) { + // System.err.println(newMessage); + // System.err.println("message " + s.length() + ":" + s); + // } + // always shove out the mesage, since it might not fall under + // the same setup as we're expecting + System.err.print(s); + //System.err.println("[" + s.length() + "] " + s); + System.err.flush(); + } + */ } diff --git a/android/tool/src/processing/app/tools/android/Reset.java b/android/tool/src/processing/app/tools/android/Reset.java index 706895457..6871a4846 100644 --- a/android/tool/src/processing/app/tools/android/Reset.java +++ b/android/tool/src/processing/app/tools/android/Reset.java @@ -22,7 +22,6 @@ package processing.app.tools.android; import javax.swing.JOptionPane; - import processing.app.Editor; import processing.app.tools.Tool;