From e54c669614a5585943a6fcdd322255dea4cff0eb Mon Sep 17 00:00:00 2001 From: Ben Fry Date: Tue, 12 May 2015 09:25:24 -0400 Subject: [PATCH] clean up accessors, language handling bugs, debugger weirdness --- app/src/processing/app/Base.java | 8 +- app/src/processing/app/Editor.java | 47 ++++++++--- app/src/processing/app/Language.java | 59 ++++++++------ app/src/processing/app/Recent.java | 13 ++-- .../app/contrib/ContributionListing.java | 2 +- .../app/contrib/ContributionManager.java | 17 ++-- .../contrib/ContributionManagerDialog.java | 7 +- .../app/contrib/ContributionType.java | 78 +++++++++---------- .../app/contrib/ExamplesContribution.java | 10 ++- .../app/contrib/ModeContribution.java | 19 ++--- .../app/contrib/ToolContribution.java | 10 +-- build/shared/lib/languages/PDE.properties | 1 + core/todo.txt | 2 + java/src/processing/mode/java/JavaEditor.java | 8 +- 14 files changed, 162 insertions(+), 119 deletions(-) diff --git a/app/src/processing/app/Base.java b/app/src/processing/app/Base.java index 49d551061..f8704cb17 100644 --- a/app/src/processing/app/Base.java +++ b/app/src/processing/app/Base.java @@ -120,8 +120,8 @@ public class Base { /** The built-in modes. coreModes[0] will be considered the 'default'. */ private Mode[] coreModes; - protected ArrayList modeContribs; + protected ArrayList modeContribs; protected ArrayList exampleContribs; private JMenu sketchbookMenu; @@ -492,12 +492,12 @@ public class Base { } - public ArrayList getModeContribs() { + public List getModeContribs() { return modeContribs; } - public ArrayList getModeList() { + public List getModeList() { ArrayList allModes = new ArrayList(); allModes.addAll(Arrays.asList(coreModes)); if (modeContribs != null) { @@ -509,7 +509,7 @@ public class Base { } - public ArrayList getExampleContribs() { + public List getExampleContribs() { return exampleContribs; } diff --git a/app/src/processing/app/Editor.java b/app/src/processing/app/Editor.java index 1710278f8..24d3c3b6f 100644 --- a/app/src/processing/app/Editor.java +++ b/app/src/processing/app/Editor.java @@ -3,7 +3,7 @@ /* Part of the Processing project - http://processing.org - Copyright (c) 2012-14 The Processing Foundation + Copyright (c) 2012-15 The Processing Foundation Copyright (c) 2004-12 Ben Fry and Casey Reas Copyright (c) 2001-04 Massachusetts Institute of Technology @@ -28,14 +28,29 @@ import processing.app.syntax.*; import processing.app.tools.*; import processing.core.*; -import java.awt.*; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.EventQueue; +import java.awt.Frame; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Image; +import java.awt.Point; +import java.awt.RenderingHints; import java.awt.datatransfer.*; import java.awt.event.*; import java.awt.print.*; import java.io.*; -import java.util.*; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; import java.util.List; +import java.util.Map; +import java.util.Stack; import java.util.Timer; +import java.util.TimerTask; import javax.swing.*; import javax.swing.event.*; @@ -43,6 +58,7 @@ import javax.swing.plaf.basic.*; import javax.swing.text.*; import javax.swing.undo.*; + /** * Main editor panel for the Processing Development Environment. */ @@ -117,8 +133,8 @@ public abstract class Editor extends JFrame implements RunnerListener { JMenu toolsMenu; JMenu modeMenu; - ArrayList coreTools; - public ArrayList contribTools; + List coreTools; + List contribTools; Image backgroundGradient; @@ -365,11 +381,21 @@ public abstract class Editor extends JFrame implements RunnerListener { } - protected ArrayList getCoreTools() { + protected List getCoreTools() { return coreTools; } + public List getToolContribs() { + return contribTools; + } + + + public void removeToolContrib(ToolContribution tc) { + contribTools.remove(tc); + } + + /** * Broken out to get modes working for GSOC, but this needs a longer-term * solution where the listeners are handled properly. @@ -437,6 +463,7 @@ public abstract class Editor extends JFrame implements RunnerListener { @SuppressWarnings("unchecked") public boolean importData(TransferHandler.TransferSupport support) { + System.out.println(support.getTransferable()); int successful = 0; if (!canImport(support)) { @@ -449,7 +476,7 @@ public abstract class Editor extends JFrame implements RunnerListener { new DataFlavor("text/uri-list;class=java.lang.String"); if (transferable.isDataFlavorSupported(DataFlavor.javaFileListFlavor)) { - java.util.List list = (java.util.List) + List list = (List) transferable.getTransferData(DataFlavor.javaFileListFlavor); for (int i = 0; i < list.size(); i++) { File file = (File) list.get(i); @@ -1192,7 +1219,7 @@ public abstract class Editor extends JFrame implements RunnerListener { // } - void addToolItem(final Tool tool, HashMap toolItems) { + void addToolItem(final Tool tool, Map toolItems) { String title = tool.getMenuTitle(); final JMenuItem item = new JMenuItem(title); item.addActionListener(new ActionListener() { @@ -1220,8 +1247,8 @@ public abstract class Editor extends JFrame implements RunnerListener { } - protected void addTools(JMenu menu, ArrayList tools) { - HashMap toolItems = new HashMap(); + protected void addTools(JMenu menu, List tools) { + Map toolItems = new HashMap(); for (final ToolContribution tool : tools) { try { diff --git a/app/src/processing/app/Language.java b/app/src/processing/app/Language.java index f6c6a9391..31ec300f9 100644 --- a/app/src/processing/app/Language.java +++ b/app/src/processing/app/Language.java @@ -31,9 +31,6 @@ import processing.core.PApplet; * Internationalization (i18n) */ public class Language { -// static private final String FILE = "processing.app.languages.PDE"; - //static private final String LISTING = "processing/app/languages/languages.txt"; - // Store the language information in a file separate from the preferences, // because preferences need the language on load time. static protected final String PREF_FILE = "language.txt"; @@ -48,8 +45,6 @@ public class Language { /** Available languages */ private HashMap languages; - //private ResourceBundle bundle; - //private Settings bundle; private LanguageBundle bundle; @@ -159,7 +154,7 @@ public class Language { /** Singleton constructor */ static public Language init() { if (instance == null) { - synchronized(Language.class) { + synchronized (Language.class) { if (instance == null) { instance = new Language(); } @@ -169,35 +164,49 @@ public class Language { } - /** Get translation from bundles. */ - static public String text(String text) { -// ResourceBundle bundle = init().bundle; + static private String get(String key) { LanguageBundle bundle = init().bundle; try { - return bundle.getString(text); - } catch (MissingResourceException e) { - return text; - } + String value = bundle.getString(key); + if (value != null) { + return value; + } + } catch (MissingResourceException e) { } + + return null; } - static public String interpolate(String text, Object... arguments) { -// return String.format(init().bundle.getString(text), arguments); - return String.format(init().bundle.getString(text), arguments); + /** Get translation from bundles. */ + static public String text(String key) { + String value = get(key); + if (value == null) { + // MissingResourceException and null values + return key; + } + return value; } - static public String pluralize(String text, int count) { -// ResourceBundle bundle = init().bundle; - LanguageBundle bundle = init().bundle; - - String fmt = text + ".%s"; - String key = String.format(fmt, count); - if (bundle.containsKey(key)) { - return interpolate(key, count); + static public String interpolate(String key, Object... arguments) { + String value = get(key); + if (value == null) { + return key; } - return interpolate(String.format(fmt, "n"), count); + return String.format(value, arguments); + } + + + static public String pluralize(String key, int count) { + // First check if the bundle contains an entry for this specific count + String customKey = key + "." + count; + String value = get(customKey); + if (value != null) { + return String.format(value, count); + } + // Use the general 'n' version for n items + return interpolate(key + ".n", count); } diff --git a/app/src/processing/app/Recent.java b/app/src/processing/app/Recent.java index 2600544f4..176a6e86f 100644 --- a/app/src/processing/app/Recent.java +++ b/app/src/processing/app/Recent.java @@ -24,6 +24,7 @@ package processing.app; import java.awt.event.*; import java.io.*; import java.util.ArrayList; +import java.util.List; import javax.swing.*; @@ -124,18 +125,18 @@ public class Recent { updateMenuRecord(menu, rec, sketchbookPath); } } - - + + private void updateMenuRecord(JMenu menu, final Record rec, String sketchbookPath) { try { String recPath = new File(rec.getPath()).getParent(); String purtyPath = null; - + if (recPath.startsWith(sketchbookPath)) { purtyPath = "sketchbook \u2192 " + recPath.substring(sketchbookPath.length() + 1); } else { - ArrayList modes = base.getModeList(); + List modes = base.getModeList(); for (Mode mode : modes) { File examplesFolder = mode.getExamplesFolder(); String examplesPath = examplesFolder.getAbsolutePath(); @@ -206,7 +207,7 @@ public class Recent { }); //menu.add(item); menu.insert(item, 0); - + } catch (Exception e) { // Strange things can happen... report them for the geeky and move on: // https://github.com/processing/processing/issues/2463 @@ -282,7 +283,7 @@ public class Recent { } } -//handles renaming done within processing +//handles renaming done within processing synchronized void handleRename(Editor editor,String oldPath){ if (records.size() == remember) { records.remove(0); // remove the first entry diff --git a/app/src/processing/app/contrib/ContributionListing.java b/app/src/processing/app/contrib/ContributionListing.java index c8ed71ed5..7f50575de 100644 --- a/app/src/processing/app/contrib/ContributionListing.java +++ b/app/src/processing/app/contrib/ContributionListing.java @@ -445,7 +445,7 @@ public class ContributionListing { for (Library l : base.getActiveEditor().getMode().contribLibraries) if (hasUpdates(l)) return true; - for (ToolContribution t : base.getActiveEditor().contribTools) + for (ToolContribution t : base.getActiveEditor().getToolContribs()) if (hasUpdates(t)) return true; return false; diff --git a/app/src/processing/app/contrib/ContributionManager.java b/app/src/processing/app/contrib/ContributionManager.java index b6b467b76..c2b1f5163 100644 --- a/app/src/processing/app/contrib/ContributionManager.java +++ b/app/src/processing/app/contrib/ContributionManager.java @@ -154,7 +154,7 @@ public class ContributionManager { if (contribution != null) { contribListing.replaceContribution(ad, contribution); if (contribution.getType() == ContributionType.MODE) { - ArrayList contribModes = editor.getBase().getModeContribs(); + List contribModes = editor.getBase().getModeContribs(); if (!contribModes.contains(contribution)) { contribModes.add((ModeContribution) contribution); } @@ -200,9 +200,9 @@ public class ContributionManager { /** * Non-blocking call to download and install a contribution in a new thread. * Used when information about the progress of the download and install - * procedure is not of importance, such as if a contribution has to be + * procedure is not of importance, such as if a contribution has to be * installed at startup time. - * + * * @param url * Direct link to the contribution. * @param ad @@ -228,8 +228,7 @@ public class ContributionManager { if (contribution != null) { contribListing.replaceContribution(ad, contribution); if (contribution.getType() == ContributionType.MODE) { - ArrayList contribModes = base - .getModeContribs(); + List contribModes = base.getModeContribs(); if (contribModes != null && !contribModes.contains(contribution)) { contribModes.add((ModeContribution) contribution); } @@ -316,7 +315,7 @@ public class ContributionManager { ArrayList installedLibList = new ArrayList(); - // boolean variable to check if previous lib was installed successfully, + // boolean variable to check if previous lib was installed successfully, // to give the user an idea about progress being made. boolean isPrevDone = false; @@ -336,7 +335,7 @@ public class ContributionManager { try { // Use the console to let the user know what's happening // The slightly complex if-else is required to let the user know when - // one install is completed and the next download has begun without + // one install is completed and the next download has begun without // interfereing with occur status messages that may arise in the meanwhile String statusMsg = base.getActiveEditor().getStatusMessage(); if (isPrevDone) { @@ -370,7 +369,7 @@ public class ContributionManager { installedLibList.add(ad.name); isPrevDone = true; - + arg = "contrib.import.progress.done"; base.getActiveEditor().statusNotice(Language.interpolate(arg,ad.name)); @@ -602,7 +601,7 @@ public class ContributionManager { propFileName = "libraries.properties"; for (File folder : markedForUpdate) { - Map properties = + Map properties = Base.readSettings(new File(folder, propFileName)); updateContribsNames.add(properties.get("name")); Base.removeDir(folder); diff --git a/app/src/processing/app/contrib/ContributionManagerDialog.java b/app/src/processing/app/contrib/ContributionManagerDialog.java index 18a610254..7453b7b99 100644 --- a/app/src/processing/app/contrib/ContributionManagerDialog.java +++ b/app/src/processing/app/contrib/ContributionManagerDialog.java @@ -434,13 +434,14 @@ public class ContributionManagerDialog { new ArrayList(editor.getMode().contribLibraries); contributions.addAll(libraries); - ArrayList tools = editor.contribTools; + //ArrayList tools = editor.contribTools; + List tools = editor.getToolContribs(); contributions.addAll(tools); - ArrayList modes = editor.getBase().getModeContribs(); + List modes = editor.getBase().getModeContribs(); contributions.addAll(modes); - ArrayList examples = editor.getBase().getExampleContribs(); + List examples = editor.getBase().getExampleContribs(); contributions.addAll(examples); // ArrayList compilations = LibraryCompilation.list(libraries); diff --git a/app/src/processing/app/contrib/ContributionType.java b/app/src/processing/app/contrib/ContributionType.java index 2bf8facff..3c16d80da 100644 --- a/app/src/processing/app/contrib/ContributionType.java +++ b/app/src/processing/app/contrib/ContributionType.java @@ -15,7 +15,7 @@ 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 + 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 */ @@ -33,7 +33,7 @@ import processing.app.Library; public enum ContributionType { LIBRARY, TOOL, MODE, EXAMPLES; - + public String toString() { switch (this) { case LIBRARY: @@ -47,11 +47,11 @@ public enum ContributionType { } return null; // should be unreachable }; - - - /** - * Get this type name as a purtied up, capitalized version. - * @return Mode for mode, Tool for tool, etc. + + + /** + * Get this type name as a purtied up, capitalized version. + * @return Mode for mode, Tool for tool, etc. */ public String getTitle() { String s = toString(); @@ -63,8 +63,8 @@ public enum ContributionType { else return Character.toUpperCase(s.charAt(0)) + s.substring(1); } - - + + public String getFolderName() { switch (this) { case LIBRARY: @@ -78,33 +78,33 @@ public enum ContributionType { } return null; // should be unreachable } - - + + public File createTempFolder() throws IOException { return Base.createTempFolder(toString(), "tmp", getSketchbookFolder()); } - - + + public boolean isTempFolderName(String name) { return name.startsWith(toString()) && name.endsWith("tmp"); } - - + + // public String getTempPrefix() { // return toString(); // } -// -// +// +// // public String getTempSuffix() { // return "tmp"; // } - - + + // public String getPropertiesName() { // return toString() + ".properties"; // } - + static public ContributionType fromName(String s) { if (s != null) { if ("library".equalsIgnoreCase(s)) { @@ -140,8 +140,8 @@ public enum ContributionType { boolean isCandidate(File potential) { - return (potential.isDirectory() && - new File(potential, toString()).exists() && + return (potential.isDirectory() && + new File(potential, toString()).exists() && !isTempFolderName(potential.getName())); } @@ -176,17 +176,17 @@ public enum ContributionType { } return folders[0]; } - - - /** + + + /** * Returns true if the type of contribution requires the PDE to restart - * when being added or removed. + * when being added or removed. */ boolean requiresRestart() { return this == ContributionType.TOOL || this == ContributionType.MODE; } - - + + LocalContribution load(Base base, File folder) { switch (this) { case LIBRARY: @@ -210,7 +210,7 @@ public enum ContributionType { contribs.addAll(editor.getMode().contribLibraries); break; case TOOL: - contribs.addAll(editor.contribTools); + contribs.addAll(editor.getToolContribs()); break; case MODE: contribs.addAll(editor.getBase().getModeContribs()); @@ -221,17 +221,17 @@ public enum ContributionType { } return contribs; } - + File getBackupFolder() { return new File(getSketchbookFolder(), "old"); } - - + + File createBackupFolder(StatusPanel status) { - File backupFolder = getBackupFolder(); + File backupFolder = getBackupFolder(); // if (backupFolder.isDirectory()) { -// status.setErrorMessage("First remove the folder named \"old\" from the " + +// status.setErrorMessage("First remove the folder named \"old\" from the " + // getFolderName() + " folder in the sketchbook."); // return null; // } @@ -242,9 +242,9 @@ public enum ContributionType { } return backupFolder; } - - - /** + + + /** * Create a filter for a specific contribution type. * @param type The type, or null for a generic update checker. */ @@ -255,8 +255,8 @@ public enum ContributionType { } }; } - - + + static ContributionFilter createUpdateFilter() { return new ContributionFilter() { public boolean matches(Contribution contrib) { diff --git a/app/src/processing/app/contrib/ExamplesContribution.java b/app/src/processing/app/contrib/ExamplesContribution.java index bd29664a3..6ad45bc24 100644 --- a/app/src/processing/app/contrib/ExamplesContribution.java +++ b/app/src/processing/app/contrib/ExamplesContribution.java @@ -3,6 +3,8 @@ package processing.app.contrib; import java.io.File; import java.util.ArrayList; import java.util.HashMap; +import java.util.List; +import java.util.Map; import processing.app.Base; import processing.core.PApplet; @@ -36,7 +38,7 @@ public class ExamplesContribution extends LocalContribution { /** * Function to determine whether or not the example present in the * exampleLocation directory is compatible with the present mode. - * + * * @param base * @param exampleLocationFolder * @return true if the example is compatible with the mode of the currently @@ -61,14 +63,14 @@ public class ExamplesContribution extends LocalContribution { static public void loadMissing(Base base) { File examplesFolder = Base.getSketchbookExamplesFolder(); - ArrayList contribExamples = base.getExampleContribs(); + List contribExamples = base.getExampleContribs(); - HashMap existing = new HashMap(); + Map existing = new HashMap(); for (ExamplesContribution contrib : contribExamples) { existing.put(contrib.getFolder(), contrib); } File[] potential = ContributionType.EXAMPLES.listCandidates(examplesFolder); - // If modesFolder does not exist or is inaccessible (folks might like to + // If modesFolder does not exist or is inaccessible (folks might like to // mess with folders then report it as a bug) 'potential' will be null. if (potential != null) { for (File folder : potential) { diff --git a/app/src/processing/app/contrib/ModeContribution.java b/app/src/processing/app/contrib/ModeContribution.java index 7f3240785..e15a72e9f 100644 --- a/app/src/processing/app/contrib/ModeContribution.java +++ b/app/src/processing/app/contrib/ModeContribution.java @@ -44,11 +44,11 @@ public class ModeContribution extends LocalContribution { String searchName) { try { return new ModeContribution(base, folder, searchName); - + } catch (IgnorableException ig) { Base.log(ig.getMessage()); - - } catch (Throwable err) { + + } catch (Throwable err) { // Throwable to catch Exceptions or UnsupportedClassVersionError et al if (searchName == null) { err.printStackTrace(); @@ -87,13 +87,13 @@ public class ModeContribution extends LocalContribution { } } + /** * Method to close the ClassLoader so that the archives are no longer "locked" * and a mode can be removed without restart. */ public void clearClassLoader(Base base) { - - ArrayList contribModes = base.getModeContribs(); + List contribModes = base.getModeContribs(); int botherToRemove = contribModes.indexOf(this); if (botherToRemove != -1) { // The poor thing isn't even loaded, and we're trying to remove it... contribModes.remove(botherToRemove); @@ -109,16 +109,17 @@ public class ModeContribution extends LocalContribution { } } + static public void loadMissing(Base base) { File modesFolder = Base.getSketchbookModesFolder(); - ArrayList contribModes = base.getModeContribs(); + List contribModes = base.getModeContribs(); - HashMap existing = new HashMap(); + Map existing = new HashMap(); for (ModeContribution contrib : contribModes) { existing.put(contrib.getFolder(), contrib); } File[] potential = ContributionType.MODE.listCandidates(modesFolder); - // If modesFolder does not exist or is inaccessible (folks might like to + // If modesFolder does not exist or is inaccessible (folks might like to // mess with folders then report it as a bug) 'potential' will be null. if (potential != null) { for (File folder : potential) { @@ -133,7 +134,7 @@ public class ModeContribution extends LocalContribution { } } } - + // This allows you to build and test your Mode code from Eclipse. // -Dusemode=com.foo.FrobMode:/path/to/FrobMode final String useMode = System.getProperty("usemode"); diff --git a/app/src/processing/app/contrib/ToolContribution.java b/app/src/processing/app/contrib/ToolContribution.java index bb8ca790c..9af7f3b4c 100644 --- a/app/src/processing/app/contrib/ToolContribution.java +++ b/app/src/processing/app/contrib/ToolContribution.java @@ -79,12 +79,12 @@ public class ToolContribution extends LocalContribution implements Tool { Iterator editorIter = base.getEditors().iterator(); while (editorIter.hasNext()) { Editor editor = editorIter.next(); - ArrayList contribTools = editor.contribTools; + List contribTools = editor.getToolContribs(); for (ToolContribution toolContrib : contribTools) if (toolContrib.getName().equals(this.name)) { try { ((URLClassLoader) toolContrib.loader).close(); - editor.contribTools.remove(toolContrib); + editor.removeToolContrib(toolContrib); break; } catch (IOException e) { e.printStackTrace(); @@ -127,7 +127,7 @@ public class ToolContribution extends LocalContribution implements Tool { // Editor editor; // used to send error messages - + public void init(Editor editor) { // try { // this.editor = editor; @@ -162,7 +162,7 @@ public class ToolContribution extends LocalContribution implements Tool { /** * Returns the object stored in the referenceFile field, which contains an * instance of the file object representing the index file of the reference - * + * * @return referenceFile */ public File getReferenceIndexFile() { @@ -172,7 +172,7 @@ public class ToolContribution extends LocalContribution implements Tool { /** * Tests whether the reference's index file indicated by referenceFile exists. - * + * * @return true if and only if the file denoted by referenceFile exists; false * otherwise. */ diff --git a/build/shared/lib/languages/PDE.properties b/build/shared/lib/languages/PDE.properties index 2b09b49f6..d28d017f3 100644 --- a/build/shared/lib/languages/PDE.properties +++ b/build/shared/lib/languages/PDE.properties @@ -326,6 +326,7 @@ editor.status.printing.error = Error while printing. editor.status.printing.canceled = Printing canceled. editor.status.copy_as_html = Code formatted as HTML has been copied to the clipboard. editor.status.debug.busy = Debugger busy... +editor.status.debug.halt = Debugger halted. # Errors editor.status.warning = Warning diff --git a/core/todo.txt b/core/todo.txt index 32da52d64..3eff9c400 100644 --- a/core/todo.txt +++ b/core/todo.txt @@ -7,6 +7,8 @@ X add new String/Int/FloatDict constructors for easier initialization X errors in case changes not correctly reported X https://github.com/processing/processing/issues/3235 +_ Fullscreen window on second monitor without using present mode +_ https://github.com/processing/processing/issues/3271 _ move svgz handling to PApplet _ remove objz handling diff --git a/java/src/processing/mode/java/JavaEditor.java b/java/src/processing/mode/java/JavaEditor.java index 20c9b4b92..59916f6d7 100644 --- a/java/src/processing/mode/java/JavaEditor.java +++ b/java/src/processing/mode/java/JavaEditor.java @@ -331,6 +331,7 @@ public class JavaEditor extends Editor { boolean isCoreToolMenuItemAdded = false; boolean isContribToolMenuItemAdded = false; + List contribTools = getToolContribs(); // Adding this in in case a reference folder is added for MovieMaker, or in case // other core tools are introduced later isCoreToolMenuItemAdded = addToolReferencesToSubMenu(getCoreTools(), toolRefSubmenu); @@ -456,7 +457,6 @@ public class JavaEditor extends Editor { /** - * * Populates the JMenu with JMenuItems, one for each Tool that has a reference * accompanying it. The JMenuItems open the index.htm/index.html file of the * reference in the user's default browser, or the readme.txt in the user's @@ -469,7 +469,7 @@ public class JavaEditor extends Editor { * to be added * @return true if and only if any JMenuItems were added; false otherwise */ - private boolean addToolReferencesToSubMenu(ArrayList toolsList, JMenu subMenu) { + private boolean addToolReferencesToSubMenu(List toolsList, JMenu subMenu) { boolean isItemAdded = false; Iterator iter = toolsList.iterator(); while (iter.hasNext()) { @@ -2746,7 +2746,7 @@ public class JavaEditor extends Editor { SketchCode[] code = sketch.getCode(); List> handles = parser.allHandles; - + if (code.length < 1) { return false; } @@ -2798,7 +2798,7 @@ public class JavaEditor extends Editor { } code[tab].setProgram(c); } - + // add the main header to the code in the first tab String c = code[0].getProgram();