starting platform move

This commit is contained in:
Ben Fry
2015-08-13 17:46:44 -04:00
parent 4329ddadf8
commit eade82af03
5 changed files with 17 additions and 61 deletions

View File

@@ -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$
}

View File

@@ -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 {

View File

@@ -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 {

View File

@@ -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);
}
*/
}

View File

@@ -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;