diff -Nru jam-lib-0.1.20140824/build.xml jam-lib-0.1.git20180106.740247a+dfsg/build.xml
--- jam-lib-0.1.20140824/build.xml 2015-07-19 12:58:39.000000000 +0000
+++ jam-lib-0.1.git20180106.740247a+dfsg/build.xml 2018-01-06 00:32:27.000000000 +0000
@@ -8,6 +8,7 @@
+
@@ -19,6 +20,7 @@
+
@@ -29,9 +31,10 @@
-
+
+
@@ -39,12 +42,32 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
@@ -59,8 +82,10 @@
+
+
-
+
@@ -68,6 +93,7 @@
+
diff -Nru jam-lib-0.1.20140824/debian/changelog jam-lib-0.1.git20180106.740247a+dfsg/debian/changelog
--- jam-lib-0.1.20140824/debian/changelog 2017-01-11 20:09:18.000000000 +0000
+++ jam-lib-0.1.git20180106.740247a+dfsg/debian/changelog 2019-01-08 12:55:01.000000000 +0000
@@ -1,3 +1,13 @@
+jam-lib (0.1.git20180106.740247a+dfsg-1) unstable; urgency=medium
+
+ * Use git mode in watch file
+ * Drop unneeded get-orig-source script
+ * debhelper 11
+ * Point Vcs fields to salsa.debian.org
+ * Standards-Version: 4.3.0
+
+ -- Andreas Tille Tue, 08 Jan 2019 13:55:01 +0100
+
jam-lib (0.1.20140824-2) unstable; urgency=medium
* Fix homepage
diff -Nru jam-lib-0.1.20140824/debian/compat jam-lib-0.1.git20180106.740247a+dfsg/debian/compat
--- jam-lib-0.1.20140824/debian/compat 2017-01-11 20:09:18.000000000 +0000
+++ jam-lib-0.1.git20180106.740247a+dfsg/debian/compat 2019-01-08 12:55:01.000000000 +0000
@@ -1 +1 @@
-10
+11
diff -Nru jam-lib-0.1.20140824/debian/control jam-lib-0.1.git20180106.740247a+dfsg/debian/control
--- jam-lib-0.1.20140824/debian/control 2017-01-11 20:09:18.000000000 +0000
+++ jam-lib-0.1.git20180106.740247a+dfsg/debian/control 2019-01-08 12:55:01.000000000 +0000
@@ -3,16 +3,16 @@
Uploaders: Andreas Tille
Section: java
Priority: optional
-Build-Depends: debhelper (>= 10),
+Build-Depends: debhelper (>= 11~),
javahelper
Build-Depends-Indep: default-jdk,
default-jdk-doc,
libtrove-java,
libtrove-java-doc,
ant
-Standards-Version: 3.9.8
-Vcs-Browser: https://anonscm.debian.org/cgit/debian-med/jam-lib.git
-Vcs-Git: https://anonscm.debian.org/git/debian-med/jam-lib.git
+Standards-Version: 4.3.0
+Vcs-Browser: https://salsa.debian.org/med-team/jam-lib
+Vcs-Git: https://salsa.debian.org/med-team/jam-lib.git
Homepage: https://github.com/rambaut/jam-lib
Package: libjam-java
diff -Nru jam-lib-0.1.20140824/debian/copyright jam-lib-0.1.git20180106.740247a+dfsg/debian/copyright
--- jam-lib-0.1.20140824/debian/copyright 2017-01-11 20:09:18.000000000 +0000
+++ jam-lib-0.1.git20180106.740247a+dfsg/debian/copyright 2019-01-08 12:55:01.000000000 +0000
@@ -2,6 +2,8 @@
Upstream-Name: jam-lib
Upstream-Contact: Andrew Rambaut
Source: https://github.com/rambaut/jam-lib
+Files-Excluded: */*.jar
+ */maconly
Files: *
Copyright: © 2009-2014 Andrew Rambaut
diff -Nru jam-lib-0.1.20140824/debian/get-orig-source jam-lib-0.1.git20180106.740247a+dfsg/debian/get-orig-source
--- jam-lib-0.1.20140824/debian/get-orig-source 2017-01-11 20:09:18.000000000 +0000
+++ jam-lib-0.1.git20180106.740247a+dfsg/debian/get-orig-source 1970-01-01 00:00:00.000000000 +0000
@@ -1,27 +0,0 @@
-#!/bin/sh
-
-COMPRESS=xz
-
-set -e
-
-ORIGNAME=jam-lib
-NAME=`dpkg-parsechangelog | awk '/^Source/ { print $2 }'`
-#VERSION=`dpkg-parsechangelog | awk '/^Version:/ { print $2 }' | sed 's/\([0-9\.]\+\)-[0-9]\+$/\1/'`
-
-mkdir -p ../tarballs
-cd ../tarballs
-# need to clean up the tarballs dir first because upstream tarball might
-# contain a directory with unpredictable name
-rm -rf *
-git clone --quiet https://github.com/rambaut/${ORIGNAME}.git
-cd ${ORIGNAME}
-VERSION=0.1.`git log -n 1 --format="%ad" --date=short | sed 's/-//g'`
-cd ..
-TARDIR=${NAME}-${VERSION}
-mv ${ORIGNAME} ${TARDIR}
-rm -rf ${TARDIR}/.git
-rm -rf ${TARDIR}/lib
-rm -rf ${TARDIR}/src/jam/maconly
-
-tar --owner=root --group=root --mode=a+rX -caf "$NAME"_"$VERSION".orig.tar.${COMPRESS} "${TARDIR}"
-rm -rf ${TARDIR}
diff -Nru jam-lib-0.1.20140824/debian/patches/remove-mac-only-code.patch jam-lib-0.1.git20180106.740247a+dfsg/debian/patches/remove-mac-only-code.patch
--- jam-lib-0.1.20140824/debian/patches/remove-mac-only-code.patch 2017-01-11 20:09:18.000000000 +0000
+++ jam-lib-0.1.git20180106.740247a+dfsg/debian/patches/remove-mac-only-code.patch 2019-01-08 12:55:01.000000000 +0000
@@ -8,13 +8,13 @@
-
+
-
-@@ -19,16 +18,12 @@
-
+@@ -21,21 +20,15 @@
+
-
@@ -25,19 +25,40 @@
-
-
-
-
+
-
-@@ -39,27 +34,6 @@
-
-
+-
+
+-
+
+
+
+@@ -44,9 +37,6 @@
+
+
+
+-
+-
+-
+
+
+
+@@ -56,43 +46,17 @@
+
+
+-
+-
+-
+-
+-
+-
-
-
-
-
-
--
+-
-
-
-
@@ -50,17 +71,20 @@
-
-
-
--
--
--
-
+
+
+-
+
+
+-
++
-@@ -67,7 +41,6 @@
+
-
+
-
diff -Nru jam-lib-0.1.20140824/debian/patches/remove_maconly.patch jam-lib-0.1.git20180106.740247a+dfsg/debian/patches/remove_maconly.patch
--- jam-lib-0.1.20140824/debian/patches/remove_maconly.patch 2017-01-11 20:09:18.000000000 +0000
+++ jam-lib-0.1.git20180106.740247a+dfsg/debian/patches/remove_maconly.patch 1970-01-01 00:00:00.000000000 +0000
@@ -1,15 +0,0 @@
-Author: Andreas Tille
-Last-Update: Sun, 19 Jul 2015 14:42:56 +0200
-Description: Remove OSX only code
-
---- a/src/jam/framework/MultiDocApplication.java
-+++ b/src/jam/framework/MultiDocApplication.java
-@@ -14,7 +14,7 @@
- package jam.framework;
-
- import jam.mac.Utils;
--import jam.maconly.OSXAdapter;
-+//import jam.maconly.OSXAdapter;
-
- import javax.swing.*;
- import java.io.File;
diff -Nru jam-lib-0.1.20140824/debian/patches/series jam-lib-0.1.git20180106.740247a+dfsg/debian/patches/series
--- jam-lib-0.1.20140824/debian/patches/series 2017-01-11 20:09:18.000000000 +0000
+++ jam-lib-0.1.git20180106.740247a+dfsg/debian/patches/series 2019-01-08 12:55:01.000000000 +0000
@@ -1,3 +1,2 @@
remove-mac-only-code.patch
javadoc.patch
-remove_maconly.patch
diff -Nru jam-lib-0.1.20140824/debian/rules jam-lib-0.1.git20180106.740247a+dfsg/debian/rules
--- jam-lib-0.1.20140824/debian/rules 2017-01-11 20:09:18.000000000 +0000
+++ jam-lib-0.1.git20180106.740247a+dfsg/debian/rules 2019-01-08 12:55:01.000000000 +0000
@@ -12,6 +12,3 @@
override_dh_auto_build:
dh_auto_build
ant -buildfile javadoc.xml
-
-get-orig-source:
- . debian/get-orig-source
diff -Nru jam-lib-0.1.20140824/debian/watch jam-lib-0.1.git20180106.740247a+dfsg/debian/watch
--- jam-lib-0.1.20140824/debian/watch 2017-01-11 20:09:18.000000000 +0000
+++ jam-lib-0.1.git20180106.740247a+dfsg/debian/watch 2019-01-08 12:55:01.000000000 +0000
@@ -1,4 +1,7 @@
version=4
-opts=dversionmangle=s/.*/0.No-Release/ \
- https://people.debian.org/~eriberto/ FakeWatchNoUpstreamReleaseForThisPackage-(\d\S+)\.gz
+opts="mode=git,pretty=0.1.git%cd.%h,repacksuffix=+dfsg,dversionmangle=auto,repack,compression=xz" \
+ https://github.com/rambaut/jam-lib.git HEAD
+
+# Issue asking for release tags:
+# https://github.com/rambaut/jam-lib/issues/2
diff -Nru jam-lib-0.1.20140824/.gitignore jam-lib-0.1.git20180106.740247a+dfsg/.gitignore
--- jam-lib-0.1.20140824/.gitignore 1970-01-01 00:00:00.000000000 +0000
+++ jam-lib-0.1.git20180106.740247a+dfsg/.gitignore 2018-01-06 00:32:27.000000000 +0000
@@ -0,0 +1,5 @@
+# Created by .ignore support plugin (hsz.mobi)
+.gitignore
+JAM.iml
+JAM.ipr
+JAM.iws
diff -Nru jam-lib-0.1.20140824/src/jam/console/ConsoleApplication.java jam-lib-0.1.git20180106.740247a+dfsg/src/jam/console/ConsoleApplication.java
--- jam-lib-0.1.20140824/src/jam/console/ConsoleApplication.java 2015-07-19 12:58:39.000000000 +0000
+++ jam-lib-0.1.git20180106.740247a+dfsg/src/jam/console/ConsoleApplication.java 2018-01-06 00:32:27.000000000 +0000
@@ -20,25 +20,25 @@
public class ConsoleApplication extends Application {
private ConsoleFrame consoleFrame = null;
- private boolean dontAskSave;
+ private boolean dontAskSave;
- public ConsoleApplication(String nameString, String aboutString, Icon icon, boolean dontAskSave) throws IOException {
- this(new ConsoleMenuBarFactory(), nameString, aboutString, icon, dontAskSave);
- }
+ public ConsoleApplication(String nameString, String aboutString, Icon icon, boolean dontAskSave) throws IOException {
+ this(new ConsoleMenuBarFactory(), nameString, aboutString, icon, dontAskSave);
+ }
- public ConsoleApplication(String nameString, String titleString, String aboutString, Icon icon, boolean dontAskSave) throws IOException {
- this(new ConsoleMenuBarFactory(), nameString, titleString, aboutString, icon, dontAskSave);
- }
+ public ConsoleApplication(String nameString, String titleString, String aboutString, Icon icon, boolean dontAskSave) throws IOException {
+ this(new ConsoleMenuBarFactory(), nameString, titleString, aboutString, icon, dontAskSave);
+ }
- public ConsoleApplication(MenuBarFactory menuBarFactory, String nameString, String aboutString, Icon icon, boolean dontAskSave) throws IOException {
- this(menuBarFactory, nameString, nameString, aboutString, icon, dontAskSave);
- }
+ public ConsoleApplication(MenuBarFactory menuBarFactory, String nameString, String aboutString, Icon icon, boolean dontAskSave) throws IOException {
+ this(menuBarFactory, nameString, nameString, aboutString, icon, dontAskSave);
+ }
- public ConsoleApplication(MenuBarFactory menuBarFactory, String nameString, String titleString, String aboutString, Icon icon, boolean dontAskSave) throws IOException {
+ public ConsoleApplication(MenuBarFactory menuBarFactory, String nameString, String titleString, String aboutString, Icon icon, boolean dontAskSave) throws IOException {
super(menuBarFactory, nameString, titleString, aboutString, icon);
- this.dontAskSave = dontAskSave;
+ this.dontAskSave = dontAskSave;
consoleFrame = new ConsoleFrame();
consoleFrame.initialize();
@@ -51,19 +51,18 @@
}
});
- getOpenAction().setEnabled(false);
+ getOpenAction().setEnabled(false);
}
- public void initialize() {
- if (jam.mac.Utils.isMacOSX()) {
- // If this is a Mac application then register it at this point.
- // This will result in any events such as open file being executed
- // due to files being double-clicked or dragged on to the application.
- jam.mac.Utils.macOSXRegistration(this);
- }
- }
+ public void initialize() {
+ // Register the application with the OK. Prior to Java 1.9 this was just
+ // for Mac OS X. Now it uses java.desktop.Desktop to be cross platform
+ // This will result in any events such as open file being executed
+ // due to files being double-clicked or dragged on to the application.
+ jam.mac.Utils.registerDesktopApplication(this);
+ }
- protected JFrame getDefaultFrame() { return consoleFrame; }
+ protected JFrame getDefaultFrame() { return consoleFrame; }
public DocumentFrame doNew() {
throw new RuntimeException("A ConsoleApplication cannot do a New command");
@@ -86,12 +85,12 @@
}
}
- public void doPreferences() {
- }
+ public void doPreferences() {
+ }
- public void doStop() {
+ public void doStop() {
doQuit();
- }
+ }
// Close the window when the close box is clicked
private void thisWindowClosing(java.awt.event.WindowEvent e) {
diff -Nru jam-lib-0.1.20140824/src/jam/framework/MultiDocApplication.java jam-lib-0.1.git20180106.740247a+dfsg/src/jam/framework/MultiDocApplication.java
--- jam-lib-0.1.20140824/src/jam/framework/MultiDocApplication.java 2015-07-19 12:58:39.000000000 +0000
+++ jam-lib-0.1.git20180106.740247a+dfsg/src/jam/framework/MultiDocApplication.java 2018-01-06 00:32:27.000000000 +0000
@@ -14,7 +14,6 @@
package jam.framework;
import jam.mac.Utils;
-import jam.maconly.OSXAdapter;
import javax.swing.*;
import java.io.File;
@@ -35,7 +34,7 @@
}
public MultiDocApplication(String nameString, String aboutString, Icon icon,
- String websiteURLString, String helpURLString) {
+ String websiteURLString, String helpURLString) {
super(new MultiDocMenuBarFactory(), nameString, aboutString, icon, websiteURLString, helpURLString);
}
@@ -46,27 +45,23 @@
}
public MultiDocApplication(MenuBarFactory menuBarFactory, String nameString, String aboutString, Icon icon,
- String websiteURLString, String helpURLString) {
+ String websiteURLString, String helpURLString) {
super(menuBarFactory, nameString, aboutString, icon, websiteURLString, helpURLString);
}
- public MultiDocApplication(MenuBarFactory menuBarFactory, String nameString, String titleString, String aboutString, Icon icon,
- String websiteURLString, String helpURLString) {
+ public MultiDocApplication(MenuBarFactory menuBarFactory, String nameString, String titleString, String aboutString, Icon icon,
+ String websiteURLString, String helpURLString) {
- super(menuBarFactory, nameString, titleString, aboutString, icon, websiteURLString, helpURLString);
- }
+ super(menuBarFactory, nameString, titleString, aboutString, icon, websiteURLString, helpURLString);
+ }
public final void initialize() {
- // The frameless default menubar is now handled by the OSXAdapter
- // setupFramelessMenuBar();
-
- if (jam.mac.Utils.isMacOSX()) {
- // If this is a Mac application then register it at this point.
- // This will result in any events such as open file being executed
- // due to files being double-clicked or dragged on to the application.
- jam.mac.Utils.macOSXRegistration(this);
- }
+ // Register the application with the OK. Prior to Java 1.9 this was just
+ // for Mac OS X. Now it uses java.desktop.Desktop to be cross platform
+ // This will result in any events such as open file being executed
+ // due to files being double-clicked or dragged on to the application.
+ jam.mac.Utils.registerDesktopApplication(this);
}
public void setDocumentFrameFactory(DocumentFrameFactory documentFrameFactory) {
@@ -132,21 +127,21 @@
}
}
- public DocumentFrame getUpperDocumentFrame() {
- return upperDocumentFrame;
- }
-
- public DocumentFrame getDocumentFrame(File file) {
- if (documents != null && documents.size() > 0) {
- for (DocumentFrame doc : documents) {
- if (doc != null && doc.getFile() == file) {
- return doc;
- }
- }
- }
+ public DocumentFrame getUpperDocumentFrame() {
+ return upperDocumentFrame;
+ }
+
+ public DocumentFrame getDocumentFrame(File file) {
+ if (documents != null && documents.size() > 0) {
+ for (DocumentFrame doc : documents) {
+ if (doc != null && doc.getFile() == file) {
+ return doc;
+ }
+ }
+ }
- return null;
- }
+ return null;
+ }
private void documentFrameActivated(DocumentFrame documentFrame) {
upperDocumentFrame = documentFrame;
@@ -191,16 +186,16 @@
upperDocumentFrame = documentFrame;
}
- /**
- * Create an invisible dummy frame to host the default menu bar expected by the Mac OS X application
- * This is now done in the OSXAdapter so this method is deprecated.
- */
- @Deprecated
+ /**
+ * Create an invisible dummy frame to host the default menu bar expected by the Mac OS X application
+ * This is now done in the OSXAdapter so this method is deprecated.
+ */
+ @Deprecated
private void setupFramelessMenuBar() {
if (Utils.isMacOSX() &&
- System.getProperty("apple.laf.useScreenMenuBar") != null &&
+ System.getProperty("apple.laf.useScreenMenuBar") != null &&
System.getProperty("apple.laf.useScreenMenuBar").equalsIgnoreCase("true")) {
- if (invisibleFrame == null) {
+ if (invisibleFrame == null) {
// We use reflection here because the setUndecorated() method
// only exists in Java 1.4 and up
invisibleFrame = new AbstractFrame() {
diff -Nru jam-lib-0.1.20140824/src/jam/framework/SingleDocApplication.java jam-lib-0.1.git20180106.740247a+dfsg/src/jam/framework/SingleDocApplication.java
--- jam-lib-0.1.20140824/src/jam/framework/SingleDocApplication.java 2015-07-19 12:58:39.000000000 +0000
+++ jam-lib-0.1.git20180106.740247a+dfsg/src/jam/framework/SingleDocApplication.java 2018-01-06 00:32:27.000000000 +0000
@@ -26,7 +26,7 @@
}
public SingleDocApplication(String nameString, String aboutString, Icon icon,
- String websiteURLString, String helpURLString) {
+ String websiteURLString, String helpURLString) {
super(new SingleDocMenuBarFactory(), nameString, aboutString, icon, websiteURLString, helpURLString);
}
@@ -37,19 +37,18 @@
}
public SingleDocApplication(MenuBarFactory menuBarFactory, String nameString, String aboutString, Icon icon,
- String websiteURLString, String helpURLString) {
+ String websiteURLString, String helpURLString) {
super(menuBarFactory, nameString, aboutString, icon, websiteURLString, helpURLString);
}
- public final void initialize() {
- if (jam.mac.Utils.isMacOSX()) {
- // If this is a Mac application then register it at this point.
- // This will result in any events such as open file being executed
- // due to files being double-clicked or dragged on to the application.
- jam.mac.Utils.macOSXRegistration(this);
- }
- }
+ public final void initialize() {
+ // Register the application with the OK. Prior to Java 1.9 this was just
+ // for Mac OS X. Now it uses java.desktop.Desktop to be cross platform
+ // This will result in any events such as open file being executed
+ // due to files being double-clicked or dragged on to the application.
+ jam.mac.Utils.registerDesktopApplication(this);
+ }
public void setDocumentFrame(DocumentFrame documentFrame) {
@@ -66,9 +65,9 @@
});
}
- protected JFrame getDefaultFrame() { return documentFrame; }
+ protected JFrame getDefaultFrame() { return documentFrame; }
- protected String getDocumentExtension() { return ""; }
+ protected String getDocumentExtension() { return ""; }
public DocumentFrame doNew() {
throw new RuntimeException("A SingleDocApplication cannot do a New command");
diff -Nru jam-lib-0.1.20140824/src/jam/java9only/ApplicationAdapter.java jam-lib-0.1.git20180106.740247a+dfsg/src/jam/java9only/ApplicationAdapter.java
--- jam-lib-0.1.20140824/src/jam/java9only/ApplicationAdapter.java 1970-01-01 00:00:00.000000000 +0000
+++ jam-lib-0.1.git20180106.740247a+dfsg/src/jam/java9only/ApplicationAdapter.java 2018-01-06 00:32:27.000000000 +0000
@@ -0,0 +1,96 @@
+package jam.java9only;
+
+import jam.framework.*;
+
+import javax.swing.*;
+import java.awt.*;
+import java.awt.desktop.*;
+import java.io.File;
+
+public class ApplicationAdapter implements
+ AboutHandler,
+ PreferencesHandler,
+ OpenFilesHandler,
+ PrintFilesHandler,
+ QuitHandler {
+
+ private static ApplicationAdapter theAdapter;
+
+ // reference to the app where the existing quit, about, prefs code is
+ private jam.framework.Application application;
+
+ private ApplicationAdapter(jam.framework.Application application) {
+ this.application = application;
+ }
+
+ // 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.
+ public static void registerApplication(jam.framework.Application application) {
+// if (theApplication == null) {
+// theApplication = Application.getApplication();
+// }
+
+ if (theAdapter == null) {
+ theAdapter = new ApplicationAdapter(application);
+ }
+ Desktop.getDesktop().setAboutHandler(theAdapter);
+ Desktop.getDesktop().setOpenFileHandler(theAdapter);
+ Desktop.getDesktop().setPreferencesHandler(theAdapter);
+ Desktop.getDesktop().setPrintFileHandler(theAdapter);
+ Desktop.getDesktop().setQuitHandler(theAdapter);
+
+ // Create a default menu bar that is shown when all windows are closed
+ JMenuBar defaultMenuBar = new JMenuBar();
+ if(jam.framework.Application.getMenuBarFactory() != null) {
+ jam.framework.Application.getMenuBarFactory().populateMenuBar(defaultMenuBar, null);
+ Desktop.getDesktop().setDefaultMenuBar(defaultMenuBar);
+ }
+
+ }
+
+ @Override
+ public void handleAbout(AboutEvent e) {
+ if (application != null) {
+ application.doAbout();
+ } else {
+ throw new IllegalStateException("handleAbout: Application instance detached from listener");
+ }
+ }
+
+ @Override
+ public void openFiles(OpenFilesEvent openFilesEvent) {
+ for (File file : openFilesEvent.getFiles()) {
+ application.doOpenFile(file);
+ }
+ }
+
+ @Override
+ public void handlePreferences(PreferencesEvent e) {
+ if (application != null) {
+ application.doPreferences();
+ } else {
+ throw new IllegalStateException("handlePreferences: Application instance detached from listener");
+ }
+ }
+
+ @Override
+ public void printFiles(PrintFilesEvent printFilesEvent) {
+ for (File file : printFilesEvent.getFiles()) {
+ DocumentFrame frame = application.doOpenFile(file);
+ if (frame != null) {
+ frame.doPrint();
+ }
+ }
+ }
+
+ @Override
+ public void handleQuitRequestWith(QuitEvent e, QuitResponse response) {
+ if (application != null) {
+ application.doQuit();
+ } else {
+ throw new IllegalStateException("handleQuit: Application instance detached from listener");
+ }
+
+ }
+}
\ No newline at end of file
diff -Nru jam-lib-0.1.20140824/src/jam/mac/Utils.java jam-lib-0.1.git20180106.740247a+dfsg/src/jam/mac/Utils.java
--- jam-lib-0.1.20140824/src/jam/mac/Utils.java 2015-07-19 12:58:39.000000000 +0000
+++ jam-lib-0.1.git20180106.740247a+dfsg/src/jam/mac/Utils.java 2018-01-06 00:32:27.000000000 +0000
@@ -15,16 +15,16 @@
public class Utils {
- protected static boolean MAC_OS_X;
- protected static String MAC_OS_X_VERSION;
+ private static boolean MAC_OS_X;
+ private static String MAC_OS_X_VERSION;
public static boolean isMacOSX() {
return MAC_OS_X;
}
- public static String getMacOSXVersion() {
- return MAC_OS_X_VERSION;
- }
+ public static String getMacOSXVersion() {
+ return MAC_OS_X_VERSION;
+ }
public static int getMacOSXMajorVersionNumber() {
String[] bits = Utils.getMacOSXVersion().split("\\.");
@@ -35,49 +35,47 @@
}
- public static void macOSXRegistration(jam.framework.Application application) {
- if (MAC_OS_X) {
+ public static void registerDesktopApplication(jam.framework.Application application) {
+ Class adapter = null;
- Class osxAdapter = null;
+ try {
+ adapter = Class.forName("jam.java9only.ApplicationAdapter");
+ } catch (Exception e) {
+ // do nothing...
+ }
+ if (adapter == null && MAC_OS_X) {
try {
- osxAdapter = Class.forName("jam.maconly.NewOSXAdapter");
+ // test if com.apple.eawt is present...
+ Class.forName("com.apple.eawt.AboutHandler");
+ adapter = Class.forName("jam.maconly.NewOSXAdapter");
} catch (Exception e) {
- System.err.println("This version of Mac OS X does not support the Apple EAWT.");
+ // do nothing...
}
+ }
+ if (adapter != null) {
try {
- if (osxAdapter != null) {
- // Invoke this by reflection to avoid linking errors on other platforms...
+ // Invoke this by reflection to avoid linking errors on other platforms...
- Class[] defArgs = {jam.framework.Application.class};
- Method registerMethod = osxAdapter.getDeclaredMethod("registerMacOSXApplication", defArgs);
+ Class[] defArgs = {jam.framework.Application.class};
+ Method registerMethod = adapter.getDeclaredMethod("registerApplication", defArgs);
- if (registerMethod != null) {
- Object[] args = {application};
- 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
- // gets converted for you by the reflection system.
-// defArgs[0] = boolean.class;
-// Method prefsEnableMethod = osxAdapter.getDeclaredMethod("enablePrefs", defArgs);
-// if (prefsEnableMethod != null) {
-// Object args[] = {Boolean.TRUE};
-// prefsEnableMethod.invoke(osxAdapter, args);
-// }
+ if (registerMethod != null) {
+ Object[] args = {application};
+ registerMethod.invoke(adapter, args);
}
+
} catch (Exception e) {
- System.err.println("Exception while loading the OSXAdapter:");
+ System.err.println("Exception while loading the ApplicationAdapter:");
e.printStackTrace();
}
- }
+ } // if there is no adapter then just continue without registering...
}
static {
- MAC_OS_X = System.getProperty("os.name").toLowerCase().startsWith("mac os x");
+ MAC_OS_X = System.getProperty("os.name").toLowerCase().startsWith("mac os x");
MAC_OS_X_VERSION = MAC_OS_X ? System.getProperty("os.version") : null;
}
}
\ No newline at end of file