diff --git a/client/src/main/java/ctbrec/ui/DesktopIntegration.java b/client/src/main/java/ctbrec/ui/DesktopIntegration.java index 26743502..98bd0304 100644 --- a/client/src/main/java/ctbrec/ui/DesktopIntegration.java +++ b/client/src/main/java/ctbrec/ui/DesktopIntegration.java @@ -24,7 +24,9 @@ import javafx.scene.layout.BorderPane; public class DesktopIntegration { - private static final transient Logger LOG = LoggerFactory.getLogger(DesktopIntegration.class); + private DesktopIntegration() {} + + private static final Logger LOG = LoggerFactory.getLogger(DesktopIntegration.class); private static SystemTray tray; private static TrayIcon trayIcon; @@ -46,7 +48,7 @@ public class DesktopIntegration { } // try external helpers - String[] externalHelpers = {"kde-open5", "kde-open", "gnome-open", "xdg-open"}; + String[] externalHelpers = { "kde-open5", "kde-open", "gnome-open", "xdg-open" }; Runtime rt = Runtime.getRuntime(); for (String helper : externalHelpers) { try { @@ -81,7 +83,7 @@ public class DesktopIntegration { } // try external helpers - String[] externalHelpers = {"kde-open5", "kde-open", "gnome-open", "xdg-open"}; + String[] externalHelpers = { "kde-open5", "kde-open", "gnome-open", "xdg-open" }; Runtime rt = Runtime.getRuntime(); for (String helper : externalHelpers) { try { @@ -108,11 +110,11 @@ public class DesktopIntegration { } public static void notification(String title, String header, String msg) { - if(OS.getOsType() == OS.TYPE.LINUX) { + if (OS.getOsType() == OS.TYPE.LINUX) { notifyLinux(title, header, msg); - } else if(OS.getOsType() == OS.TYPE.WINDOWS) { + } else if (OS.getOsType() == OS.TYPE.WINDOWS) { notifyWindows(title, header, msg); - } else if(OS.getOsType() == OS.TYPE.MAC) { + } else if (OS.getOsType() == OS.TYPE.MAC) { notifyMac(title, header, msg); } else { // unknown system, try systemtray notification anyways @@ -128,11 +130,11 @@ public class DesktopIntegration { "-t", "5000", "-a", title, header, - msg.replaceAll("-", "\\\\-").replaceAll("\\s", "\\\\ "), + msg.replace("-", "\\\\-").replace("\\s", "\\\\ "), "--icon=dialog-information" }); - new Thread(new StreamRedirectThread(p.getInputStream(), System.out)).start(); - new Thread(new StreamRedirectThread(p.getErrorStream(), System.err)).start(); + new Thread(new StreamRedirectThread(p.getInputStream(), System.out)).start(); // NOSONAR + new Thread(new StreamRedirectThread(p.getErrorStream(), System.err)).start(); // NOSONAR } catch (IOException e1) { LOG.error("Notification failed", e1); } @@ -146,9 +148,9 @@ public class DesktopIntegration { notifySystemTray(title, header, msg); } - private synchronized static void notifySystemTray(String title, String header, String msg) { - if(SystemTray.isSupported()) { - if(tray == null) { + private static synchronized void notifySystemTray(String title, String header, String msg) { + if (SystemTray.isSupported()) { + if (tray == null) { LOG.debug("Creating tray icon"); tray = SystemTray.getSystemTray(); Image image = Toolkit.getDefaultToolkit().createImage(DesktopIntegration.class.getResource("/icon64.png"));