diff --git a/app/src/processing/app/Base.java b/app/src/processing/app/Base.java index e8d10c440..fb1dc4a14 100644 --- a/app/src/processing/app/Base.java +++ b/app/src/processing/app/Base.java @@ -79,7 +79,7 @@ public class Base { platformIndices.put("macosx", PConstants.MACOSX); //$NON-NLS-1$ platformIndices.put("linux", PConstants.LINUX); //$NON-NLS-1$ } - static Platform platform; +// static Platform platform; /** How many bits this machine is */ static int nativeBits; @@ -192,7 +192,7 @@ public class Base { if (!SingleInstance.alreadyRunning(args)) { // Set the look and feel before opening the window try { - platform.setLookAndFeel(); + Platform.setLookAndFeel(); } catch (Exception e) { loge("Could not set the Look & Feel", e); //$NON-NLS-1$ } diff --git a/app/src/processing/app/platform/LinuxPlatform.java b/app/src/processing/app/platform/LinuxPlatform.java index 3a905855d..76bca85ba 100644 --- a/app/src/processing/app/platform/LinuxPlatform.java +++ b/app/src/processing/app/platform/LinuxPlatform.java @@ -26,8 +26,8 @@ import java.io.File; import java.awt.Toolkit; import processing.app.Base; -import processing.app.Platform; import processing.app.Preferences; +import processing.app.platform.Platform; public class LinuxPlatform extends Platform { diff --git a/app/src/processing/app/platform/MacPlatform.java b/app/src/processing/app/platform/MacPlatform.java index 0c7a911c9..4c05e2d93 100644 --- a/app/src/processing/app/platform/MacPlatform.java +++ b/app/src/processing/app/platform/MacPlatform.java @@ -29,7 +29,7 @@ import java.io.IOException; import com.apple.eio.FileManager; import processing.app.Base; -import processing.app.Platform; +import processing.app.platform.Platform; /** @@ -93,8 +93,8 @@ public class MacPlatform extends Platform { } */ } - - + + public File getSettingsFolder() throws Exception { return new File(getLibraryFolder(), "Processing"); } @@ -115,10 +115,10 @@ public class MacPlatform extends Platform { } */ } - -// /** -// * Moves the specified File object (which might be a file or folder) + +// /** +// * Moves the specified File object (which might be a file or folder) // * to the trash. // */ // public boolean deleteFile(File file) throws IOException { diff --git a/app/src/processing/app/Platform.java b/app/src/processing/app/platform/Platform.java similarity index 77% rename from app/src/processing/app/Platform.java rename to app/src/processing/app/platform/Platform.java index 1f644858c..a661e39bc 100644 --- a/app/src/processing/app/Platform.java +++ b/app/src/processing/app/platform/Platform.java @@ -3,7 +3,8 @@ /* Part of the Processing project - http://processing.org - Copyright (c) 2008 Ben Fry and Casey Reas + Copyright (c) 2012-15 The Processing Foundation + Copyright (c) 2008-12 Ben Fry and Casey Reas 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 @@ -20,7 +21,7 @@ Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -package processing.app; +package processing.app.platform; import java.awt.Desktop; import java.io.File; @@ -29,6 +30,10 @@ import java.net.URI; import javax.swing.UIManager; +import processing.app.Base; +import processing.app.Preferences; +import processing.app.Util; + import com.sun.jna.Library; import com.sun.jna.Native; import com.sun.jna.platform.FileUtils; @@ -96,21 +101,6 @@ public class Platform { // otherwise make a .processing directory int the user's home dir File home = new File(System.getProperty("user.home")); return new File(home, ".processing"); - - /* - try { - Class clazz = Class.forName("processing.app.macosx.ThinkDifferent"); - Method m = clazz.getMethod("getLibraryFolder", new Class[] { }); - String libraryPath = (String) m.invoke(null, new Object[] { }); - //String libraryPath = BaseMacOS.getLibraryFolder(); - File libraryFolder = new File(libraryPath); - dataFolder = new File(libraryFolder, "Processing"); - - } catch (Exception e) { - showError("Problem getting data folder", - "Error getting the Processing data folder.", e); - } - */ } @@ -125,36 +115,16 @@ public class Platform { public void openURL(String url) throws Exception { Desktop.getDesktop().browse(new URI(url)); - /* - String launcher = Preferences.get("launcher"); - if (launcher != null) { - Runtime.getRuntime().exec(new String[] { launcher, url }); - } else { - showLauncherWarning(); - } - */ } public boolean openFolderAvailable() { return Desktop.isDesktopSupported(); - /* - return Preferences.get("launcher") != null; - */ } public void openFolder(File file) throws Exception { Desktop.getDesktop().open(file); - /* - String launcher = Preferences.get("launcher"); - if (launcher != null) { - String folder = file.getAbsolutePath(); - Runtime.getRuntime().exec(new String[] { launcher, folder }); - } else { - showLauncherWarning(); - } - */ } @@ -210,18 +180,4 @@ public class Platform { CLibrary clib = CLibrary.INSTANCE; return clib.unsetenv(variable); } - - - // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . - - - /* - protected void showLauncherWarning() { - Base.showWarning("No launcher available", - "Unspecified platform, no launcher available.\n" + - "To enable opening URLs or folders, add a \n" + - "\"launcher=/path/to/app\" line to preferences.txt", - null); - } - */ } diff --git a/app/src/processing/app/platform/WindowsPlatform.java b/app/src/processing/app/platform/WindowsPlatform.java index 47b1d2746..80e3451a8 100644 --- a/app/src/processing/app/platform/WindowsPlatform.java +++ b/app/src/processing/app/platform/WindowsPlatform.java @@ -36,8 +36,8 @@ import com.sun.jna.platform.win32.WinError; import com.sun.jna.platform.win32.WinNT.HRESULT; import processing.app.Base; -import processing.app.Platform; import processing.app.Preferences; +import processing.app.platform.Platform; import processing.app.platform.WindowsRegistry.REGISTRY_ROOT_KEY; import processing.core.PApplet;