1 /*--------------------------------------------------------------------------
2 * Copyright 2007 utgenome.org
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *--------------------------------------------------------------------------*/
16 //--------------------------------------
17 // utgb-core Project
18 //
19 // OSInfo.java
20 // Since: 2007/11/23
21 //
22 // $URL$
23 // $Author$
24 //--------------------------------------
25 package org.utgenome.shell;
26
27 import java.lang.reflect.Method;
28
29 /**
30 * This class provides information of current OS type.
31 *
32 * @author leo
33 *
34 */
35 public enum OSType {
36 Windows,
37 MacOS,
38 Other;
39
40 /**
41 * Gets the current OS type
42 * @return the current OS type
43 */
44 public static OSType getOSType()
45 {
46 String osName = System.getProperty("os.name");
47 if(osName.startsWith("Mac OS"))
48 return MacOS;
49 else if(osName.startsWith("Windows"))
50 return Windows;
51 else
52 return Other;
53 }
54
55
56
57 }
58
59
60
61
62 // Unix
63 // or
64 // Linux
65 // String[]
66 // browsers
67 // = {
68 // "firefox",
69 // "opera",
70 // "konqueror",
71 // "epiphany",
72 // "mozilla",
73 // "netscape"
74 // };
75 // String
76 // browser
77 // =
78 // null;
79 // for
80 // (int
81 // count
82 // = 0;
83 // count
84 // <
85 // browsers.length
86 // &&
87 // browser
88 // ==
89 // null;
90 // count++)
91 // if
92 // (Runtime.getRuntime().exec(
93 // new
94 // String[]
95 // {"which",
96 // browsers[count]}).waitFor()
97 // ==
98 // 0)
99 // browser
100 // =
101 // browsers[count];
102 // if
103 // (browser
104 // ==
105 // null)
106 // throw
107 // new
108 // Exception("Could
109 // not
110 // find
111 // web
112 // browser");
113 // else
114 // Runtime.getRuntime().exec(new
115 // String[]
116 // {browser,
117 // url});
118 // } }
119 // catch
120 // (Exception
121 // e) {
122 // JOptionPane.showMessageDialog(null,
123 // errMsg
124 // +
125 // ":\n"
126 // +
127 // e.getLocalizedMessage());
128 // } }
129 // }