1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.xnap.util.launcher;
21
22 import java.io.File;
23 import java.io.IOException;
24 import java.net.URL;
25
26 import org.xnap.XNap;
27 import org.xnap.util.SystemHelper;
28
29 import ziga.util.WindowsFileLauncher;
30
31 /***
32 * Provides a Windows launcher based on ziga.dll.
33 */
34 public class WindowsLauncher extends DefaultLauncher {
35
36
37
38
39
40
41
42 public WindowsLauncher()
43 {
44 super("ziga.dll", XNap.tr("Windows (requires ziga.dll)"), "");
45 }
46
47
48
49 /***
50 * Returns false.
51 */
52 public boolean isEditable()
53 {
54 return false;
55 }
56
57 /***
58 * Returns true, if ziga.dll is loaded.
59 */
60 public boolean isEnabled()
61 {
62 return SystemHelper.isZigaDllLoaded;
63 }
64
65 /***
66 * Launches <code>file</code>.
67 */
68 public void open(File file) throws IOException
69 {
70 try {
71 WindowsFileLauncher.open(file.getAbsolutePath());
72 }
73 catch (UnsatisfiedLinkError e) {
74 throw new IOException("ziga.dll not loaded");
75 }
76 }
77
78 public void open(URL url) throws IOException
79 {
80 try {
81 WindowsFileLauncher.open(url.toExternalForm());
82 }
83 catch (UnsatisfiedLinkError e) {
84 throw new IOException("ziga.dll not loaded");
85 }
86 }
87
88 }