cleanups and formatting

This commit is contained in:
Ben Fry
2015-04-09 13:54:22 -04:00
parent a9d7addb8c
commit 09db309a6d
2 changed files with 30 additions and 23 deletions
+28 -21
View File
@@ -53,16 +53,20 @@ public class Platform {
Base base;
public void init(Base base) {
this.base = base;
}
/**
* Set the default L & F. While I enjoy the bounty of the sixteen possible
* exception types that this UIManager method might throw, I feel that in
* just this one particular case, I'm being spoiled by those engineers
* at Sun, those Masters of the Abstractionverse. It leaves me feeling sad
* and overweight. So instead, I'll pretend that I'm not offered eleven dozen
* ways to report to the user exactly what went wrong, and I'll bundle them
* all into a single catch-all "Exception". Because in the end, all I really
* care about is whether things worked or not. And even then, I don't care.
*
* at Sun, those Masters of the Abstractionverse. So instead, I'll pretend
* that I'm not offered eleven dozen ways to report to the user exactly what
* went wrong, and I'll bundle them all into a single catch-all "Exception".
* Because in the end, all I really care about is whether things worked or
* not. And even then, I don't care.
* @throws Exception Just like I said.
*/
public void setLookAndFeel() throws Exception {
@@ -74,17 +78,20 @@ public class Platform {
}
}
public void saveLanguage(String languageCode) {}
public void init(Base base) {
this.base = base;
}
/**
* Handle any platform-specific languages saving. This is necessary on OS X
* because of how bundles are handled, but perhaps your platform would like
* to Think Different too?
* @param languageCode 2-digit lowercase ISO language code
*/
public void saveLanguage(String languageCode) { }
/**
* This function should throw an exception or return a value.
* Do not return null.
*/
/**
* This function should throw an exception or return a value.
* Do not return null.
*/
public File getSettingsFolder() throws Exception {
// otherwise make a .processing directory int the user's home dir
File home = new File(System.getProperty("user.home"));
@@ -149,26 +156,26 @@ public class Platform {
}
*/
}
/**
* Attempts to move to the Trash on OS X, or the Recycle Bin on Windows.
* Also tries to find a suitable Trash location on Linux.
* If not possible, just deletes the file or folder instead.
* Attempts to move to the Trash on OS X, or the Recycle Bin on Windows.
* Also tries to find a suitable Trash location on Linux.
* If not possible, just deletes the file or folder instead.
* @param file the folder or file to be removed/deleted
* @return true if the folder was successfully removed
* @throws IOException
* @throws IOException
*/
final public boolean deleteFile(File file) throws IOException {
FileUtils fu = FileUtils.getInstance();
if (fu.hasTrash()) {
fu.moveToTrash(new File[] { file });
return true;
} else if (file.isDirectory()) {
Base.removeDir(file);
return true;
} else {
return file.delete();
}
+2 -2
View File
@@ -145,8 +145,8 @@ public class Preferences {
// http://docs.oracle.com/javase/6/docs/technotes/guides/net/proxies.html
String proxyHost = get("proxy.host");
String proxyPort = get("proxy.port");
if (proxyHost != null && proxyHost.trim().length() != 0 &&
proxyPort != null && proxyPort.trim().length() != 0) {
if (proxyHost != null && proxyHost.length() != 0 &&
proxyPort != null && proxyPort.length() != 0) {
System.setProperty("http.proxyHost", proxyHost);
System.setProperty("http.proxyPort", proxyPort);
}