JAL-1988 JAVA 11 enabled version with Quit, Preferences and About handlers enabled...
authorBen Soares <bsoares@dundee.ac.uk>
Thu, 8 Nov 2018 14:28:10 +0000 (14:28 +0000)
committerBen Soares <bsoares@dundee.ac.uk>
Thu, 8 Nov 2018 14:28:10 +0000 (14:28 +0000)
20 files changed:
build.xml
j11lib/00_webservices-api-osgi.jar [new file with mode: 0644]
j11lib/00_webservices-osgi.jar [new file with mode: 0644]
j11lib/gmbal-api-only.jar [new file with mode: 0644]
j11lib/ha-api.jar [new file with mode: 0644]
j11lib/istack-commons-runtime.jar [new file with mode: 0644]
j11lib/jaxb-api.jar [new file with mode: 0644]
j11lib/jaxb-osgi.jar [new file with mode: 0644]
j11lib/jaxb-runtime.jar [new file with mode: 0644]
j11lib/jaxb-xjc.jar [new file with mode: 0644]
j11lib/jaxws-api.jar [new file with mode: 0644]
j11lib/jaxws-rt.jar [new file with mode: 0644]
j11lib/policy.jar [new file with mode: 0644]
j11lib/saaj-impl.jar [new file with mode: 0644]
j11lib/stax-ex.jar [new file with mode: 0644]
j11lib/streambuffer.jar [new file with mode: 0644]
lib/saaj.jar [deleted file]
resources/lang/Messages.properties
resources/lang/Messages_es.properties
src/jalview/gui/Desktop.java

index 5ca105a..ab9e3e0 100755 (executable)
--- a/build.xml
+++ b/build.xml
     <condition property="java9">
       <equals arg1="${ant.java.version}" arg2="9"/>
     </condition>
+    <!-- Java 10 JVM args -->
+    <condition property="java10">
+      <equals arg1="${ant.java.version}" arg2="10"/>
+    </condition>
+    <!-- Java 11 JVM args -->
+    <condition property="java11">
+      <equals arg1="${ant.java.version}" arg2="11"/>
+    </condition>
+    <echo message="java version is ${ant.java.version}"/>
+    <echo message="java9 is ${java9}"/>
+    <echo message="java10 is ${java10}"/>
+    <echo message="java11 is ${java11}"/>
 
     <!-- Don't change anything below here unless you know what you are doing! -->
     <!-- Url path for WebStart in JNLP file -->
 
     <!-- build directory configuration -->
     <property name="libDir" value="lib" />
+    <property name="j11libDir" value="j11lib" />
     <property name="resourceDir" value="resources" />
     <property name="helpDir" value="help" />
     <property name="docDir" value="doc" />
         <include name="*.jar" />
         <include name="**/*.jar" />
       </fileset>
+      <fileset dir="${j11libDir}">
+        <include name="*.jar" />
+        <include name="**/*.jar" />
+      </fileset>
       <fileset dir="${libDir}">
         <include name="*.jar" />
         <include name="**/*.jar" />
diff --git a/j11lib/00_webservices-api-osgi.jar b/j11lib/00_webservices-api-osgi.jar
new file mode 100644 (file)
index 0000000..248d8b2
Binary files /dev/null and b/j11lib/00_webservices-api-osgi.jar differ
diff --git a/j11lib/00_webservices-osgi.jar b/j11lib/00_webservices-osgi.jar
new file mode 100644 (file)
index 0000000..208334e
Binary files /dev/null and b/j11lib/00_webservices-osgi.jar differ
diff --git a/j11lib/gmbal-api-only.jar b/j11lib/gmbal-api-only.jar
new file mode 100644 (file)
index 0000000..b062fdd
Binary files /dev/null and b/j11lib/gmbal-api-only.jar differ
diff --git a/j11lib/ha-api.jar b/j11lib/ha-api.jar
new file mode 100644 (file)
index 0000000..4df68e1
Binary files /dev/null and b/j11lib/ha-api.jar differ
diff --git a/j11lib/istack-commons-runtime.jar b/j11lib/istack-commons-runtime.jar
new file mode 100644 (file)
index 0000000..2fe5b82
Binary files /dev/null and b/j11lib/istack-commons-runtime.jar differ
diff --git a/j11lib/jaxb-api.jar b/j11lib/jaxb-api.jar
new file mode 100644 (file)
index 0000000..4565865
Binary files /dev/null and b/j11lib/jaxb-api.jar differ
diff --git a/j11lib/jaxb-osgi.jar b/j11lib/jaxb-osgi.jar
new file mode 100644 (file)
index 0000000..6c445cd
Binary files /dev/null and b/j11lib/jaxb-osgi.jar differ
diff --git a/j11lib/jaxb-runtime.jar b/j11lib/jaxb-runtime.jar
new file mode 100644 (file)
index 0000000..0b9ef67
Binary files /dev/null and b/j11lib/jaxb-runtime.jar differ
diff --git a/j11lib/jaxb-xjc.jar b/j11lib/jaxb-xjc.jar
new file mode 100644 (file)
index 0000000..cc1b8ac
Binary files /dev/null and b/j11lib/jaxb-xjc.jar differ
diff --git a/j11lib/jaxws-api.jar b/j11lib/jaxws-api.jar
new file mode 100644 (file)
index 0000000..806c0e1
Binary files /dev/null and b/j11lib/jaxws-api.jar differ
diff --git a/j11lib/jaxws-rt.jar b/j11lib/jaxws-rt.jar
new file mode 100644 (file)
index 0000000..bd4e04c
Binary files /dev/null and b/j11lib/jaxws-rt.jar differ
diff --git a/j11lib/policy.jar b/j11lib/policy.jar
new file mode 100644 (file)
index 0000000..8a2ef0f
Binary files /dev/null and b/j11lib/policy.jar differ
diff --git a/j11lib/saaj-impl.jar b/j11lib/saaj-impl.jar
new file mode 100644 (file)
index 0000000..7eda25c
Binary files /dev/null and b/j11lib/saaj-impl.jar differ
diff --git a/j11lib/stax-ex.jar b/j11lib/stax-ex.jar
new file mode 100644 (file)
index 0000000..5e60637
Binary files /dev/null and b/j11lib/stax-ex.jar differ
diff --git a/j11lib/streambuffer.jar b/j11lib/streambuffer.jar
new file mode 100644 (file)
index 0000000..a8f9640
Binary files /dev/null and b/j11lib/streambuffer.jar differ
diff --git a/lib/saaj.jar b/lib/saaj.jar
deleted file mode 100755 (executable)
index fcdd67d..0000000
Binary files a/lib/saaj.jar and /dev/null differ
index ae5b0e7..7a89b71 100644 (file)
@@ -31,6 +31,7 @@ action.close_all = Close all
 action.load_project = Load Project
 action.save_project = Save Project
 action.quit = Quit
+label.quit_jalview = Quit Jalview?
 action.expand_views = Expand Views
 action.gather_views = Gather Views
 action.page_setup = Page Setup...
index 555977d..756d1c9 100644 (file)
@@ -31,6 +31,7 @@ action.close_all = Cerrar todo
 action.load_project = Cargar proyecto
 action.save_project = Guardar proyecto
 action.quit = Salir
+label.quit_jalview = Salir Javliew?
 action.expand_views = Expandir vistas
 action.gather_views = Capturar vistas
 action.page_setup = ConfiguraciĆ³n de la pĆ”gina
index 41dba91..b2d63a9 100644 (file)
@@ -20,8 +20,6 @@
  */
 package jalview.gui;
 
-import static jalview.util.UrlConstants.SEQUENCE_ID;
-
 import jalview.api.AlignViewportI;
 import jalview.api.AlignmentViewPanel;
 import jalview.bin.Cache;
@@ -62,6 +60,13 @@ import java.awt.datatransfer.Clipboard;
 import java.awt.datatransfer.ClipboardOwner;
 import java.awt.datatransfer.DataFlavor;
 import java.awt.datatransfer.Transferable;
+import java.awt.desktop.AboutEvent;
+import java.awt.desktop.AboutHandler;
+import java.awt.desktop.PreferencesEvent;
+import java.awt.desktop.PreferencesHandler;
+import java.awt.desktop.QuitEvent;
+import java.awt.desktop.QuitHandler;
+import java.awt.desktop.QuitResponse;
 import java.awt.dnd.DnDConstants;
 import java.awt.dnd.DropTargetDragEvent;
 import java.awt.dnd.DropTargetDropEvent;
@@ -110,12 +115,12 @@ import javax.swing.JDesktopPane;
 import javax.swing.JInternalFrame;
 import javax.swing.JLabel;
 import javax.swing.JMenuItem;
+import javax.swing.JOptionPane;
 import javax.swing.JPanel;
 import javax.swing.JPopupMenu;
 import javax.swing.JProgressBar;
 import javax.swing.KeyStroke;
 import javax.swing.SwingUtilities;
-import javax.swing.WindowConstants;
 import javax.swing.event.HyperlinkEvent;
 import javax.swing.event.HyperlinkEvent.EventType;
 import javax.swing.event.InternalFrameAdapter;
@@ -124,6 +129,7 @@ import javax.swing.event.MenuEvent;
 import javax.swing.event.MenuListener;
 
 import org.stackoverflowusers.file.WindowsShortcut;
+
 /**
  * Jalview Desktop
  * 
@@ -349,23 +355,79 @@ public class Desktop extends jalview.jbgui.GDesktop
     doConfigureStructurePrefs();
     setTitle("Jalview " + jalview.bin.Cache.getProperty("VERSION"));
     // setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+    /* comments
+     * galore
+     * to
+     * change the line numbers
+     */
+
     if (!Platform.isAMac())
     {
-      this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
+      // this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
     }
     else
     {
-      this.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
-      this.addQuitHandler();
+      // this.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
+      java.awt.Desktop desktop = java.awt.Desktop.getDesktop();
 
+      desktop.setAboutHandler(new AboutHandler()
+      {
+        @Override
+        public void handleAbout(AboutEvent e)
+        {
+          aboutMenuItem_actionPerformed(null);
+        }
+      });
+      desktop.setPreferencesHandler(new PreferencesHandler()
+      {
+        @Override
+        public void handlePreferences(PreferencesEvent e)
+        {
+          preferences_actionPerformed(null);
+        }
+      });
+      desktop.setQuitHandler(new QuitHandler()
+      {
+        @Override
+        public void handleQuitRequestWith(QuitEvent e, QuitResponse r)
+        {
+          int n = JOptionPane.showConfirmDialog(null,
+                  MessageManager.getString("label.quit_jalview"),
+                  MessageManager.getString("action.quit"),
+                  JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE,
+                  null);
+          if (n == JOptionPane.OK_OPTION)
+          {
+            System.out.println("Shortcut Quit confirmed by user");
+            quit();
+          }
+          else
+          {
+            System.out.println("Shortcut Quit cancelled by user");
+          }
+        }
+      });
+
+      addWindowListener(new WindowAdapter()
+      {
+
+        @Override
+        public void windowClosing(WindowEvent ev)
+        {
+          quit();
+        }
+      });
     }
+
     boolean selmemusage = jalview.bin.Cache.getDefault("SHOW_MEMUSAGE",
             false);
+
     boolean showjconsole = jalview.bin.Cache.getDefault("SHOW_JAVA_CONSOLE",
             false);
     desktop = new MyDesktopPane(selmemusage);
     showMemusage.setSelected(selmemusage);
     desktop.setBackground(Color.white);
+
     getContentPane().setLayout(new BorderLayout());
     // alternate config - have scrollbars - see notes in JAL-153
     // JScrollPane sp = new JScrollPane();
@@ -376,13 +438,12 @@ public class Desktop extends jalview.jbgui.GDesktop
 
     // This line prevents Windows Look&Feel resizing all new windows to maximum
     // if previous window was maximised
-    desktop.setDesktopManager(
-            new MyDesktopManager(
-                    (Platform.isWindows() ? new DefaultDesktopManager()
-                            : Platform.isAMac()
-                                    ? new AquaInternalFrameManager(
-                                            desktop.getDesktopManager())
-                                    : desktop.getDesktopManager())));
+    desktop.setDesktopManager(new MyDesktopManager(
+            (Platform.isWindows() ? new DefaultDesktopManager()
+                    : Platform.isAMac()
+                            ? new AquaInternalFrameManager(
+                                    desktop.getDesktopManager())
+                            : desktop.getDesktopManager())));
 
     Rectangle dims = getLastKnownDimensions("");
     if (dims != null)
@@ -2396,7 +2457,7 @@ public class Desktop extends jalview.jbgui.GDesktop
           while (li.hasNext())
           {
             String link = li.next();
-            if (link.contains(SEQUENCE_ID)
+            if (link.contains(jalview.util.UrlConstants.SEQUENCE_ID)
                     && !UrlConstants.isDefaultString(link))
             {
               check = true;
@@ -2550,7 +2611,6 @@ public class Desktop extends jalview.jbgui.GDesktop
     }
   }
 
-
   /**
    * Accessor method to quickly get all the AlignmentFrames loaded.
    * 
@@ -3388,15 +3448,15 @@ public class Desktop extends jalview.jbgui.GDesktop
 
       try
       {
-      java.net.URL url = (URL) t.getTransferData(urlFlavour);
+        java.net.URL url = (URL) t.getTransferData(urlFlavour);
         // nb: java 8 osx bug https://bugs.openjdk.java.net/browse/JDK-8156099
         // means url may be null.
-      if (url != null)
-      {
-        protocols.add(DataSourceType.URL);
-        files.add(url.toString());
-        Cache.log.debug("Drop handled as URL dataflavor "
-                + files.get(files.size() - 1));
+        if (url != null)
+        {
+          protocols.add(DataSourceType.URL);
+          files.add(url.toString());
+          Cache.log.debug("Drop handled as URL dataflavor "
+                  + files.get(files.size() - 1));
           return;
         }
         else
@@ -3407,7 +3467,7 @@ public class Desktop extends jalview.jbgui.GDesktop
                     "Please ignore plist error - occurs due to problem with java 8 on OSX");
           }
           ;
-      }
+        }
       } catch (Throwable ex)
       {
         Cache.log.debug("URL drop handler failed.", ex);
@@ -3531,7 +3591,8 @@ public class Desktop extends jalview.jbgui.GDesktop
                 && (source.endsWith(".lnk") || source.endsWith(".url")
                         || source.endsWith(".site")))
         {
-          try {
+          try
+          {
             File lf = new File(files.get(f));
             // process link file to get a URL
             Cache.log.debug("Found potential link file: " + lf);
@@ -3541,10 +3602,11 @@ public class Desktop extends jalview.jbgui.GDesktop
             files.set(f, fullname);
             Cache.log.debug("Parsed real filename " + fullname
                     + " to extract protocol: " + protocols.get(f));
-          }
-          catch (Exception ex)
+          } catch (Exception ex)
           {
-            Cache.log.error("Couldn't parse "+files.get(f)+" as a link file.",ex);
+            Cache.log.error(
+                    "Couldn't parse " + files.get(f) + " as a link file.",
+                    ex);
           }
         }
       }