This is an automated email from the ASF dual-hosted git repository.
rmiddleton pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/logging-chainsaw.git
The following commit(s) were added to refs/heads/master by this push:
new f989733 Disable OSX integration on anything that is not OSX (#8)
f989733 is described below
commit f989733c5720a57db9fcd9978a4d5429247462e8
Author: Robert Middleton <[email protected]>
AuthorDate: Sat May 8 19:18:59 2021 -0400
Disable OSX integration on anything that is not OSX (#8)
* Fix OSX integration to check to see if it is supported first
---
.../apache/log4j/chainsaw/osx/OSXIntegration.java | 35 +++++++++++++---------
1 file changed, 21 insertions(+), 14 deletions(-)
diff --git a/src/main/java/org/apache/log4j/chainsaw/osx/OSXIntegration.java
b/src/main/java/org/apache/log4j/chainsaw/osx/OSXIntegration.java
index 9124099..7490435 100644
--- a/src/main/java/org/apache/log4j/chainsaw/osx/OSXIntegration.java
+++ b/src/main/java/org/apache/log4j/chainsaw/osx/OSXIntegration.java
@@ -34,21 +34,28 @@ public class OSXIntegration {
private static final Desktop desktop = Desktop.getDesktop();
public static final void init(final LogUI logUI) {
- desktop.setAboutHandler(e ->
- logUI.showAboutBox()
- );
+ if( desktop.isSupported(Desktop.Action.APP_ABOUT) ){
+ desktop.setAboutHandler(e ->
+ logUI.showAboutBox()
+ );
+ }
- desktop.setPreferencesHandler(e ->
- logUI.showApplicationPreferences()
- );
- desktop.setQuitHandler((e, r) -> {
- if (
- logUI.exit()) {
- r.performQuit();
- } else {
- r.cancelQuit();
+ if( desktop.isSupported(Desktop.Action.APP_PREFERENCES) ){
+ desktop.setPreferencesHandler(e ->
+ logUI.showApplicationPreferences()
+ );
+ }
+
+ if( desktop.isSupported(Desktop.Action.APP_QUIT_HANDLER) ){
+ desktop.setQuitHandler((e, r) -> {
+ if (
+ logUI.exit()) {
+ r.performQuit();
+ } else {
+ r.cancelQuit();
+ }
}
- }
- );
+ );
+ }
}
}