public static void bindToApplicationMenu(final SweetHome3D homeApplication) {
Application macosxApplication = Application.getApplication();
// Create a default controller for an empty home and disable unrelated actions
final HomeController defaultController =
homeApplication.createHomeFrameController(homeApplication.createHome()).getHomeController();
final HomePane defaultHomeView = (HomePane)defaultController.getView();
for (HomePane.ActionType action : HomePane.ActionType.values()) {
switch (action) {
case ABOUT :
case NEW_HOME :
case OPEN :
case DELETE_RECENT_HOMES :
case HELP :
break;
default :
defaultHomeView.setEnabled(action, false);
}
}
final JMenuBar defaultMenuBar = defaultHomeView.getJMenuBar();
JFrame frame;
try {
if (UIManager.getLookAndFeel().getClass().getName().equals(UIManager.getSystemLookAndFeelClassName())) {
macosxApplication.setDefaultMenuBar(defaultMenuBar);
addWindowMenu(null, defaultMenuBar, homeApplication, true);