1 package org.objectstyle.cayenne.modeler; 2 3 import org.objectstyle.cayenne.modeler.action.AboutAction; 4 import org.objectstyle.cayenne.modeler.action.ExitAction; 5 import org.objectstyle.cayenne.modeler.util.CayenneAction; 6 7 import com.apple.eawt.ApplicationAdapter; 8 import com.apple.eawt.ApplicationEvent; 9 10 17 class MacOSXSetup { 18 19 static void configureMacOSX() { 20 com.apple.eawt.Application.getApplication().addApplicationListener(new MacEventsAdapter()); 22 } 23 24 static class MacEventsAdapter extends ApplicationAdapter { 25 26 public void handleAbout(ApplicationEvent e) { 27 if (!e.isHandled()) { 28 ((AboutAction) getAction(AboutAction.getActionName())).showAboutDialog(); 29 e.setHandled(true); 30 } 31 } 32 33 public void handleQuit(ApplicationEvent e) { 34 if (!e.isHandled()) { 35 ((ExitAction) getAction(ExitAction.getActionName())).exit(); 36 e.setHandled(true); 37 } 38 } 39 40 CayenneAction getAction(String name) { 41 return Application.getInstance().getAction(name); 42 } 43 } 44 } 45 | Popular Tags |