[101815] trunk/dports/java/jabref
nicos at macports.org
nicos at macports.org
Sun Jan 20 06:46:21 PST 2013
Revision: 101815
https://trac.macports.org/changeset/101815
Author: nicos at macports.org
Date: 2013-01-20 06:46:21 -0800 (Sun, 20 Jan 2013)
Log Message:
-----------
jabref: update to 2.9.2
Modified Paths:
--------------
trunk/dports/java/jabref/Portfile
trunk/dports/java/jabref/files/JabRefFrame.java.diff
trunk/dports/java/jabref/files/OSXAdapter.java.diff
Modified: trunk/dports/java/jabref/Portfile
===================================================================
--- trunk/dports/java/jabref/Portfile 2013-01-20 12:33:10 UTC (rev 101814)
+++ trunk/dports/java/jabref/Portfile 2013-01-20 14:46:21 UTC (rev 101815)
@@ -4,7 +4,7 @@
PortSystem 1.0
name jabref
-version 2.9.1
+version 2.9.2
categories java
platforms darwin
license GPL-2+
@@ -19,8 +19,8 @@
distname JabRef-${version}-src
master_sites sourceforge:project/jabref/jabref/${version}
-checksums rmd160 42c635c3c40c14f299eb04f57392c361bc20dc3f \
- sha256 db609ba3c92f2d2dd12821ba837b6c7f1cb191580c40c334533bd0d0f9ba6699
+checksums rmd160 ee1e399936ea6a315edb85c992eca8c0f31b8a71 \
+ sha256 12bc7e489709bc6f57327bf8e15c6bc9ceaa600369dca6452b7c13d792215e83
worksrcdir ${name}-${version}
Modified: trunk/dports/java/jabref/files/JabRefFrame.java.diff
===================================================================
--- trunk/dports/java/jabref/files/JabRefFrame.java.diff 2013-01-20 12:33:10 UTC (rev 101814)
+++ trunk/dports/java/jabref/files/JabRefFrame.java.diff 2013-01-20 14:46:21 UTC (rev 101815)
@@ -1,89 +1,89 @@
---- src/java/net/sf/jabref/JabRefFrame.java.orig 2013-01-01 14:36:55.000000000 +0900
-+++ src/java/net/sf/jabref/JabRefFrame.java 2013-01-05 20:11:11.000000000 +0900
-@@ -610,7 +610,32 @@
- sidePaneManager.show("search");
- }
-
--
-+ // The OSXAdapter calls this method when a ".bib" file has been double-clicked from the Finder.
-+ public void openAction(String filePath) {
-+ File file = new File(filePath);
-+
-+ // Check if the file is already open.
-+ for (int i=0; i<this.getTabbedPane().getTabCount(); i++) {
-+ BasePanel bp = this.baseAt(i);
-+ if ((bp.getFile() != null) && bp.getFile().equals(file)) {
-+ //The file is already opened, so just raising its tab.
-+ this.getTabbedPane().setSelectedComponent(bp);
-+ return;
-+ }
-+ }
-+
-+ if (file.exists()) {
-+ // Run the actual open in a thread to prevent the program
-+ // locking until the file is loaded.
-+ final File theFile = new File(filePath);
-+ (new Thread() {
-+ public void run() {
-+ open.openIt(theFile, true);
-+ }
-+ }).start();
-+ }
-+ }
-+
- AboutAction aboutAction = new AboutAction();
- class AboutAction
- extends AbstractAction {
-@@ -815,28 +840,30 @@
- private void macOSXRegistration() {
- if (Globals.osName.equals(Globals.MAC)) {
- try {
-- Class<?> osxAdapter = Class.forName("osxadapter.OSXAdapter");
--
-- Class<?>[] defArgs = {
-- JabRefFrame.class};
-- Method registerMethod = osxAdapter.getDeclaredMethod(
-- "registerMacOSXApplication", defArgs);
-- if (registerMethod != null) {
-- Object[] args = {
-- this};
-- registerMethod.invoke(osxAdapter, args);
-- }
-- // This is slightly gross. to reflectively access methods with boolean args,
-- // use "boolean.class", then pass a Boolean object in as the arg, which apparently
--
-- defArgs[0] = boolean.class;
-- Method prefsEnableMethod = osxAdapter.getDeclaredMethod("enablePrefs",
-- defArgs);
-- if (prefsEnableMethod != null) {
-- Object args[] = {
-- Boolean.TRUE};
-- prefsEnableMethod.invoke(osxAdapter, args);
-- }
-+ Class<?> osxAdapter = Class.forName("osxadapter.OSXAdapter");
-+
-+ Class<?>[] defArgs = {Object.class, Method.class};
-+ Class<?> thisClass = JabRefFrame.class;
-+ Method registerMethod = osxAdapter.getDeclaredMethod("setAboutHandler", defArgs);
-+ if (registerMethod != null) {
-+ Object[] args = {this, thisClass.getDeclaredMethod("about", (Class[])null)};
-+ registerMethod.invoke(osxAdapter, args);
-+ }
-+ registerMethod = osxAdapter.getDeclaredMethod("setPreferencesHandler", defArgs);
-+ if (registerMethod != null) {
-+ Object[] args = {this, thisClass.getDeclaredMethod("preferences", (Class[])null)};
-+ registerMethod.invoke(osxAdapter, args);
-+ }
-+ registerMethod = osxAdapter.getDeclaredMethod("setQuitHandler", defArgs);
-+ if (registerMethod != null) {
-+ Object[] args = {this, thisClass.getDeclaredMethod("quit", (Class[])null)};
-+ registerMethod.invoke(osxAdapter, args);
-+ }
-+ registerMethod = osxAdapter.getDeclaredMethod("setFileHandler", defArgs);
-+ if (registerMethod != null) {
-+ Object[] args = {this, thisClass.getDeclaredMethod("openAction", new Class[] { String.class })};
-+ registerMethod.invoke(osxAdapter, args);
-+ }
- }
- catch (NoClassDefFoundError e) {
- // This will be thrown first if the OSXAdapter is loaded on a system without the EAWT
+--- src/java/net/sf/jabref/JabRefFrame.java.orig 2013-01-13 00:12:24.000000000 +0900
++++ src/java/net/sf/jabref/JabRefFrame.java 2013-01-19 15:03:41.000000000 +0900
+@@ -610,6 +610,31 @@
+ sidePaneManager.show("search");
+ }
+
++ // The OSXAdapter calls this method when a ".bib" file has been double-clicked from the Finder.
++ public void openAction(String filePath) {
++ File file = new File(filePath);
++
++ // Check if the file is already open.
++ for (int i=0; i<this.getTabbedPane().getTabCount(); i++) {
++ BasePanel bp = this.baseAt(i);
++ if ((bp.getFile() != null) && bp.getFile().equals(file)) {
++ //The file is already opened, so just raising its tab.
++ this.getTabbedPane().setSelectedComponent(bp);
++ return;
++ }
++ }
++
++ if (file.exists()) {
++ // Run the actual open in a thread to prevent the program
++ // locking until the file is loaded.
++ final File theFile = new File(filePath);
++ (new Thread() {
++ public void run() {
++ open.openIt(theFile, true);
++ }
++ }).start();
++ }
++ }
+
+ AboutAction aboutAction = new AboutAction();
+ class AboutAction
+@@ -815,29 +840,31 @@
+ private void macOSXRegistration() {
+ if (Globals.osName.equals(Globals.MAC)) {
+ try {
+- Class<?> osxAdapter = Class.forName("osxadapter.OSXAdapter");
+-
+- Class<?>[] defArgs = {
+- JabRefFrame.class};
+- Method registerMethod = osxAdapter.getDeclaredMethod(
+- "registerMacOSXApplication", defArgs);
+- if (registerMethod != null) {
+- Object[] args = {
+- this};
+- registerMethod.invoke(osxAdapter, args);
+- }
+- // This is slightly gross. to reflectively access methods with boolean args,
+- // use "boolean.class", then pass a Boolean object in as the arg, which apparently
+-
+- defArgs[0] = boolean.class;
+- Method prefsEnableMethod = osxAdapter.getDeclaredMethod("enablePrefs",
+- defArgs);
+- if (prefsEnableMethod != null) {
+- Object args[] = {
+- Boolean.TRUE};
+- prefsEnableMethod.invoke(osxAdapter, args);
+- }
+- }
++ Class<?> osxAdapter = Class.forName("osxadapter.OSXAdapter");
++
++ Class<?>[] defArgs = {Object.class, Method.class};
++ Class<?> thisClass = JabRefFrame.class;
++ Method registerMethod = osxAdapter.getDeclaredMethod("setAboutHandler", defArgs);
++ if (registerMethod != null) {
++ Object[] args = {this, thisClass.getDeclaredMethod("about", (Class[])null)};
++ registerMethod.invoke(osxAdapter, args);
++ }
++ registerMethod = osxAdapter.getDeclaredMethod("setPreferencesHandler", defArgs);
++ if (registerMethod != null) {
++ Object[] args = {this, thisClass.getDeclaredMethod("preferences", (Class[])null)};
++ registerMethod.invoke(osxAdapter, args);
++ }
++ registerMethod = osxAdapter.getDeclaredMethod("setQuitHandler", defArgs);
++ if (registerMethod != null) {
++ Object[] args = {this, thisClass.getDeclaredMethod("quit", (Class[])null)};
++ registerMethod.invoke(osxAdapter, args);
++ }
++ registerMethod = osxAdapter.getDeclaredMethod("setFileHandler", defArgs);
++ if (registerMethod != null) {
++ Object[] args = {this, thisClass.getDeclaredMethod("openAction", new Class[] { String.class })};
++ registerMethod.invoke(osxAdapter, args);
++ }
++ }
+ catch (NoClassDefFoundError e) {
+ // This will be thrown first if the OSXAdapter is loaded on a system without the EAWT
+ // because OSXAdapter extends ApplicationAdapter in its def
Modified: trunk/dports/java/jabref/files/OSXAdapter.java.diff
===================================================================
--- trunk/dports/java/jabref/files/OSXAdapter.java.diff 2013-01-20 12:33:10 UTC (rev 101814)
+++ trunk/dports/java/jabref/files/OSXAdapter.java.diff 2013-01-20 14:46:21 UTC (rev 101815)
@@ -1,149 +1,150 @@
---- src/osx/osxadapter/OSXAdapter.java.orig 2013-01-01 14:36:56.000000000 +0900
-+++ src/osx/osxadapter/OSXAdapter.java 2013-01-05 20:06:32.000000000 +0900
+--- src/osx/osxadapter/OSXAdapter.java.orig 2013-01-13 00:12:24.000000000 +0900
++++ src/osx/osxadapter/OSXAdapter.java 2013-01-19 14:52:29.000000000 +0900
@@ -1,133 +1,203 @@
- /*
-- File: OSXAdapter.java
--
-- Description:A single class with clear, static entry points for hooking existing preferences,
-- about, quit functionality from an existing Java app into handlers for the Mac OS X
-- application menu. Useful for developers looking to support
-- multiple platforms with a single codebase, and support Mac OS X features with
-- minimal impact.
--
-- This sample is designed for Java 1.4.1 and later on Mac OS X.
--
-- Author: mdrance
--
-- Copyright: \xA9 Copyright 2003 Apple Computer, Inc. All rights reserved.
--
-- Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc.
-- ("Apple") in consideration of your agreement to the following terms, and your
-- use, installation, modification or redistribution of this Apple software
-- constitutes acceptance of these terms. If you do not agree with these terms,
-- please do not use, install, modify or redistribute this Apple software.
--
-- In consideration of your agreement to abide by the following terms, and subject
-- to these terms, Apple grants you a personal, non-exclusive license, under Apple's
-- copyrights in this original Apple software (the "Apple Software"), to use,
-- reproduce, modify and redistribute the Apple Software, with or without
-- modifications, in source and/or binary forms; provided that if you redistribute
-- the Apple Software in its entirety and without modifications, you must retain
-- this notice and the following text and disclaimers in all such redistributions of
-- the Apple Software. Neither the name, trademarks, service marks or logos of
-- Apple Computer, Inc. may be used to endorse or promote products derived from the
-- Apple Software without specific prior written permission from Apple. Except as
-- expressly stated in this notice, no other rights or licenses, express or implied,
-- are granted by Apple herein, including but not limited to any patent rights that
-- may be infringed by your derivative works or by other works in which the Apple
-- Software may be incorporated.
--
-- The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO
-- WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED
-- WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-- PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN
-- COMBINATION WITH YOUR PRODUCTS.
--
-- IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR
-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
-- GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-- ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION
-- OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT
-- (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN
-- ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--
-- Change History (most recent first):
-- 04092003 mdrance added comments
--
--*/
--/*package osxadapter;
--
--import net.sf.jabref.JabRefFrame;
--import com.apple.eawt.*;
--
--public class OSXAdapter extends ApplicationAdapter {
--
-- // pseudo-singleton model; no point in making multiple instances
-- // of the EAWT application or our adapter
-- private static OSXAdapter theAdapter;
-- private static com.apple.eawt.Application theApplication;
--
-- // reference to the app where the existing quit, about, prefs code is
-- private JabRefFrame mainApp;
--
-- private OSXAdapter (JabRefFrame inApp) {
-- mainApp = inApp;
-- }
--
-- // implemented handler methods. These are basically hooks into existing
-- // functionality from the main app, as if it came over from another platform.
-- public void handleAbout(ApplicationEvent ae) {
-- if (mainApp != null) {
-- ae.setHandled(true);
-- mainApp.about();
-- } else {
-- throw new IllegalStateException("handleAbout: MyApp instance detached from listener");
-- }
-- }
--
-- public void handlePreferences(ApplicationEvent ae) {
-- if (mainApp != null) {
-- mainApp.preferences();
-- ae.setHandled(true);
-- } else {
-- throw new IllegalStateException("handlePreferences: MyApp instance detached from listener");
-- }
-- }
--
-- public void handleQuit(ApplicationEvent ae) {
-- if (mainApp != null) {
-- /*
-- / You MUST setHandled(false) if you want to delay or cancel the quit.
-- / This is important for cross-platform development -- have a universal quit
-- / routine that chooses whether or not to quit, so the functionality is identical
-- / on all platforms. This example simply cancels the AppleEvent-based quit and
-- / defers to that universal method.
-- *//*
-- ae.setHandled(false);
-- mainApp.quit();
-- } else {
-- throw new IllegalStateException("handleQuit: MyApp instance detached from listener");
-- }
-- }
--
--
-- // The main entry-point for this functionality. This is the only method
-- // that needs to be called at runtime, and it can easily be done using
-- // reflection (see MyApp.java)
-- public static void registerMacOSXApplication(JabRefFrame inApp) {
-- if (theApplication == null) {
-- theApplication = new com.apple.eawt.Application();
-- }
--
-- if (theAdapter == null) {
-- theAdapter = new OSXAdapter(inApp);
-- }
-- theApplication.addApplicationListener(theAdapter);
-- }
--
-- // Another static entry point for EAWT functionality. Enables the
-- // "Preferences..." menu item in the application menu.
-- public static void enablePrefs(boolean enabled) {
-- if (theApplication == null) {
-- theApplication = new com.apple.eawt.Application();
-- }
-- theApplication.setEnabledPreferencesMenu(enabled);
-- }
--} */
+-/*
+- File: OSXAdapter.java
+-
+- Description:A single class with clear, static entry points for hooking existing preferences,
+- about, quit functionality from an existing Java app into handlers for the Mac OS X
+- application menu. Useful for developers looking to support
+- multiple platforms with a single codebase, and support Mac OS X features with
+- minimal impact.
+-
+- This sample is designed for Java 1.4.1 and later on Mac OS X.
+-
+- Author: mdrance
+-
+- Copyright: \xA9 Copyright 2003 Apple Computer, Inc. All rights reserved.
+-
+- Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc.
+- ("Apple") in consideration of your agreement to the following terms, and your
+- use, installation, modification or redistribution of this Apple software
+- constitutes acceptance of these terms. If you do not agree with these terms,
+- please do not use, install, modify or redistribute this Apple software.
+-
+- In consideration of your agreement to abide by the following terms, and subject
+- to these terms, Apple grants you a personal, non-exclusive license, under Apple's
+- copyrights in this original Apple software (the "Apple Software"), to use,
+- reproduce, modify and redistribute the Apple Software, with or without
+- modifications, in source and/or binary forms; provided that if you redistribute
+- the Apple Software in its entirety and without modifications, you must retain
+- this notice and the following text and disclaimers in all such redistributions of
+- the Apple Software. Neither the name, trademarks, service marks or logos of
+- Apple Computer, Inc. may be used to endorse or promote products derived from the
+- Apple Software without specific prior written permission from Apple. Except as
+- expressly stated in this notice, no other rights or licenses, express or implied,
+- are granted by Apple herein, including but not limited to any patent rights that
+- may be infringed by your derivative works or by other works in which the Apple
+- Software may be incorporated.
+-
+- The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO
+- WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED
+- WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+- PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN
+- COMBINATION WITH YOUR PRODUCTS.
+-
+- IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR
+- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+- GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+- ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION
+- OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT
+- (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN
+- ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+-
+- Change History (most recent first):
+- 04092003 mdrance added comments
+-
+-*/
+-/*package osxadapter;
+-
+-import net.sf.jabref.JabRefFrame;
+-import com.apple.eawt.*;
+-
+-public class OSXAdapter extends ApplicationAdapter {
+-
+- // pseudo-singleton model; no point in making multiple instances
+- // of the EAWT application or our adapter
+- private static OSXAdapter theAdapter;
+- private static com.apple.eawt.Application theApplication;
+-
+- // reference to the app where the existing quit, about, prefs code is
+- private JabRefFrame mainApp;
+-
+- private OSXAdapter (JabRefFrame inApp) {
+- mainApp = inApp;
+- }
+-
+- // implemented handler methods. These are basically hooks into existing
+- // functionality from the main app, as if it came over from another platform.
+- public void handleAbout(ApplicationEvent ae) {
+- if (mainApp != null) {
+- ae.setHandled(true);
+- mainApp.about();
+- } else {
+- throw new IllegalStateException("handleAbout: MyApp instance detached from listener");
+- }
+- }
+-
+- public void handlePreferences(ApplicationEvent ae) {
+- if (mainApp != null) {
+- mainApp.preferences();
+- ae.setHandled(true);
+- } else {
+- throw new IllegalStateException("handlePreferences: MyApp instance detached from listener");
+- }
+- }
+-
+- public void handleQuit(ApplicationEvent ae) {
+- if (mainApp != null) {
+- /*
+- / You MUST setHandled(false) if you want to delay or cancel the quit.
+- / This is important for cross-platform development -- have a universal quit
+- / routine that chooses whether or not to quit, so the functionality is identical
+- / on all platforms. This example simply cancels the AppleEvent-based quit and
+- / defers to that universal method.
+- *//*
+- ae.setHandled(false);
+- mainApp.quit();
+- } else {
+- throw new IllegalStateException("handleQuit: MyApp instance detached from listener");
+- }
+- }
+-
+-
+- // The main entry-point for this functionality. This is the only method
+- // that needs to be called at runtime, and it can easily be done using
+- // reflection (see MyApp.java)
+- public static void registerMacOSXApplication(JabRefFrame inApp) {
+- if (theApplication == null) {
+- theApplication = new com.apple.eawt.Application();
+- }
+-
+- if (theAdapter == null) {
+- theAdapter = new OSXAdapter(inApp);
+- }
+- theApplication.addApplicationListener(theAdapter);
+- }
+-
+- // Another static entry point for EAWT functionality. Enables the
+- // "Preferences..." menu item in the application menu.
+- public static void enablePrefs(boolean enabled) {
+- if (theApplication == null) {
+- theApplication = new com.apple.eawt.Application();
+- }
+- theApplication.setEnabledPreferencesMenu(enabled);
+- }
+-} */
++/*
+ File: OSXAdapter.java
+
+ Abstract: Hooks existing preferences/about/quit functionality from an
-+ existing Java app into handlers for the Mac OS X application menu.
-+ Uses a Proxy object to dynamically implement the
-+ com.apple.eawt.ApplicationListener interface and register it with the
-+ com.apple.eawt.Application object. This allows the complete project
-+ to be both built and run on any platform without any stubs or
-+ placeholders. Useful for developers looking to implement Mac OS X
-+ features while supporting multiple platforms with minimal impact.
++ existing Java app into handlers for the Mac OS X application menu.
++ Uses a Proxy object to dynamically implement the
++ com.apple.eawt.ApplicationListener interface and register it with the
++ com.apple.eawt.Application object. This allows the complete project
++ to be both built and run on any platform without any stubs or
++ placeholders. Useful for developers looking to implement Mac OS X
++ features while supporting multiple platforms with minimal impact.
+
+ Version: 2.0
+
@@ -189,24 +190,24 @@
+
+ */
+
-+ package osxadapter;
-+ import java.lang.reflect.*;
-+
-+
-+ public class OSXAdapter implements InvocationHandler {
-+
++package osxadapter;
++import java.lang.reflect.*;
++
++
++public class OSXAdapter implements InvocationHandler {
++
+ protected Object targetObject;
+ protected Method targetMethod;
+ protected String proxySignature;
-+
++
+ static Object macOSXApplication;
-+
++
+ // 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
+ public static void setQuitHandler(Object target, Method quitHandler) {
+ setHandler(new OSXAdapter("handleQuit", target, quitHandler));
+ }
-+
++
+ // 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
+ public static void setAboutHandler(Object target, Method aboutHandler) {
@@ -224,7 +225,7 @@
+ ex.printStackTrace();
+ }
+ }
-+
++
+ // 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
+ public static void setPreferencesHandler(Object target, Method prefsHandler) {
@@ -242,7 +243,7 @@
+ ex.printStackTrace();
+ }
+ }
-+
++
+ // 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
@@ -257,14 +258,14 @@
+ String filename = (String) getFilenameMethod.invoke(appleEvent, (Object[])null);
+ this.targetMethod.invoke(this.targetObject, new Object[] { filename });
+ } catch (Exception ex) {
-+
++
+ }
+ }
+ return true;
+ }
+ });
+ }
-+
++
+ // setHandler creates a Proxy object from the passed OSXAdapter and adds it as an ApplicationListener
+ public static void setHandler(OSXAdapter adapter) {
+ try {
@@ -284,7 +285,7 @@
+ ex.printStackTrace();
+ }
+ }
-+
++
+ // Each OSXAdapter has the name of the EAWT method it intends to listen for (handleAbout, for example),
+ // the Object that will ultimately perform the task, and the Method to be called on that Object
+ protected OSXAdapter(String proxySignature, Object target, Method handler) {
@@ -292,7 +293,7 @@
+ this.targetObject = target;
+ this.targetMethod = handler;
+ }
-+
++
+ // Override this method to perform any operations on the event
+ // that comes with the various callbacks
+ // See setFileHandler above for an example
@@ -303,7 +304,7 @@
+ }
+ return Boolean.valueOf(result.toString()).booleanValue();
+ }
-+
++
+ // InvocationHandler implementation
+ // This is the entry point for our proxy object; it is called every time an ApplicationListener method is invoked
+ public Object invoke (Object proxy, Method method, Object[] args) throws Throwable {
@@ -314,13 +315,13 @@
+ // All of the ApplicationListener methods are void; return null regardless of what happens
+ return null;
+ }
-+
++
+ // Compare the method that was called to the intended method when the OSXAdapter instance was created
+ // (e.g. handleAbout, handleQuit, handleOpenFile, etc.)
+ protected boolean isCorrectMethod(Method method, Object[] args) {
+ return (targetMethod != null && proxySignature.equals(method.getName()) && args.length == 1);
+ }
-+
++
+ // It is important to mark the ApplicationEvent as handled and cancel the default behavior
+ // This method checks for a boolean result from the proxy method and sets the event accordingly
+ protected void setApplicationEventHandled(Object event, boolean handled) {
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20130120/c70c7ca3/attachment-0001.html>
More information about the macports-changes
mailing list