saving = false; dir = jfc.getSelectedFile(); File xmlFile=new File(dir.getAbsolutePath() + File.separator + dir.getName() + ".xml"); File fasFile=new File(dir.getAbsolutePath() + File.separator + dir.getName() + ".fas"); exists=xmlFile.exists() && fasFile.exists();
JOptionPane.showMessageDialog(MainFrame.this, "An error occured in saving"); return false; } projectDirectory=dir;
	private boolean projectSaveAs(){		if (curProject==null)		{			JOptionPane.showMessageDialog(MainFrame.this,"There is no project to save");			return false;		}				FBFileChooser jfc=new FBFileChooser();		jfc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);		jfc.setFileFilter(new FindBugsProjectFileFilter());		jfc.setDialogTitle("Save as...");		boolean saving = true;		boolean exists = false;		File dir=null;		while (saving)		{			int value=jfc.showSaveDialog(MainFrame.this);			if(value==JFileChooser.APPROVE_OPTION)			{				saving = false;				dir = jfc.getSelectedFile();				File xmlFile=new File(dir.getAbsolutePath() + File.separator + dir.getName() + ".xml");				File fasFile=new File(dir.getAbsolutePath() + File.separator + dir.getName() + ".fas");				exists=xmlFile.exists() && fasFile.exists();				if(exists){					int response = JOptionPane.showConfirmDialog(jfc, 							"This project already exists.\nDo you want to replace it?",							"Warning!", JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE);										if(response == JOptionPane.OK_OPTION)						saving = false;					if(response == JOptionPane.CANCEL_OPTION){						saving = true;						continue;					}				}										boolean good=save(dir);				if (good==false)				{					JOptionPane.showMessageDialog(MainFrame.this, "An error occured in saving");					return false;				}				projectDirectory=dir;							}			else				return false;		}		curProject.setProjectFileName(projectDirectory.getName());		File xmlFile=new File(dir.getAbsolutePath() + File.separator + dir.getName() + ".xml");		//If the file already existed, its already in the preferences, as well as the recent projects menu items, only add it if they change the name, otherwise everything we're storing is still accurate since all we're storing is the location of the file.		if (!exists)		{			GUISaveState.getInstance().addRecentProject(xmlFile);		}		MainFrame.this.addRecentProjectToMenu(xmlFile);		return true;	}