JAL-1499 first pass update of parsing and tests, more to come
[jalview.git] / src / jalview / io / JalviewFileChooser.java
index 1ea6795..212c482 100755 (executable)
@@ -125,8 +125,8 @@ public class JalviewFileChooser extends JFileChooser
     {
       if (getUI() instanceof javax.swing.plaf.basic.BasicFileChooserUI)
       {
-        final javax.swing.plaf.basic.BasicFileChooserUI ui = (javax.swing.plaf.basic.BasicFileChooserUI) getUI();
-        final String name = ui.getFileName().trim();
+        final javax.swing.plaf.basic.BasicFileChooserUI myui = (javax.swing.plaf.basic.BasicFileChooserUI) getUI();
+        final String name = myui.getFileName().trim();
 
         if ((name == null) || (name.length() == 0))
         {
@@ -138,10 +138,10 @@ public class JalviewFileChooser extends JFileChooser
           @Override
           public void run()
           {
-            String currentName = ui.getFileName();
+            String currentName = myui.getFileName();
             if ((currentName == null) || (currentName.length() == 0))
             {
-              ui.setFileName(name);
+              myui.setFileName(name);
             }
           }
         });
@@ -190,6 +190,10 @@ public class JalviewFileChooser extends JFileChooser
     {
       format = "PFAM";
     }
+    else if (format.toUpperCase().startsWith("MEGA"))
+    {
+      format = "MEGA";
+    }
     else if (format.toUpperCase().startsWith(PhylipFile.FILE_DESC))
     {
       format = PhylipFile.FILE_DESC;
@@ -259,14 +263,14 @@ public class JalviewFileChooser extends JFileChooser
 
   class RecentlyOpened extends JPanel
   {
-    JList list;
+    JList<String> list;
 
     public RecentlyOpened()
     {
 
       String historyItems = jalview.bin.Cache.getProperty("RECENT_FILE");
       StringTokenizer st;
-      Vector recent = new Vector();
+      Vector<String> recent = new Vector<String>();
 
       if (historyItems != null)
       {
@@ -274,11 +278,11 @@ public class JalviewFileChooser extends JFileChooser
 
         while (st.hasMoreTokens())
         {
-          recent.addElement(st.nextElement());
+          recent.addElement(st.nextToken());
         }
       }
 
-      list = new JList(recent);
+      list = new JList<String>(recent);
 
       DefaultListCellRenderer dlcr = new DefaultListCellRenderer();
       dlcr.setHorizontalAlignment(DefaultListCellRenderer.RIGHT);
@@ -304,7 +308,7 @@ public class JalviewFileChooser extends JFileChooser
       layout.putConstraint(SpringLayout.NORTH, scroller, 5,
               SpringLayout.NORTH, this);
 
-      if (new Platform().isAMac())
+      if (Platform.isAMac())
       {
         scroller.setPreferredSize(new Dimension(500, 100));
       }