1 9 10 package org.enhydra.jawe.actions; 11 12 import org.enhydra.jawe.*; 13 14 import javax.swing.JMenuItem ; 15 import java.awt.event.ActionEvent ; 16 import java.io.*; 17 18 22 public class Exit extends ActionBase { 23 24 public Exit (PackageEditor editor) { 25 super(editor); 26 } 27 28 public void actionPerformed(ActionEvent e) { 29 if (JaWE.getInstance().close()) { 30 try { 31 String fileList=""; 32 for (int i = JaWE.getInstance().getRecentFilesMenu().getItemCount(); i > 0;) { 33 JMenuItem mItem=((JMenuItem )JaWE.getInstance(). 34 getRecentFilesMenu().getMenuComponent(--i)); 35 fileList+=mItem.getText().substring(2); 36 if (i>0) fileList+="\n"; 37 } 38 FileOutputStream fos = new FileOutputStream( 39 JaWEConstants.JAWE_USER_HOME + JaWEConstants.RFL_FILENAME); 40 fos.write(fileList.getBytes(JaWEConfig.getInstance().getEncoding())); 41 fos.flush(); 43 fos.close(); 44 } catch (Exception ex) {} 45 System.exit(0); 46 } 47 } 48 } 49 | Popular Tags |