JAL-2805 JAL-281 JAL-2847 set tree file made public as well (heh)
[jalview.git] / forester / java / src / org / forester / archaeopteryx / MainFrameApplication.java
index 9488a1c..dc93063 100644 (file)
@@ -57,6 +57,8 @@ import javax.swing.UnsupportedLookAndFeelException;
 import javax.swing.WindowConstants;
 import javax.swing.event.ChangeEvent;
 import javax.swing.event.ChangeListener;
+import javax.swing.event.InternalFrameAdapter;
+import javax.swing.event.InternalFrameEvent;
 
 import org.forester.analysis.TaxonomyDataManager;
 import org.forester.archaeopteryx.Options.CLADOGRAM_TYPE;
@@ -161,10 +163,10 @@ public final class MainFrameApplication extends MainFrame {
         setSize( MainFrameApplication.FRAME_X_SIZE, MainFrameApplication.FRAME_Y_SIZE );
         // The window listener
         setDefaultCloseOperation( WindowConstants.DO_NOTHING_ON_CLOSE );
-        addWindowListener( new WindowAdapter() {
+        addInternalFrameListener( new InternalFrameAdapter() {
 
             @Override
-            public void windowClosing( final WindowEvent e ) {
+            public void internalFrameClosing (final InternalFrameEvent e ) {
                 exit();
             }
         } );
@@ -302,14 +304,16 @@ public final class MainFrameApplication extends MainFrame {
         //        } );
         // The window listener
         setDefaultCloseOperation( WindowConstants.DO_NOTHING_ON_CLOSE );
-        addWindowListener( new WindowAdapter() {
+        addInternalFrameListener( new InternalFrameAdapter() {
 
             @Override
-            public void windowClosing( final WindowEvent e ) {
+            public void internalFrameClosing( final InternalFrameEvent e ) {
+                if (MainFrameApplication.this.getParent() == null) {
                 if ( isUnsavedDataPresent() ) {
-                    final int r = JOptionPane.showConfirmDialog( null,
-                                                                 "Exit despite potentially unsaved changes?",
-                                                                 "Exit?",
+                    final int r = JOptionPane.showConfirmDialog( _mainpanel,
+                                                                 "Close Archaeopteryx despite potentially unsaved changes?",
+                                                                 "Close viewer?",
                                                                  JOptionPane.YES_NO_OPTION );
                     if ( r != JOptionPane.YES_OPTION ) {
                         return;
@@ -321,10 +325,10 @@ public final class MainFrameApplication extends MainFrame {
                     if ( r != JOptionPane.YES_OPTION ) {
                         return;
                     }
-                }
+                }}
                 exit();
-            }
-        } );
+            
+        } });
         // The component listener
         addComponentListener( new ComponentAdapter() {
 
@@ -515,7 +519,7 @@ public final class MainFrameApplication extends MainFrame {
                     msa = FastaParser.parseMsa( is );
                 }
                 else {
-                    msa = GeneralMsaParser.parse( is );
+                    msa = GeneralMsaParser.parseMsa( is );
                 }
             }
             catch ( final MsaFormatException e ) {
@@ -1742,6 +1746,7 @@ public final class MainFrameApplication extends MainFrame {
         if ( AptxUtil.canWriteFormat( "bmp" ) ) {
             _file_jmenu.add( _write_to_bmp_item = new JMenuItem( "Export to BMP file..." ) );
         }
+        _file_jmenu.add( _write_to_eps_item = new JMenuItem("Export to EPS file...") );
         _file_jmenu.addSeparator();
         _file_jmenu.add( _print_item = new JMenuItem( "Print..." ) );
         _file_jmenu.addSeparator();
@@ -1770,6 +1775,7 @@ public final class MainFrameApplication extends MainFrame {
         customizeJMenuItem( _write_to_gif_item );
         customizeJMenuItem( _write_to_tif_item );
         customizeJMenuItem( _write_to_bmp_item );
+        customizeJMenuItem( _write_to_eps_item );
         customizeJMenuItem( _print_item );
         customizeJMenuItem( _exit_item );
         _jmenubar.add( _file_jmenu );