From b3ec9cbd357bdff5caf49d8fb28d267054b6b337 Mon Sep 17 00:00:00 2001 From: benfry Date: Mon, 2 May 2005 01:11:44 +0000 Subject: [PATCH] more fixes to Editor and Sketch --- processing/app/Editor.java | 21 ++++++++++++--------- processing/app/Sketch.java | 22 ++++++++++++---------- 2 files changed, 24 insertions(+), 19 deletions(-) diff --git a/processing/app/Editor.java b/processing/app/Editor.java index 2c506b048..3268f7b0e 100644 --- a/processing/app/Editor.java +++ b/processing/app/Editor.java @@ -952,6 +952,8 @@ public class Editor extends JFrame console.clear(); } + + presenting = present; /* if (presenting) { @@ -1671,20 +1673,21 @@ public class Editor extends JFrame public void error(Exception e) { - //System.out.println("ERORROOROROR 1"); - //status.error(e.getMessage()); + if (e == null) { + System.err.println("Editor.error() was passed a null exception."); + return; + } // not sure if any RuntimeExceptions will actually arrive // through here, but gonna check for em just in case. String mess = e.getMessage(); - //System.out.println("MESSY: " + mess); - String rxString = "RuntimeException: "; - if (mess.indexOf(rxString) == 0) { - mess = mess.substring(rxString.length()); - //System.out.println("MESS2: " + mess); + if (mess != null) { + String rxString = "RuntimeException: "; + if (mess.indexOf(rxString) == 0) { + mess = mess.substring(rxString.length()); + } + status.error(mess); } - status.error(mess); - e.printStackTrace(); } diff --git a/processing/app/Sketch.java b/processing/app/Sketch.java index 82c1f2022..e9cdbb0e0 100644 --- a/processing/app/Sketch.java +++ b/processing/app/Sketch.java @@ -736,14 +736,6 @@ public class Sketch { } - /* - public void saveCurrent() throws IOException { - current.save(); - calcModified(); - } - */ - - /** * Handles 'Save As' for a sketch. *

@@ -778,14 +770,24 @@ public class Sketch { newName = Sketchbook.sanitizeName(newName); // make sure there doesn't exist a tab with that name already - File checkAlready = new File(folder, newName + ".pde"); - if (checkAlready.exists()) { + File codeAlready = new File(folder, newName + ".pde"); + if (codeAlready.exists()) { Base.showMessage("Nope", "You can't save the sketch as \"" + newName + "\"\n" + "because the sketch already has a tab with that name."); return false; } + // make sure there doesn't exist a tab with that name already + File hiddenAlready = new File(folder, newName + ".pde.x"); + if (hiddenAlready.exists()) { + Base.showMessage("Nope", + "You can't save the sketch as \"" + newName + "\"\n" + + "because the sketch already has a " + + "hidden tab with that name."); + return false; + } + // new sketch folder File newFolder = new File(newParentDir, newName);