From beabd3af126cdd86d56b5393486750ecbf95a51d Mon Sep 17 00:00:00 2001 From: benfry Date: Tue, 11 Aug 2009 20:07:29 +0000 Subject: [PATCH] working on handleOpen() problems --- app/src/processing/app/Base.java | 25 ++++++++++++++++--- .../processing/app/macosx/ThinkDifferent.java | 5 ++-- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/app/src/processing/app/Base.java b/app/src/processing/app/Base.java index fe85b19a7..9243d0bbc 100644 --- a/app/src/processing/app/Base.java +++ b/app/src/processing/app/Base.java @@ -43,14 +43,14 @@ public class Base { static final int REVISION = 168; static String VERSION_NAME = "0168"; - static HashMap platformNames = new HashMap(); + static HashMap platformNames = new HashMap(); static { platformNames.put(PConstants.WINDOWS, "windows"); platformNames.put(PConstants.MACOSX, "macosx"); platformNames.put(PConstants.LINUX, "linux"); } - static HashMap platformIndices = new HashMap(); + static HashMap platformIndices = new HashMap(); static { platformIndices.put("windows", PConstants.WINDOWS); platformIndices.put("macosx", PConstants.MACOSX); @@ -733,13 +733,17 @@ public class Base { protected Editor handleOpen(String path, int[] location) { +// System.err.println("entering handleOpen " + path); + File file = new File(path); if (!file.exists()) return null; +// System.err.println(" editors: " + editors); // Cycle through open windows to make sure that it's not already open. for (Editor editor : editors) { if (editor.getSketch().getMainFilePath().equals(path)) { editor.toFront(); +// System.err.println(" handleOpen: already opened"); return editor; } } @@ -758,10 +762,23 @@ public class Base { // } // } +// System.err.println(" creating new editor"); Editor editor = new Editor(this, path, location); - +// Editor editor = null; +// try { +// editor = new Editor(this, path, location); +// } catch (Exception e) { +// e.printStackTrace(); +// System.err.flush(); +// System.out.flush(); +// System.exit(1); +// } +// System.err.println(" done creating new editor"); +// EditorConsole.systemErr.println(" done creating new editor"); + // Make sure that the sketch actually loaded if (editor.getSketch() == null) { +// System.err.println("sketch was null, getting out of handleOpen"); return null; // Just walk away quietly } @@ -785,6 +802,8 @@ public class Base { // (don't do earlier, cuz we might move it based on a window being closed) editor.setVisible(true); +// System.err.println("exiting handleOpen"); + return editor; } diff --git a/app/src/processing/app/macosx/ThinkDifferent.java b/app/src/processing/app/macosx/ThinkDifferent.java index 38cb6cb9a..1d292b399 100644 --- a/app/src/processing/app/macosx/ThinkDifferent.java +++ b/app/src/processing/app/macosx/ThinkDifferent.java @@ -86,13 +86,14 @@ public class ThinkDifferent implements ApplicationListener { throw new IllegalStateException("handlePreferences: Base instance detached from listener"); } } - - + + public void handleOpenApplication(ApplicationEvent ae) { } public void handleOpenFile(ApplicationEvent ae) { +// System.out.println("got open file event " + ae.getFilename()); String filename = ae.getFilename(); base.handleOpen(filename); ae.setHandled(true);