public ShellProcessBuilder pipeOutputToNull() { if (OS.isWindows()) { // >NUL on windows pipeToNullString = ">NUL"; } else { // we will "pipe" it to /dev/null on *nix pipeToNullString = ">/dev/null 2>&1"; } return this; }
private static boolean isSwingTrayLoaded() { String className; if (OS.isWindows()) { className = "sun.awt.windows.WTrayIconPeer"; } else if (OS.isMacOsX()){ className = "sun.lwawt.macosx.CTrayIcon"; } else { className = "sun.awt.X11.XTrayIconPeer"; } try { // this is important to use reflection, because if JavaFX is not being used, calling getToolkit() will initialize it... java.lang.reflect.Method m = ClassLoader.class.getDeclaredMethod("findLoadedClass", String.class); m.setAccessible(true); ClassLoader cl = ClassLoader.getSystemClassLoader(); // if we are using swing the classes are already created and we cannot fix that if it's already loaded. return (null != m.invoke(cl, className)) || (null != m.invoke(cl, "java.awt.SystemTray")); } catch (Throwable e) { if (SystemTray.DEBUG) { logger.debug("Error detecting if the Swing SystemTray is loaded, unexpected error.", e); } } return true; }
if (OS.isWindows()) { if (path.startsWith("/")) { path = path.substring(1);
if (OS.isWindows()) {
public static int getTrayImageSize() { if (TRAY_SIZE == 0) { if (OS.isLinux()) { TRAY_SIZE = GtkTheme.getIndicatorSize(); } else if (OS.isMacOsX()) { // these are the standard icon sizes. From what I can tell, they are Apple defined, and cannot be changed. if (SizeAndScalingUtil.getMacOSScaleFactor() == 2.0D) { TRAY_SIZE = 44; } else { TRAY_SIZE = 22; } } else if (OS.isWindows()) { TRAY_SIZE = User32.User32.GetSystemMetrics(SM_CYSMICON); } else { // reasonable default TRAY_SIZE = 32; } } if (TRAY_SIZE == 0) { // reasonable default TRAY_SIZE = 32; } return TRAY_SIZE; }
boolean isWindows = OS.isWindows(); boolean isMacOsX = OS.isMacOsX();
private static Class<? extends Tray> getAutoDetectTrayType() { if (OS.isWindows()) { try { return selectType(TrayType.WindowsNotifyIcon);