Skip to content

Commit

Permalink
MacApplication modified to point to Preferences rather than low-level…
Browse files Browse the repository at this point in the history
… Constants
  • Loading branch information
hbitteur committed Jan 15, 2025
1 parent 7f5f27d commit a547d49
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions app/src/main/java/org/audiveris/omr/ui/MacApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public Object invoke (Object proxy,
logger.debug(name);

switch (name) {
case "handlePreferences" -> GuiActions.getInstance().defineConstants(null);
case "handlePreferences" -> GuiActions.getInstance().definePreferences(null);
case "handleQuit" -> GuiActions.getInstance().exit(null);
case "handleAbout" -> GuiActions.getInstance().showAbout(null);
case "handleOpenFile" -> {
Expand Down Expand Up @@ -127,8 +127,7 @@ private static Object getEvent (Object[] args)
if ((eventClass != null) && eventClass.isAssignableFrom(arg.getClass())) {
return arg;
}
} catch (Exception e) {
}
} catch (Exception e) {}
}
}

Expand Down Expand Up @@ -158,8 +157,7 @@ private static void setHandled (Object event)
Method handled = eventClass.getMethod("setHandled", boolean.class);
handled.invoke(event, true);
} catch (IllegalAccessException | IllegalArgumentException | NoSuchMethodException
| SecurityException | InvocationTargetException e) {
}
| SecurityException | InvocationTargetException e) {}
}

/**
Expand All @@ -181,8 +179,8 @@ public static boolean setupMacMenus ()
Object app = appClass.getDeclaredConstructor().newInstance();

//Enable the about menu item and the preferences menu item
for (String methodName : new String[]
{ "setEnabledAboutMenu", "setEnabledPreferencesMenu" }) {
for (String methodName : new String[] { "setEnabledAboutMenu",
"setEnabledPreferencesMenu" }) {
Method method = appClass.getMethod(methodName, boolean.class);
method.invoke(app, true);
}
Expand All @@ -195,8 +193,7 @@ public static boolean setupMacMenus ()
//providing an instance of this class as a callback for any method invocation
Object listenerProxy = Proxy.newProxyInstance(
MacApplication.class.getClassLoader(),
new Class<?>[]
{ listenerClass },
new Class<?>[] { listenerClass },
new MacApplication());

//Add the generated class as a hook
Expand Down

0 comments on commit a547d49

Please sign in to comment.