21 |
*/ |
*/ |
22 |
package org.jsampler.view.std; |
package org.jsampler.view.std; |
23 |
|
|
24 |
|
import java.awt.Desktop; |
25 |
|
|
26 |
|
import java.net.URI; |
27 |
|
|
28 |
import java.util.Vector; |
import java.util.Vector; |
29 |
|
|
30 |
import org.jsampler.CC; |
import org.jsampler.CC; |
31 |
|
import org.jsampler.HF; |
32 |
import org.jsampler.JSPrefs; |
import org.jsampler.JSPrefs; |
33 |
|
|
34 |
|
import static org.jsampler.view.std.StdI18n.i18n; |
35 |
|
|
36 |
|
|
37 |
/** |
/** |
38 |
* |
* |
64 |
elements = v.toArray(new String[v.size()]); |
elements = v.toArray(new String[v.size()]); |
65 |
preferences().setStringListProperty(property, elements); |
preferences().setStringListProperty(property, elements); |
66 |
} |
} |
67 |
|
|
68 |
|
public static boolean |
69 |
|
checkDesktopSupported() { |
70 |
|
if(Desktop.isDesktopSupported()) return true; |
71 |
|
|
72 |
|
String s = i18n.getError("StdUtils.DesktopApiNotSupported"); |
73 |
|
HF.showErrorMessage(s, CC.getMainFrame()); |
74 |
|
|
75 |
|
return false; |
76 |
|
} |
77 |
|
|
78 |
|
public static void |
79 |
|
browse(String uri) { |
80 |
|
if(!checkDesktopSupported()) return; |
81 |
|
|
82 |
|
try { Desktop.getDesktop().browse(new URI(uri)); } |
83 |
|
catch(Exception x) { x.printStackTrace(); } |
84 |
|
} |
85 |
|
|
86 |
|
public static void |
87 |
|
mail(String uri) { |
88 |
|
if(!StdUtils.checkDesktopSupported()) return; |
89 |
|
|
90 |
|
Desktop desktop = Desktop.getDesktop(); |
91 |
|
|
92 |
|
try { Desktop.getDesktop().mail(new URI(uri)); } |
93 |
|
catch(Exception x) { x.printStackTrace(); } |
94 |
|
} |
95 |
} |
} |