More info to DEBUG + docs

This commit is contained in:
nathan 2016-10-12 20:33:25 +02:00
parent 109def7db2
commit 313ad5a127

View File

@ -204,7 +204,7 @@ class SystemTray implements Menu {
return null; return null;
} }
@SuppressWarnings("ConstantConditions") @SuppressWarnings({"ConstantConditions", "StatementWithEmptyBody"})
private static void init(final boolean useNativeMenus) { private static void init(final boolean useNativeMenus) {
if (systemTray != null) { if (systemTray != null) {
return; return;
@ -221,6 +221,10 @@ class SystemTray implements Menu {
Class<? extends Menu> trayType = null; Class<? extends Menu> trayType = null;
if (DEBUG) { if (DEBUG) {
logger.debug("OS: {}", System.getProperty("os.name"));
logger.debug("Arch: {}", System.getProperty("os.arch"));
logger.debug("is AutoTraySize? {}", AUTO_TRAY_SIZE);
logger.debug("is JavaFX detected? {}", isJavaFxLoaded); logger.debug("is JavaFX detected? {}", isJavaFxLoaded);
logger.debug("is SWT detected? {}", isSwtLoaded); logger.debug("is SWT detected? {}", isSwtLoaded);
logger.debug("is using native menus? {}", useNativeMenus); logger.debug("is using native menus? {}", useNativeMenus);
@ -626,14 +630,13 @@ class SystemTray implements Menu {
// verify that we have what we are expecting. // verify that we have what we are expecting.
if (OS.isWindows() && systemTrayMenu instanceof SwingUI) { if (OS.isWindows() && systemTrayMenu instanceof SwingUI) {
// this configuration is OK. // this configuration is OK.
} } else if (useNativeMenus && systemTrayMenu instanceof NativeUI) {
else if (useNativeMenus && systemTrayMenu instanceof NativeUI) {
// this configuration is OK. // this configuration is OK.
} else if (!useNativeMenus && systemTrayMenu instanceof SwingUI) { } else if (!useNativeMenus && systemTrayMenu instanceof SwingUI) {
// this configuration is OK. // this configuration is OK.
} else { } else {
logger.error("Unable to correctly initialize the System Tray. Please write an issue and include your OS type and " + throw new RuntimeException("Unable to correctly initialize the System Tray. Please write an issue and include your " +
"configuration"); "OS type and configuration");
} }
// These install a shutdown hook in JavaFX/SWT, so that when the main window is closed -- the system tray is ALSO closed. // These install a shutdown hook in JavaFX/SWT, so that when the main window is closed -- the system tray is ALSO closed.
@ -694,7 +697,8 @@ class SystemTray implements Menu {
} }
/** /**
* Enables native menus on Linux/OSX instead of the custom swing menu. Windows will always use a custom Swing menu. * Enables native menus on Linux/OSX instead of the custom swing menu. Windows will always use a custom Swing menu. The drawback is
* that this menu is native, and sometimes native menus looks absolutely HORRID.
* <p> * <p>
* This always returns the same instance per JVM (it's a singleton), and on some platforms the system tray may not be * This always returns the same instance per JVM (it's a singleton), and on some platforms the system tray may not be
* supported, in which case this will return NULL. * supported, in which case this will return NULL.