1 package org.apache.ojb.tools.mapping.reversedb2.actions; 2 3 17 18 import javax.swing.JFileChooser ; 19 20 import org.apache.ojb.broker.metadata.DescriptorRepository; 21 import org.apache.ojb.tools.mapping.reversedb2.Main; 22 23 27 public class ActionSaveAsOJBRepository extends javax.swing.AbstractAction 28 { 29 DescriptorRepository aRepository; 30 31 32 public ActionSaveAsOJBRepository(DescriptorRepository paRepository) 33 { 34 super("Save As..."); 35 putValue(MNEMONIC_KEY, new Integer (java.awt.event.KeyEvent.VK_A)); 36 aRepository = paRepository; 37 } 38 39 public void actionPerformed(java.awt.event.ActionEvent evt) 40 { 41 String lastPath = Main.getProperties().getProperty("lastFileChooserPosition"); 42 javax.swing.JFileChooser fileChooser = new javax.swing.JFileChooser (lastPath); 43 if (fileChooser.showSaveDialog((java.awt.Component )evt.getSource())==JFileChooser.APPROVE_OPTION) 44 { 45 final java.io.File selectedFile = fileChooser.getSelectedFile(); 46 Main.getProperties().setProperty("lastFileChooserPosition", selectedFile.getParentFile().getAbsolutePath()); 47 Main.getProperties().storeProperties(""); 48 49 new ActionSaveOJBRepository(aRepository, selectedFile).actionPerformed(evt); 50 51 70 } 71 } 72 } 73 | Popular Tags |