openedFile = theFile;
public void generateMenuItem_ActionPerformed() {	JFileChooser chooser = getfileChooser();	UniversalFileFilter filter = new UniversalFileFilter(		new String("db"), "EPICS DB file");	chooser.resetChoosableFileFilters();	chooser.addChoosableFileFilter(filter);	chooser.setDialogTitle("Generate");	chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);	boolean jFileChooserConfirmed = false;    java.io.File theFile = null;	while(!jFileChooserConfirmed)	{		int retval = chooser.showSaveDialog(this);		if(retval == JFileChooser.CANCEL_OPTION)			return;				    theFile = chooser.getSelectedFile();		// fix ending		if (chooser.getFileFilter().getDescription().startsWith("EPICS") &&			!theFile.getName().endsWith(".db"))			theFile = new java.io.File(theFile.getAbsoluteFile()+".db");		if(theFile.exists())		{		    if(JOptionPane.showConfirmDialog(this, "The file '" + theFile.getName()		    	+ "' already exists! Overwrite?", "Confirmation", JOptionPane.YES_NO_OPTION,		    	JOptionPane.WARNING_MESSAGE) == JOptionPane.YES_OPTION)		    {				jFileChooserConfirmed = true;		    }		}		else			jFileChooserConfirmed = true;	}    if(theFile != null)    {	    GetGUIInterface cmd = (GetGUIInterface)CommandManager.getInstance().getCommand("GetGUIMenuInterface");		try		{		    cmd.getGUIMenuInterface().export(theFile);		    openedFile = theFile;		}		catch (java.io.IOException e)		{	 		Console.getInstance().println("o) Failed to save DB to file: '"	 			+ theFile.toString() + "'");		    Console.getInstance().println(e);		}	}}