[med-svn] [Git][med-team/jam-lib][master] 12 commits: Use git mode in watch file
Andreas Tille
gitlab at salsa.debian.org
Tue Jan 8 13:00:49 GMT 2019
Andreas Tille pushed to branch master at Debian Med / jam-lib
Commits:
82cb0c10 by Andreas Tille at 2019-01-08T12:34:46Z
Use git mode in watch file
- - - - -
c9f45553 by Andreas Tille at 2019-01-08T12:39:06Z
Drop unneeded get-orig-source script
- - - - -
1b9e90d6 by Andreas Tille at 2019-01-08T12:39:20Z
New upstream version 0.1+git20180106.740247a+dfsg
- - - - -
74a38afc by Andreas Tille at 2019-01-08T12:39:21Z
Update upstream source from tag 'upstream/0.1+git20180106.740247a+dfsg'
Update to upstream version '0.1+git20180106.740247a+dfsg'
with Debian dir bac2d7c4146b7c67f015ae8fe87aa395a9f34cf5
- - - - -
51e9cb70 by Andreas Tille at 2019-01-08T12:46:46Z
Adapt patches
- - - - -
0c0e07cb by Andreas Tille at 2019-01-08T12:47:10Z
debhelper 11
- - - - -
e262f08f by Andreas Tille at 2019-01-08T12:47:13Z
Point Vcs fields to salsa.debian.org
- - - - -
449a380f by Andreas Tille at 2019-01-08T12:47:13Z
Standards-Version: 4.3.0
- - - - -
78d9fc5c by Andreas Tille at 2019-01-08T12:53:32Z
Make sure we use a versioning sheme with higher version numbers than before
- - - - -
f485e0ec by Andreas Tille at 2019-01-08T12:54:52Z
New upstream version 0.1.git20180106.740247a+dfsg
- - - - -
09fed0ac by Andreas Tille at 2019-01-08T12:54:52Z
Update upstream source from tag 'upstream/0.1.git20180106.740247a+dfsg'
Update to upstream version '0.1.git20180106.740247a+dfsg'
with Debian dir 2a46efc2cae1232ef0e809b0105905c1a8120af3
- - - - -
9d0afb24 by Andreas Tille at 2019-01-08T12:59:11Z
Upload to unstable
- - - - -
17 changed files:
- + .gitignore
- build.xml
- debian/changelog
- debian/compat
- debian/control
- debian/copyright
- − debian/get-orig-source
- debian/patches/remove-mac-only-code.patch
- − debian/patches/remove_maconly.patch
- debian/patches/series
- debian/rules
- debian/watch
- src/jam/console/ConsoleApplication.java
- src/jam/framework/MultiDocApplication.java
- src/jam/framework/SingleDocApplication.java
- + src/jam/java9only/ApplicationAdapter.java
- src/jam/mac/Utils.java
Changes:
=====================================
.gitignore
=====================================
@@ -0,0 +1,5 @@
+# Created by .ignore support plugin (hsz.mobi)
+.gitignore
+JAM.iml
+JAM.ipr
+JAM.iws
=====================================
build.xml
=====================================
@@ -8,6 +8,7 @@
<property name="src" location="src"/>
<property name="build" location="build"/>
<property name="build-mac-only" location="build-mac-only"/>
+ <property name="build-java9-only" location="build-java9-only"/>
<property name="lib" location="lib"/>
<property name="dist" location="dist"/>
@@ -19,6 +20,7 @@
<tstamp/>
<!-- Create the build directory structure used by compile -->
<mkdir dir="${build}"/>
+ <mkdir dir="${build-java9-only}"/>
<mkdir dir="${build-mac-only}"/>
<mkdir dir="${dist}"/>
</target>
@@ -29,9 +31,10 @@
<condition property="isMac">
<os family="mac"/>
</condition>
- <javac source="1.5" target="1.5" srcdir="${src}" destdir="${build}">
+ <javac source="1.6" target="1.6" srcdir="${src}" destdir="${build}">
<include name="jam/**/*"/>
<exclude name="jam/**/maconly/*"/>
+ <exclude name="jam/**/java9only/*"/>
<!--<exclude name="org/**/maconly/*" unless = "isMac"/>-->
</javac>
<copy todir="${build}" verbose="true">
@@ -39,12 +42,32 @@
</copy>
</target>
+ <target name="compile-java9-only" depends="init">
+ <!-- Compile the java code from ${jamsrc} into ${build} -->
+ <condition property="isMac">
+ <os family="mac"/>
+ </condition>
+ <javac source="1.9" target="1.9" srcdir="${src}" destdir="${build-java9-only}">
+ <include name="jam/**/java9only/*"/>
+ </javac>
+ </target>
+
+ <target name="dist-java9-only" depends="compile-java9-only" description="generate the -java9-only distribution">
+ <!-- Create the distribution directory -->
+ <mkdir dir="${dist}"/>
+
+ <!-- create the mac-only jar file -->
+ <jar jarfile="${lib}/jam-java9-only.jar">
+ <fileset dir="${build-java9-only}" includes="**/mac*/**/*.class,*.properties"/>
+ </jar>
+ </target>
+
<target name="compile-mac-only" depends="init">
<!-- Compile the java code from ${jamsrc} into ${build} -->
<condition property="isMac">
<os family="mac"/>
</condition>
- <javac source="1.5" target="1.5" srcdir="${src}" destdir="${build-mac-only}">
+ <javac source="1.6" target="1.6" srcdir="${src}" destdir="${build-mac-only}">
<include name="jam/**/maconly/*"/>
</javac>
</target>
@@ -59,8 +82,10 @@
</jar>
</target>
+ <!-- jam-mac-only.jar should be compiled using Java 6 and then is linked in here -->
+ <!-- jam-java9-only.jar should be compiled using Java 9 and then is linked in here -->
- <target name="dist" depends="compile" description="generate the distribution">
+ <target name="dist" depends="compile, dist-java9-only, dist-mac-only" description="generate the distribution">
<!-- Create the distribution directory -->
<mkdir dir="${dist}"/>
<delete file="${dist}/jam.jar"/>
@@ -68,6 +93,7 @@
<jar jarfile="${dist}/jam.jar">
<fileset dir="${build}" includes="**/*.class,**/*.properties,**/*.png"/>
<zipgroupfileset dir="${lib}" includes="jam-mac-only.jar"/>
+ <zipgroupfileset dir="${lib}" includes="jam-java9-only.jar"/>
</jar>
</target>
=====================================
debian/changelog
=====================================
@@ -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 <tille at debian.org> Tue, 08 Jan 2019 13:55:01 +0100
+
jam-lib (0.1.20140824-2) unstable; urgency=medium
* Fix homepage
=====================================
debian/compat
=====================================
@@ -1 +1 @@
-10
+11
=====================================
debian/control
=====================================
@@ -3,16 +3,16 @@ Maintainer: Debian Med Packaging Team <debian-med-packaging at lists.alioth.debian.
Uploaders: Andreas Tille <tille at debian.org>
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
=====================================
debian/copyright
=====================================
@@ -2,6 +2,8 @@ Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: jam-lib
Upstream-Contact: Andrew Rambaut <a.rambaut at ed.ac.uk>
Source: https://github.com/rambaut/jam-lib
+Files-Excluded: */*.jar
+ */maconly
Files: *
Copyright: © 2009-2014 Andrew Rambaut <a.rambaut at ed.ac.uk>
=====================================
debian/get-orig-source deleted
=====================================
@@ -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}
=====================================
debian/patches/remove-mac-only-code.patch
=====================================
@@ -8,13 +8,13 @@ Description: Strip OSX specific things from build.xml
<property name="src" location="src"/>
<property name="build" location="build"/>
- <property name="build-mac-only" location="build-mac-only"/>
+ <property name="build-java9-only" location="build-java9-only"/>
<property name="lib" location="lib"/>
- <property name="dist" location="dist"/>
-@@ -19,16 +18,12 @@
- <tstamp/>
+@@ -21,21 +20,15 @@
<!-- Create the build directory structure used by compile -->
<mkdir dir="${build}"/>
+ <mkdir dir="${build-java9-only}"/>
- <mkdir dir="${build-mac-only}"/>
<mkdir dir="${dist}"/>
</target>
@@ -25,19 +25,40 @@ Description: Strip OSX specific things from build.xml
- <condition property="isMac">
- <os family="mac"/>
- </condition>
- <javac source="1.5" target="1.5" srcdir="${src}" destdir="${build}">
+ <javac source="1.6" target="1.6" srcdir="${src}" destdir="${build}">
<include name="jam/**/*"/>
- <exclude name="jam/**/maconly/*"/>
-@@ -39,27 +34,6 @@
- </copy>
- </target>
+- <exclude name="jam/**/maconly/*"/>
+ <exclude name="jam/**/java9only/*"/>
+- <!--<exclude name="org/**/maconly/*" unless = "isMac"/>-->
+ </javac>
+ <copy todir="${build}" verbose="true">
+ <fileset dir="${src}" includes="jam/**/*.png,jam/**/*.gif"/>
+@@ -44,9 +37,6 @@
+
+ <target name="compile-java9-only" depends="init">
+ <!-- Compile the java code from ${jamsrc} into ${build} -->
+- <condition property="isMac">
+- <os family="mac"/>
+- </condition>
+ <javac source="1.9" target="1.9" srcdir="${src}" destdir="${build-java9-only}">
+ <include name="jam/**/java9only/*"/>
+ </javac>
+@@ -56,43 +46,17 @@
+ <!-- Create the distribution directory -->
+ <mkdir dir="${dist}"/>
+- <!-- create the mac-only jar file -->
+- <jar jarfile="${lib}/jam-java9-only.jar">
+- <fileset dir="${build-java9-only}" includes="**/mac*/**/*.class,*.properties"/>
+- </jar>
+- </target>
+-
- <target name="compile-mac-only" depends="init">
- <!-- Compile the java code from ${jamsrc} into ${build} -->
- <condition property="isMac">
- <os family="mac"/>
- </condition>
-- <javac source="1.5" target="1.5" srcdir="${src}" destdir="${build-mac-only}">
+- <javac source="1.6" target="1.6" srcdir="${src}" destdir="${build-mac-only}">
- <include name="jam/**/maconly/*"/>
- </javac>
- </target>
@@ -50,17 +71,20 @@ Description: Strip OSX specific things from build.xml
- <jar jarfile="${lib}/jam-mac-only.jar">
- <fileset dir="${build-mac-only}" includes="**/mac*/**/*.class,*.properties"/>
- </jar>
-- </target>
--
--
- <target name="dist" depends="compile" description="generate the distribution">
+ </target>
+
+- <!-- jam-mac-only.jar should be compiled using Java 6 and then is linked in here -->
+ <!-- jam-java9-only.jar should be compiled using Java 9 and then is linked in here -->
+
+- <target name="dist" depends="compile, dist-java9-only, dist-mac-only" description="generate the distribution">
++ <target name="dist" depends="compile, dist-java9-only" description="generate the distribution">
<!-- Create the distribution directory -->
<mkdir dir="${dist}"/>
-@@ -67,7 +41,6 @@
+ <delete file="${dist}/jam.jar"/>
<!-- Put everything in ${build} into the jam.jar file -->
<jar jarfile="${dist}/jam.jar">
<fileset dir="${build}" includes="**/*.class,**/*.properties,**/*.png"/>
- <zipgroupfileset dir="${lib}" includes="jam-mac-only.jar"/>
+ <zipgroupfileset dir="${lib}" includes="jam-java9-only.jar"/>
</jar>
</target>
-
=====================================
debian/patches/remove_maconly.patch deleted
=====================================
@@ -1,15 +0,0 @@
-Author: Andreas Tille <tille at debian.org>
-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;
=====================================
debian/patches/series
=====================================
@@ -1,3 +1,2 @@
remove-mac-only-code.patch
javadoc.patch
-remove_maconly.patch
=====================================
debian/rules
=====================================
@@ -12,6 +12,3 @@ override_dh_auto_clean:
override_dh_auto_build:
dh_auto_build
ant -buildfile javadoc.xml
-
-get-orig-source:
- . debian/get-orig-source
=====================================
debian/watch
=====================================
@@ -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
=====================================
src/jam/console/ConsoleApplication.java
=====================================
@@ -20,25 +20,25 @@ import java.io.IOException;
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 @@ public class ConsoleApplication extends Application {
}
});
- 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 class ConsoleApplication extends Application {
}
}
- 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) {
=====================================
src/jam/framework/MultiDocApplication.java
=====================================
@@ -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 class MultiDocApplication extends Application {
}
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 class MultiDocApplication extends Application {
}
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 class MultiDocApplication extends Application {
}
}
- public DocumentFrame getUpperDocumentFrame() {
- return upperDocumentFrame;
- }
+ 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 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 @@ public class MultiDocApplication extends Application {
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() {
=====================================
src/jam/framework/SingleDocApplication.java
=====================================
@@ -26,7 +26,7 @@ public class SingleDocApplication extends Application {
}
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 class SingleDocApplication extends Application {
}
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 @@ public class SingleDocApplication extends Application {
});
}
- 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");
=====================================
src/jam/java9only/ApplicationAdapter.java
=====================================
@@ -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
=====================================
src/jam/mac/Utils.java
=====================================
@@ -15,16 +15,16 @@ import java.lang.reflect.Method;
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 class Utils {
}
- 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...
-
- Class[] defArgs = {jam.framework.Application.class};
- Method registerMethod = osxAdapter.getDeclaredMethod("registerMacOSXApplication", 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);
-// }
+ // Invoke this by reflection to avoid linking errors on other platforms...
+
+ Class[] defArgs = {jam.framework.Application.class};
+ Method registerMethod = adapter.getDeclaredMethod("registerApplication", defArgs);
+
+ 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
View it on GitLab: https://salsa.debian.org/med-team/jam-lib/compare/e28836b6fc4e3c21811d750080c61dd8227ae1dd...9d0afb24554d601ca44b1b17ff88c9755e647db0
--
View it on GitLab: https://salsa.debian.org/med-team/jam-lib/compare/e28836b6fc4e3c21811d750080c61dd8227ae1dd...9d0afb24554d601ca44b1b17ff88c9755e647db0
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20190108/889fba79/attachment-0001.html>
More information about the debian-med-commit
mailing list