|
22 | 22 |
|
23 | 23 | package processing.app.linux; |
24 | 24 |
|
25 | | -import java.io.File; |
26 | | - |
27 | 25 | import javax.swing.UIManager; |
28 | 26 |
|
29 | 27 | import processing.app.Base; |
30 | | -import processing.app.Preferences; |
31 | 28 |
|
32 | 29 |
|
33 | 30 | public class Platform extends processing.app.Platform { |
@@ -68,64 +65,64 @@ public void setLookAndFeel() throws Exception { |
68 | 65 | } |
69 | 66 |
|
70 | 67 |
|
71 | | - public void openURL(String url) throws Exception { |
72 | | - if (openFolderAvailable()) { |
73 | | - String launcher = Preferences.get("launcher"); |
74 | | - if (launcher != null) { |
75 | | - Runtime.getRuntime().exec(new String[] { launcher, url }); |
76 | | - } |
77 | | - } |
78 | | - } |
79 | | - |
80 | | - |
81 | | - public boolean openFolderAvailable() { |
82 | | - if (Preferences.get("launcher") != null) { |
83 | | - return true; |
84 | | - } |
85 | | - |
86 | | - // Attempt to use xdg-open |
87 | | - try { |
88 | | - Process p = Runtime.getRuntime().exec(new String[] { "xdg-open" }); |
89 | | - p.waitFor(); |
90 | | - Preferences.set("launcher", "xdg-open"); |
91 | | - return true; |
92 | | - } catch (Exception e) { } |
93 | | - |
94 | | - // Attempt to use gnome-open |
95 | | - try { |
96 | | - Process p = Runtime.getRuntime().exec(new String[] { "gnome-open" }); |
97 | | - p.waitFor(); |
98 | | - // Not installed will throw an IOException (JDK 1.4.2, Ubuntu 7.04) |
99 | | - Preferences.set("launcher", "gnome-open"); |
100 | | - return true; |
101 | | - } catch (Exception e) { } |
102 | | - |
103 | | - // Attempt with kde-open |
104 | | - try { |
105 | | - Process p = Runtime.getRuntime().exec(new String[] { "kde-open" }); |
106 | | - p.waitFor(); |
107 | | - Preferences.set("launcher", "kde-open"); |
108 | | - return true; |
109 | | - } catch (Exception e) { } |
110 | | - |
111 | | - return false; |
112 | | - } |
113 | | - |
114 | | - |
115 | | - public void openFolder(File file) throws Exception { |
116 | | - if (openFolderAvailable()) { |
117 | | - String lunch = Preferences.get("launcher"); |
118 | | - try { |
119 | | - String[] params = new String[] { lunch, file.getAbsolutePath() }; |
120 | | - //processing.core.PApplet.println(params); |
121 | | - /*Process p =*/ Runtime.getRuntime().exec(params); |
122 | | - /*int result =*/ //p.waitFor(); |
123 | | - } catch (Exception e) { |
124 | | - e.printStackTrace(); |
125 | | - } |
126 | | - } else { |
127 | | - System.out.println("No launcher set, cannot open " + |
128 | | - file.getAbsolutePath()); |
129 | | - } |
130 | | - } |
| 68 | +// public void openURL(String url) throws Exception { |
| 69 | +// if (openFolderAvailable()) { |
| 70 | +// String launcher = Preferences.get("launcher"); |
| 71 | +// if (launcher != null) { |
| 72 | +// Runtime.getRuntime().exec(new String[] { launcher, url }); |
| 73 | +// } |
| 74 | +// } |
| 75 | +// } |
| 76 | +// |
| 77 | +// |
| 78 | +// public boolean openFolderAvailable() { |
| 79 | +// if (Preferences.get("launcher") != null) { |
| 80 | +// return true; |
| 81 | +// } |
| 82 | +// |
| 83 | +// // Attempt to use xdg-open |
| 84 | +// try { |
| 85 | +// Process p = Runtime.getRuntime().exec(new String[] { "xdg-open" }); |
| 86 | +// p.waitFor(); |
| 87 | +// Preferences.set("launcher", "xdg-open"); |
| 88 | +// return true; |
| 89 | +// } catch (Exception e) { } |
| 90 | +// |
| 91 | +// // Attempt to use gnome-open |
| 92 | +// try { |
| 93 | +// Process p = Runtime.getRuntime().exec(new String[] { "gnome-open" }); |
| 94 | +// p.waitFor(); |
| 95 | +// // Not installed will throw an IOException (JDK 1.4.2, Ubuntu 7.04) |
| 96 | +// Preferences.set("launcher", "gnome-open"); |
| 97 | +// return true; |
| 98 | +// } catch (Exception e) { } |
| 99 | +// |
| 100 | +// // Attempt with kde-open |
| 101 | +// try { |
| 102 | +// Process p = Runtime.getRuntime().exec(new String[] { "kde-open" }); |
| 103 | +// p.waitFor(); |
| 104 | +// Preferences.set("launcher", "kde-open"); |
| 105 | +// return true; |
| 106 | +// } catch (Exception e) { } |
| 107 | +// |
| 108 | +// return false; |
| 109 | +// } |
| 110 | +// |
| 111 | +// |
| 112 | +// public void openFolder(File file) throws Exception { |
| 113 | +// if (openFolderAvailable()) { |
| 114 | +// String lunch = Preferences.get("launcher"); |
| 115 | +// try { |
| 116 | +// String[] params = new String[] { lunch, file.getAbsolutePath() }; |
| 117 | +// //processing.core.PApplet.println(params); |
| 118 | +// /*Process p =*/ Runtime.getRuntime().exec(params); |
| 119 | +// /*int result =*/ //p.waitFor(); |
| 120 | +// } catch (Exception e) { |
| 121 | +// e.printStackTrace(); |
| 122 | +// } |
| 123 | +// } else { |
| 124 | +// System.out.println("No launcher set, cannot open " + |
| 125 | +// file.getAbsolutePath()); |
| 126 | +// } |
| 127 | +// } |
131 | 128 | } |
0 commit comments