Used by Base for platform-specific tweaking, for instance finding the sketchbook location using the Windows registry, or OS X event handling. The methods in this implementation are used by default, and can be overridden by a subclass, if loaded by Base.main(). These methods throw vanilla-f
| 52 | * know if name is proper Java package syntax.) |
| 53 | */ |
| 54 | public class Platform { |
| 55 | /** |
| 56 | * Set the default L & F. While I enjoy the bounty of the sixteen possible |
| 57 | * exception types that this UIManager method might throw, I feel that in |
| 58 | * just this one particular case, I'm being spoiled by those engineers |
| 59 | * at Sun, those Masters of the Abstractionverse. It leaves me feeling sad |
| 60 | * and overweight. So instead, I'll pretend that I'm not offered eleven dozen |
| 61 | * ways to report to the user exactly what went wrong, and I'll bundle them |
| 62 | * all into a single catch-all "Exception". Because in the end, all I really |
| 63 | * care about is whether things worked or not. And even then, I don't care. |
| 64 | * |
| 65 | * @throws Exception Just like I said. |
| 66 | */ |
| 67 | public void setLookAndFeel() throws Exception { |
| 68 | UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); |
| 69 | } |
| 70 | |
| 71 | |
| 72 | public void init() throws Exception { |
| 73 | } |
| 74 | |
| 75 | |
| 76 | public File getSettingsFolder() throws Exception { |
| 77 | // otherwise make a .processing directory int the user's home dir |
| 78 | File home = new File(System.getProperty("user.home")); |
| 79 | File dataFolder = new File(home, ".arduino15"); |
| 80 | return dataFolder; |
| 81 | |
| 82 | /* |
| 83 | try { |
| 84 | Class clazz = Class.forName("processing.app.macosx.ThinkDifferent"); |
| 85 | Method m = clazz.getMethod("getLibraryFolder", new Class[] { }); |
| 86 | String libraryPath = (String) m.invoke(null, new Object[] { }); |
| 87 | //String libraryPath = BaseMacOS.getLibraryFolder(); |
| 88 | File libraryFolder = new File(libraryPath); |
| 89 | dataFolder = new File(libraryFolder, "Processing"); |
| 90 | |
| 91 | } catch (Exception e) { |
| 92 | showError("Problem getting data folder", |
| 93 | "Error getting the Processing data folder.", e); |
| 94 | } |
| 95 | */ |
| 96 | } |
| 97 | |
| 98 | |
| 99 | /** |
| 100 | * @return null if not overridden, which will cause a prompt to show instead. |
| 101 | * @throws Exception |
| 102 | */ |
| 103 | public File getDefaultSketchbookFolder() throws Exception { |
| 104 | return null; |
| 105 | } |
| 106 | |
| 107 | public void openURL(File folder, String url) throws Exception { |
| 108 | if (!url.startsWith("file://./")) { |
| 109 | openURL(url); |
| 110 | return; |
| 111 | } |
nothing calls this directly
no test coverage detected