List of usage examples for org.apache.commons.lang SystemUtils IS_OS_WINDOWS
boolean IS_OS_WINDOWS
To view the source code for org.apache.commons.lang SystemUtils IS_OS_WINDOWS.
Click Source Link
Is true
if this is Windows.
The field will return false
if OS_NAME
is null
.
From source file:phex.gui.tabs.library.LibraryTreePane.java
private void prepareComponent() { CellConstraints cc = new CellConstraints(); FormLayout layout = new FormLayout("fill:d:grow", // columns "fill:d:grow, 1dlu, p"); //rows PanelBuilder tabBuilder = new PanelBuilder(layout, this); sharingTreeModel = new SharingTreeModel(); mainTree = new JTree(sharingTreeModel); mainTree.setMinimumSize(new Dimension(0, 0)); mainTree.setRowHeight(0);/*from www . j av a 2 s. com*/ mainTree.setCellRenderer(new SharingTreeRenderer()); mainTree.addMouseListener(new MouseHandler()); mainTree.getSelectionModel().addTreeSelectionListener(new SelectionHandler()); ToolTipManager.sharedInstance().registerComponent(mainTree); // open up first level of nodes TreeNode root = (TreeNode) sharingTreeModel.getRoot(); int count = root.getChildCount(); for (int i = 0; i < count; i++) { mainTree.expandPath(new TreePath(new Object[] { root, root.getChildAt(i) })); } JScrollPane treeScrollPane = new JScrollPane(mainTree); tabBuilder.add(treeScrollPane, cc.xywh(1, 1, 1, 1)); FWToolBar shareToolbar = new FWToolBar(FWToolBar.HORIZONTAL); shareToolbar.setBorderPainted(false); shareToolbar.setFloatable(false); tabBuilder.add(shareToolbar, cc.xy(1, 3)); addShareFolderAction = new AddShareFolderAction(); shareToolbar.addAction(addShareFolderAction); removeShareFolderAction = new RemoveShareFolderAction(); shareToolbar.addAction(removeShareFolderAction); if (SystemUtils.IS_OS_WINDOWS || SystemUtils.IS_OS_MAC_OSX) { exploreFolderAction = new ExploreFolderAction(); } fileTreePopup = new FWPopupMenu(); fileTreePopup.addAction(addShareFolderAction); fileTreePopup.addAction(removeShareFolderAction); if (SystemUtils.IS_OS_WINDOWS || SystemUtils.IS_OS_MAC_OSX) { fileTreePopup.addAction(exploreFolderAction); } }
From source file:phex.update.UpdateDownloader.java
public static void createUpdateDownload() throws URIException { String uriStr;/* w w w. ja v a 2 s. c o m*/ if (SystemUtils.IS_OS_MAC_OSX) { uriStr = UpdatePrefs.UPDATE_URI_MAC_OSX; } else if (SystemUtils.IS_OS_WINDOWS) { uriStr = UpdatePrefs.UPDATE_URI_WINDOWS; } else { uriStr = UpdatePrefs.UPDATE_URI_OTHER; } createDownload(uriStr); }
From source file:phex.utils.SystemProperties.java
private static File initPhexConfigRoot() { // to prevent problems wait with assigning userPath... String tmpUserPath = System.getProperty(PHEX_CONFIG_PATH_SYSPROP); if (StringUtils.isEmpty(tmpUserPath)) { if (SystemUtils.IS_OS_WINDOWS) { String appDataEnv = System.getenv("APPDATA"); if (StringUtils.isEmpty(appDataEnv)) { tmpUserPath = System.getProperty("user.home") + File.separator + "Application Data"; }/*from w ww . j a va 2 s . co m*/ // I2P: // Avoid interference with Phex by having a differently named config directory. tmpUserPath = appDataEnv + File.separator + "I2Phex" + File.separator; } else if (SystemUtils.IS_OS_MAC_OSX) { tmpUserPath = System.getProperty("user.home") + File.separator + "Library" + File.separator + "Application Support"; // I2P: // Avoid interference with Phex by having a differently named config directory. tmpUserPath = tmpUserPath + File.separator + "I2Phex" + File.separator; } else { // I2P: // Avoid interference with Phex by having a differently named config directory. tmpUserPath = System.getProperty("user.home") + File.separator + ".i2phex" + File.separator; } } else { if (!tmpUserPath.endsWith(File.separator)) { tmpUserPath = tmpUserPath + File.separator; } } File dir = new File(tmpUserPath); return dir; }
From source file:phex.utils.SystemShellExecute.java
public static void exploreFolder(File dir) throws IOException { String path;//from w ww . ja v a 2s . com try { path = dir.getCanonicalPath(); } catch (IOException ioe) { path = dir.getPath(); } String command = null; if (SystemUtils.IS_OS_WINDOWS) { command = "explorer"; } else if (SystemUtils.IS_OS_MAC_OSX) { command = "open"; } if (command == null) { return; } String[] cmdArr = new String[] { command, path }; Runtime.getRuntime().exec(cmdArr); }
From source file:phex.utils.SystemShellExecute.java
public static void launchFile(File file) throws IOException { String path;/*from www. j av a 2s .c o m*/ try { path = file.getCanonicalPath(); } catch (IOException ioe) { path = file.getPath(); } if (SystemUtils.IS_OS_WINDOWS) { WindowsShellExecute.executeViaShell(path); return; } else if (SystemUtils.IS_OS_MAC_OSX) { String command = "open"; String[] cmdArr = new String[] { command, path }; Runtime.getRuntime().exec(cmdArr); return; } else { launchOtherOsFile(path); } }
From source file:program.RunProgram.java
public static boolean isExecutableFound(workflow_properties prop) { if (config.getBoolean("UseAlternative")) { //-CASE Alternative String executable = prop.getAlternative(); if (!prop.isSet("AlternativeExecutable") || executable.equals("")) return false; return (Util.FileExists(executable)); }/*from w w w. j a v a 2 s. co m*/ //--CASE WebServices or internal application (java code) if (prop.getBoolean("WebServices") || prop.getBoolean("InternalArmadilloApplication")) { return true; } else if (SystemUtils.IS_OS_WINDOWS) { //--Windows String executable = prop.getExecutable(); if (!prop.isSet("Executable") || executable.equals("")) return false; return (Util.FileExists(executable)); } else if (config.getBoolean("MacOSX") || SystemUtils.IS_OS_MAC_OSX) { //--CASE MAC OS X String executable = prop.getExecutableMacOSX(); if (!prop.isSet("ExecutableMacOSX") || executable.equals("")) return false; return (Util.FileExists(executable)); } else if (config.getBoolean("Linux") || SystemUtils.IS_OS_LINUX || SystemUtils.IS_OS_UNIX) { //--CASE Linux? String executable = prop.getExecutableLinux(); if (!prop.isSet("ExecutableLinux") || executable.equals("")) return false; return (Util.FileExists(executable)); } return false; }
From source file:results.report.java
/** * Return an HTML String with System information... * @return // w w w . j a va 2 s .c om */ public String printSystemInfo() { StringBuilder st = new StringBuilder(); st.append("<br>Compiler found: " + config.isCompilerFound() + "<br>"); st.append("Developper mode: " + config.isDevelopperMode() + "<br>"); st.append("Windows :" + SystemUtils.IS_OS_WINDOWS + "<br>"); st.append("MacOSX :" + SystemUtils.IS_OS_MAC_OSX + "<br>"); st.append("Linux :" + SystemUtils.IS_OS_LINUX + "<br>"); st.append("Memory: " + PrintMemory() + "<br >"); return st.toString(); }
From source file:ru.apertum.qsystem.common.QLog.java
private QLog() { boolean isDebugin = false; boolean isDem = false; boolean isPlug = true; boolean isTerminal = false; boolean isButtons = false; switch (loggerType) { case 0://? logger = Logger.getLogger("server.file"); break;/*w w w . j av a 2s . c o m*/ case 1:// logger = Logger.getLogger("client.file"); break; case 2://? logger = Logger.getLogger("reception.file"); break; case 3:// logger = Logger.getLogger("admin.file"); break; case 4:// logger = Logger.getLogger("welcome.file"); break; case 5:// logger = Logger.getLogger("user_buttons.file"); break; default: throw new AssertionError(); } // , ?, ? for (int i = 0; i < args1.length; i++) { // , if (KEY_DEBUG.equalsIgnoreCase(args1[i])) { switch (loggerType) { case 0://? logger = Logger.getLogger("server.file.info.trace"); break; case 1:// logger = Logger.getLogger("client.file.info.trace"); break; case 2://? logger = Logger.getLogger("reception.file.info.trace"); break; case 3:// logger = Logger.getLogger("admin.file.info.trace"); break; case 4:// logger = Logger.getLogger("welcome.file.info.trace"); break; case 5:// logger = Logger.getLogger("user_buttons.file.info.trace"); break; default: throw new AssertionError(); } isDebugin = true; } // , if (KEY_LOG_INFO.equalsIgnoreCase(args1[i])) { isDebugin = true; switch (loggerType) { case 0://? logger = Logger.getLogger("server.file.info"); break; case 1:// logger = Logger.getLogger("client.file.info"); break; case 2://? logger = Logger.getLogger("reception.file.info"); break; case 3:// logger = Logger.getLogger("admin.file.info"); break; case 4:// logger = Logger.getLogger("welcome.file.info"); break; case 5:// logger = Logger.getLogger("user_buttons.file.info"); break; default: throw new AssertionError(); } } if (!isIDE && SystemUtils.IS_OS_WINDOWS) { // ? final Enumeration<Logger> lgs = logger.getLoggerRepository().getCurrentLoggers(); while (lgs.hasMoreElements()) { final Logger lg = lgs.nextElement(); final Enumeration<Appender> aps = lg.getAllAppenders(); while (aps.hasMoreElements()) { final Appender ap = aps.nextElement(); if (ap instanceof ConsoleAppender) { ((ConsoleAppender) ap).setEncoding("cp866"); ((ConsoleAppender) ap).activateOptions(); } } } } // , ?. ? if (KEY_DEMO.equalsIgnoreCase(args1[i])) { isDem = true; } // , ? . if (KEY_NOPLUGINS.equalsIgnoreCase(args1[i])) { isPlug = false; } // , ? ?. if (KEY_TERMINAL.equalsIgnoreCase(args1[i])) { isTerminal = true; } // , ? ? ?. if (KEY_WELCOME_BTN.equalsIgnoreCase(args1[i])) { isButtons = true; } // , ?. if (KEY_PAUSE.equalsIgnoreCase(args1[i])) { if (i < args1.length - 1 && args1[i + 1].matches("^-?\\d+$")) { try { Thread.sleep(Integer.parseInt(args1[i + 1]) * 1000); } catch (InterruptedException ex) { } } } // , ? ? . ? . if (KEY_DELAY_INVITE_FIRST.equalsIgnoreCase(args1[i])) { if (i < args1.length - 1 && args1[i + 1].matches("^-?\\d+$")) { pauseFirst = Integer.parseInt(args1[i + 1]); } } } /*if (!isDebugin) { final Properties settings = new Properties(); final InputStream inStream = settings.getClass().getResourceAsStream("/ru/apertum/qsystem/common/version.properties"); try { settings.load(inStream); } catch (IOException ex) { throw new ClientException(" ? ?. " + ex); } }*/ isDebug = isDebugin; isDemo = isDem; plaginable = isPlug; terminal = isTerminal; buttons = isButtons; if ("server.file.info.trace".equalsIgnoreCase(logger.getName())) { logRep = Logger.getLogger("reports.file.info.trace"); logQUser = Logger.getLogger("quser.file.info.trace"); } else { // , if ("server.file.info".equalsIgnoreCase(logger.getName())) { logRep = Logger.getLogger("reports.file.info"); logQUser = Logger.getLogger("quser.file.info"); } } }
From source file:sernet.gs.ui.rcp.main.logging.LoggerInitializer.java
private LogDirectoryProvider getLogDirectoryProvider() { if (SystemUtils.IS_OS_WINDOWS) { return new WindowsLogDirectory(currentLogFilePath); } else {/*w w w. jav a 2 s. c o m*/ return new UnixLogDirectory(currentLogFilePath); } }
From source file:sernet.verinice.search.ElasticsearchClientFactory.java
/** * sets platform dependent fs for storing the index * see https://www.elastic.co/guide/en/elasticsearch/reference/current/index-modules-store.html * this should be "mmapfs" on win64 and "simplefs" on win32 and "niofs" else **//*from w ww . j a v a 2s. co m*/ private ImmutableSettings.Builder setOSDependentFileSystem(ImmutableSettings.Builder builder) { String fileSystem = ""; if (SystemUtils.IS_OS_WINDOWS) { if (System.getProperty("os.arch").contains("64")) { fileSystem = "mmapfs"; } else { fileSystem = "simplefs"; } } else { fileSystem = "niofs"; } builder.put("index.store.type", fileSystem); return builder; }