diff --git a/app/PdeBase.java b/app/PdeBase.java index 0e564abb3..ec7de81ef 100644 --- a/app/PdeBase.java +++ b/app/PdeBase.java @@ -1,8 +1,12 @@ /* -*- mode: jde; c-basic-offset: 2; indent-tabs-mode: nil -*- */ /* - Part of the Processing project - Copyright (c) 2001-03 Ben Fry and Casey Reas + PdeBase - base class for the main processing application + Part of the Processing project - http://Proce55ing.net + + Copyright (c) 2001-03 + Ben Fry, Massachusetts Institute of Technology and + Casey Reas, Interaction Design Institute Ivrea This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,6 +17,10 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ import java.awt.*; diff --git a/app/PdeCompiler.java b/app/PdeCompiler.java index 198e70cb6..97baf6965 100644 --- a/app/PdeCompiler.java +++ b/app/PdeCompiler.java @@ -1,9 +1,31 @@ -// -*- Mode: JDE; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- +/* -*- mode: jde; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* + PdeCompiler - default compiler class that connects to jikes + Part of the Processing project - http://Proce55ing.net + + Copyright (c) 2001-03 + Ben Fry, Massachusetts Institute of Technology and + Casey Reas, Interaction Design Institute Ivrea + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ import java.io.*; -// This class will be the new default of Jikes. -// + public class PdeCompiler implements PdeMessageConsumer{ String buildPath; diff --git a/app/PdeCompilerKjc.java b/app/PdeCompilerKjc.java index 6c44373b7..c2a37333a 100644 --- a/app/PdeCompilerKjc.java +++ b/app/PdeCompilerKjc.java @@ -1,6 +1,27 @@ -// -*- Mode: JDE; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- +/* -*- mode: jde; c-basic-offset: 2; indent-tabs-mode: nil -*- */ -// The existing Kjc code lives here, and can someday go away. +/* + PdeCompilerKjc - compiler interface to kjc.. someday this will go away + Part of the Processing project - http://Proce55ing.net + + Copyright (c) 2001-03 + Ben Fry, Massachusetts Institute of Technology and + Casey Reas, Interaction Design Institute Ivrea + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ import java.io.*; diff --git a/app/PdeEditor.java b/app/PdeEditor.java index 9358057a2..bb806ec46 100644 --- a/app/PdeEditor.java +++ b/app/PdeEditor.java @@ -1,4 +1,27 @@ -// -*- Mode: JDE; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- +/* -*- mode: jde; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* + PdeEditor - main editor panel for the processing ide + Part of the Processing project - http://Proce55ing.net + + Copyright (c) 2001-03 + Ben Fry, Massachusetts Institute of Technology and + Casey Reas, Interaction Design Institute Ivrea + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ import java.awt.*; import java.awt.event.*; diff --git a/app/PdeEditorButtons.java b/app/PdeEditorButtons.java index 6cff06218..99664b875 100644 --- a/app/PdeEditorButtons.java +++ b/app/PdeEditorButtons.java @@ -1,8 +1,30 @@ +/* -*- mode: jde; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* + PdeEditorButtons - run/stop/etc buttons for the ide + Part of the Processing project - http://Proce55ing.net + + Copyright (c) 2001-03 + Ben Fry, Massachusetts Institute of Technology and + Casey Reas, Interaction Design Institute Ivrea + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + import java.awt.*; import java.awt.event.MouseEvent; - -//import java.awt.Image; - import javax.swing.*; import javax.swing.event.*; diff --git a/app/PdeEditorConsole.java b/app/PdeEditorConsole.java index 8fc14c952..f7d681dc9 100644 --- a/app/PdeEditorConsole.java +++ b/app/PdeEditorConsole.java @@ -1,3 +1,28 @@ +/* -*- mode: jde; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* + PdeEditorConsole - message console that sits below the program area + Part of the Processing project - http://Proce55ing.net + + Copyright (c) 2001-03 + Ben Fry, Massachusetts Institute of Technology and + Casey Reas, Interaction Design Institute Ivrea + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + import java.awt.*; import java.awt.event.*; import java.io.*; @@ -5,8 +30,6 @@ import javax.swing.*; import javax.swing.text.*; -// might be nice to have option to save this to a file - // debugging this class is tricky.. if it's throwing // exceptions, don't take over System.err, and debug // while watching just System.out diff --git a/app/PdeEditorHeader.java b/app/PdeEditorHeader.java index 679d076f0..ec5ba16df 100644 --- a/app/PdeEditorHeader.java +++ b/app/PdeEditorHeader.java @@ -1,16 +1,32 @@ +/* -*- mode: jde; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* + PdeEditorHeader - panel that containing the sketch title + Part of the Processing project - http://Proce55ing.net + + Copyright (c) 2001-03 + Ben Fry, Massachusetts Institute of Technology and + Casey Reas, Interaction Design Institute Ivrea + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + import java.awt.*; import java.awt.event.*; import java.io.*; - /* - PdeEditorLabel sketchLabel = new PdeEditorLabel(1); - Color sketchBgColor = new Color(51, 51, 51); - Color sketchPrimaryTextColor = Color.white; - Color sketchSecondaryTextColor = new Color(153, 153, 153); - sketchLabel.setForeground(sketchPrimaryTextColor); - sketchLabel.setBackground(sketchBgColor); - rightPanel.add("North", sketchLabel); - */ public class PdeEditorHeader extends Panel /* implements ActionListener*/ { static final String SKETCH_TITLER = "sketch"; diff --git a/app/PdeEditorStatus.java b/app/PdeEditorStatus.java index 62eeaaf81..fd05757dd 100644 --- a/app/PdeEditorStatus.java +++ b/app/PdeEditorStatus.java @@ -1,3 +1,28 @@ +/* -*- mode: jde; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* + PdeEditorStatus - panel containing status messages + Part of the Processing project - http://Proce55ing.net + + Copyright (c) 2001-03 + Ben Fry, Massachusetts Institute of Technology and + Casey Reas, Interaction Design Institute Ivrea + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + import java.awt.*; import java.awt.event.*; diff --git a/app/PdeEngine.java b/app/PdeEngine.java index 4c1c06730..af6aac395 100644 --- a/app/PdeEngine.java +++ b/app/PdeEngine.java @@ -1,3 +1,28 @@ +/* -*- mode: jde; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* + PdeEngine - can this guy go away? + Part of the Processing project - http://Proce55ing.net + + Copyright (c) 2001-03 + Ben Fry, Massachusetts Institute of Technology and + Casey Reas, Interaction Design Institute Ivrea + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + import java.awt.*; diff --git a/app/PdeMessageConsumer.java b/app/PdeMessageConsumer.java index fc27c5e11..23330b513 100644 --- a/app/PdeMessageConsumer.java +++ b/app/PdeMessageConsumer.java @@ -1,4 +1,27 @@ -// -*- Mode: JDE; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- +/* -*- mode: jde; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* + PdeMessageConsumer - interface for dealing with parser/compiler output + Part of the Processing project - http://Proce55ing.net + + Copyright (c) 2001-03 + Ben Fry, Massachusetts Institute of Technology and + Casey Reas, Interaction Design Institute Ivrea + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ // Different instances of PdeMessageStream need to do different things with // messages. In particular, a stream instance used for parsing output from diff --git a/app/PdeMessageSiphon.java b/app/PdeMessageSiphon.java index d2259dc6e..1ac1fd19c 100644 --- a/app/PdeMessageSiphon.java +++ b/app/PdeMessageSiphon.java @@ -1,7 +1,31 @@ -/// -*- Mode: JDE; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- +/* -*- mode: jde; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* + PdeMessageSiphon - slurps up messages from compiler + Part of the Processing project - http://Proce55ing.net + + Copyright (c) 2001-03 + Ben Fry, Massachusetts Institute of Technology and + Casey Reas, Interaction Design Institute Ivrea + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ import java.io.*; + class PdeMessageSiphon implements Runnable { BufferedReader streamReader; Thread thread; diff --git a/app/PdeMessageStream.java b/app/PdeMessageStream.java index 13157465e..f83ec1e8e 100644 --- a/app/PdeMessageStream.java +++ b/app/PdeMessageStream.java @@ -1,7 +1,31 @@ -// -*- Mode: JDE; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- +/* -*- mode: jde; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* + PdeMessageStream - outputstream to handle stdout/stderr messages + Part of the Processing project - http://Proce55ing.net + + Copyright (c) 2001-03 + Ben Fry, Massachusetts Institute of Technology and + Casey Reas, Interaction Design Institute Ivrea + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ import java.io.*; + class PdeMessageStream extends OutputStream { PdeEditor editor; diff --git a/app/PdePreprocessor.java b/app/PdePreprocessor.java index d160f7993..a568cc635 100644 --- a/app/PdePreprocessor.java +++ b/app/PdePreprocessor.java @@ -1,5 +1,28 @@ -// This class will be the new CUP-generated preprocessor. -// +/* -*- mode: jde; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* + PdePreprocessor - default cup-generated parser (not yet implemented) + Part of the Processing project - http://Proce55ing.net + + Copyright (c) 2001-03 + Ben Fry, Massachusetts Institute of Technology and + Casey Reas, Interaction Design Institute Ivrea + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + public class PdePreprocessor { public PdePreprocessor() { diff --git a/app/PdePreprocessorOro.java b/app/PdePreprocessorOro.java index f22f6936c..95cd7849f 100644 --- a/app/PdePreprocessorOro.java +++ b/app/PdePreprocessorOro.java @@ -1,11 +1,32 @@ -// -*- Mode: JDE; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- +/* -*- mode: jde; c-basic-offset: 2; indent-tabs-mode: nil -*- */ -// The existing ORO-based preprocessing code lives here, and can -// someday go away. +/* + PdePreprocessorOro - current oro-based preprocessor (soon to be gone) + Part of the Processing project - http://Proce55ing.net + + Copyright (c) 2001-03 + Ben Fry, Massachusetts Institute of Technology and + Casey Reas, Interaction Design Institute Ivrea + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ import com.oroinc.text.regex.*; import java.io.*; + public class PdePreprocessorOro extends PdePreprocessor { //static final String EXTENDS = "extends BApplet "; //static final String EXTENDS_KJC = "extends KjcApplet "; diff --git a/app/PdeRuntime.java b/app/PdeRuntime.java index abca038c8..3d3488f71 100644 --- a/app/PdeRuntime.java +++ b/app/PdeRuntime.java @@ -1,11 +1,33 @@ -// -*- Mode: JDE; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- +/* -*- mode: jde; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* + PdeRuntime - runs compiled java applet + Part of the Processing project - http://Proce55ing.net + + Copyright (c) 2001-03 + Ben Fry, Massachusetts Institute of Technology and + Casey Reas, Interaction Design Institute Ivrea + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ import java.awt.*; // for window import java.awt.event.*; // also for window import java.io.*; -// Runs the compiled java applet. -// + public class PdeRuntime implements PdeMessageConsumer { Process process; diff --git a/app/PdeUpdater.java b/app/PdeUpdater.java index 9c660f501..676ef4b2f 100644 --- a/app/PdeUpdater.java +++ b/app/PdeUpdater.java @@ -1,3 +1,28 @@ +/* -*- mode: jde; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* + PdeUpdater - self-updater code.. when was the last this worked? + Part of the Processing project - http://Proce55ing.net + + Copyright (c) 2001-03 + Ben Fry, Massachusetts Institute of Technology and + Casey Reas, Interaction Design Institute Ivrea + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + import java.io.*; import java.net.*; import java.util.*; @@ -18,7 +43,7 @@ public class PdeUpdater { // this is a separate updater application boolean updateEnabled = true; //(new Boolean(properties.getProperty("update.enabled", - // "false"))).booleanValue(); + // "false"))).booleanValue(); // check for updates from the server, if enabled //if (getBoolean("update.enabled", false)) { @@ -26,97 +51,97 @@ public class PdeUpdater { // open the update file to get the latest version long lastUpdate = 0; try { - DataInputStream dis = - new DataInputStream(new FileInputStream("lib/version")); - lastUpdate = dis.readLong(); - //System.out.println("pde.jar timestamp is " + lastUpdate); + DataInputStream dis = + new DataInputStream(new FileInputStream("lib/version")); + lastUpdate = dis.readLong(); + //System.out.println("pde.jar timestamp is " + lastUpdate); } catch (IOException e) { } //String baseUrl = get("update.url"); String baseUrl = properties.getProperty("update.url"); try { - URL url = new URL(baseUrl + "version"); - URLConnection conn = url.openConnection(); - //conn.connect(); + URL url = new URL(baseUrl + "version"); + URLConnection conn = url.openConnection(); + //conn.connect(); - //System.out.println("date of last update" + conn.getDate()); - long newDate = conn.getLastModified(); - //System.out.println("server timestamp is " + newDate); - //System.out.println((newDate - lastUpdate) + "ms newer"); - if (newDate > lastUpdate) { - System.out.println("new update available"); + //System.out.println("date of last update" + conn.getDate()); + long newDate = conn.getLastModified(); + //System.out.println("server timestamp is " + newDate); + //System.out.println((newDate - lastUpdate) + "ms newer"); + if (newDate > lastUpdate) { + System.out.println("new update available"); - DataOutputStream vos = - new DataOutputStream(new FileOutputStream("lib/version")); - //new DataOutputStream(new FileOutputStream("lib/version.update")); - vos.writeLong(newDate); - vos.flush(); - vos.close(); + DataOutputStream vos = + new DataOutputStream(new FileOutputStream("lib/version")); + //new DataOutputStream(new FileOutputStream("lib/version.update")); + vos.writeLong(newDate); + vos.flush(); + vos.close(); - url = new URL(baseUrl + "pde.jar"); - conn = url.openConnection(); + url = new URL(baseUrl + "pde.jar"); + conn = url.openConnection(); - // move the old pde.jar file out of the way - //File pdeJar = new File("lib/pde.jar"); - //pdeJar.renameTo("lib/pde.old.jar"); + // move the old pde.jar file out of the way + //File pdeJar = new File("lib/pde.jar"); + //pdeJar.renameTo("lib/pde.old.jar"); - // download the new pde.jar file - //FileOutputStream os = new FileOutputStream("lib/pde.jar.update"); - FileOutputStream os = new FileOutputStream("lib/pde.jar"); - //Object object = conn.getContent(); - //System.out.println(object); - InputStream is = conn.getInputStream(); - copyStream(is, os); - os.close(); + // download the new pde.jar file + //FileOutputStream os = new FileOutputStream("lib/pde.jar.update"); + FileOutputStream os = new FileOutputStream("lib/pde.jar"); + //Object object = conn.getContent(); + //System.out.println(object); + InputStream is = conn.getInputStream(); + copyStream(is, os); + os.close(); - // if everything copied ok, rename new/old files - // this probably needs to be way more bulletproof - /* - File file = new File("lib/version"); - if (file.exists()) - System.out.println(file.renameTo(new File("lib/version.old"))); - file = new File("lib/version.update"); - System.out.println(file.renameTo(new File("lib/version"))); + // if everything copied ok, rename new/old files + // this probably needs to be way more bulletproof + /* + File file = new File("lib/version"); + if (file.exists()) + System.out.println(file.renameTo(new File("lib/version.old"))); + file = new File("lib/version.update"); + System.out.println(file.renameTo(new File("lib/version"))); - file = new File("lib/pde.jar"); - file.delete(); - //System.out.println(file.renameTo(new File("lib/pde.jar.old"))); - file = new File("lib/pde.jar.update"); - System.out.println(file.renameTo(new File("lib/pde.jar"))); - */ + file = new File("lib/pde.jar"); + file.delete(); + //System.out.println(file.renameTo(new File("lib/pde.jar.old"))); + file = new File("lib/pde.jar.update"); + System.out.println(file.renameTo(new File("lib/pde.jar"))); + */ - // restart or relaunch - //System.out.println("done copying new version, restart"); - //System.exit(0); + // restart or relaunch + //System.out.println("done copying new version, restart"); + //System.exit(0); - } + } - /* - try { - Class c = Class.forName("PdeApplication"); - Object o = c.newInstance(); - //PdeApplication.main(null); - } catch (Exception e) { - System.err.println("update failed"); - e.printStackTrace(); - } - */ - // mac mrj is not smart enough to exit the applicaiton here - System.exit(0); + /* + try { + Class c = Class.forName("PdeApplication"); + Object o = c.newInstance(); + //PdeApplication.main(null); + } catch (Exception e) { + System.err.println("update failed"); + e.printStackTrace(); + } + */ + // mac mrj is not smart enough to exit the applicaiton here + System.exit(0); } catch (IOException e1) { - e1.printStackTrace(); + e1.printStackTrace(); - //} catch (MalformedURLException e2) { - //e2.printStackTrace(); + //} catch (MalformedURLException e2) { + //e2.printStackTrace(); } } } static public void copyStream(InputStream input, OutputStream output - /*int padding, long length*/) + /*int padding, long length*/) throws IOException { byte[] buffer = new byte[4096]; int count; @@ -138,12 +163,12 @@ public class PdeUpdater { count = input.read(buffer, 0, amount); //System.out.println("got " + count); if (count == -1) - break; + break; output.write(buffer, 0, count); - length -= count; // used to be amount... bug? + length -= count; // used to be amount... bug? if (length == 0) - break; + break; } output.flush(); }