Package ca.cgjennings.platform
Class OSXAdapter
- java.lang.Object
-
- ca.cgjennings.platform.OSXAdapter
-
- All Implemented Interfaces:
java.lang.reflect.InvocationHandler
public class OSXAdapter extends java.lang.Object implements java.lang.reflect.InvocationHandlerProxy class that reflectively installs handlers through Apple'scom.apple.eawt.Applicationclass. Adapted from Apple's OSXAdapter, which allows redistribution and modification.
-
-
Field Summary
Fields Modifier and Type Field Description protected static java.lang.ObjectmacOSXApplicationprotected java.lang.StringproxySignatureprotected java.lang.reflect.MethodtargetMethodprotected java.lang.ObjecttargetObject
-
Constructor Summary
Constructors Modifier Constructor Description protectedOSXAdapter(java.lang.String proxySignature, java.lang.Object target, java.lang.reflect.Method handler)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancallTarget(java.lang.Object appleEvent)java.lang.Objectinvoke(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args)protected booleanisCorrectMethod(java.lang.reflect.Method method, java.lang.Object[] args)static voidsetAboutHandler(java.lang.Object target, java.lang.reflect.Method aboutHandler)Pass this method an Object and Method equipped to display application info.protected voidsetApplicationEventHandled(java.lang.Object event, boolean handled)static voidsetFileHandler(java.lang.Object target, java.lang.reflect.Method fileHandler)Pass this method an Object and a Method equipped to handle document events from the Finder Documents are registered with the Finder via the CFBundleDocumentTypes dictionary in the application bundle's Info.plist.static voidsetHandler(OSXAdapter adapter)static voidsetPreferencesHandler(java.lang.Object target, java.lang.reflect.Method prefsHandler)Pass this method an Object and a Method equipped to display application options.static voidsetQuitHandler(java.lang.Object target, java.lang.reflect.Method quitHandler)Pass this method an Object and Method equipped to perform application shutdown logic.
-
-
-
Method Detail
-
setQuitHandler
public static void setQuitHandler(java.lang.Object target, java.lang.reflect.Method quitHandler)Pass this method an Object and Method equipped to perform application shutdown logic. The method passed should return a boolean stating whether or not the quit should occur.
-
setAboutHandler
public static void setAboutHandler(java.lang.Object target, java.lang.reflect.Method aboutHandler)Pass this method an Object and Method equipped to display application info. They will be called when the About menu item is selected from the application menu.
-
setPreferencesHandler
public static void setPreferencesHandler(java.lang.Object target, java.lang.reflect.Method prefsHandler)Pass this method an Object and a Method equipped to display application options. They will be called when the Preferences menu item is selected from the application menu.
-
setFileHandler
public static void setFileHandler(java.lang.Object target, java.lang.reflect.Method fileHandler)Pass this method an Object and a Method equipped to handle document events from the Finder Documents are registered with the Finder via the CFBundleDocumentTypes dictionary in the application bundle's Info.plist.
-
setHandler
public static void setHandler(OSXAdapter adapter)
-
callTarget
public boolean callTarget(java.lang.Object appleEvent) throws java.lang.reflect.InvocationTargetException, java.lang.IllegalAccessException- Throws:
java.lang.reflect.InvocationTargetExceptionjava.lang.IllegalAccessException
-
invoke
public java.lang.Object invoke(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args) throws java.lang.Throwable- Specified by:
invokein interfacejava.lang.reflect.InvocationHandler- Throws:
java.lang.Throwable
-
isCorrectMethod
protected boolean isCorrectMethod(java.lang.reflect.Method method, java.lang.Object[] args)
-
setApplicationEventHandled
protected void setApplicationEventHandled(java.lang.Object event, boolean handled)
-
-