FBFileChooser chooser=new FBFileChooser(); chooser.setFileFilter(new FindBugsAnalysisFileFilter()); boolean saving=true; while (saving) {  int value=chooser.showSaveDialog(MainFrame.this); if (value==JFileChooser.APPROVE_OPTION) { saving=false; File xmlFile = chooser.getSelectedFile();  if(!xmlFile.getName().endsWith(".xml")) xmlFile = new File(xmlFile.getAbsolutePath()+".xml");  if (xmlFile.exists()) { int response = JOptionPane.showConfirmDialog(chooser, "This analysis already exists.\nReplace it?", "Warning!", JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE);  if(response == JOptionPane.OK_OPTION) saving = false; if(response == JOptionPane.CANCEL_OPTION){ saving = true; continue; } } BugSaver.saveBugs(xmlFile, BugSet.getMainBugSet(), MainFrame.this.curProject); } else return; }  }
catch(NumberFormatException e){} }});
			public void actionPerformed(ActionEvent evt){				saveCommentsToBug(currentSelectedBugLeaf);								if (curProject==null)				{					JOptionPane.showMessageDialog(MainFrame.this,"There is no project to save");					return;				}								FBFileChooser chooser=new FBFileChooser();				chooser.setFileFilter(new FindBugsAnalysisFileFilter());				boolean saving=true;				while (saving)				{							int value=chooser.showSaveDialog(MainFrame.this);					if (value==JFileChooser.APPROVE_OPTION)					{						saving=false;						File xmlFile = chooser.getSelectedFile();												if(!xmlFile.getName().endsWith(".xml"))							xmlFile = new File(xmlFile.getAbsolutePath()+".xml");												if (xmlFile.exists())						{							int response = JOptionPane.showConfirmDialog(chooser, 									"This analysis already exists.\nReplace it?",									"Warning!", JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE);														if(response == JOptionPane.OK_OPTION)								saving = false;							if(response == JOptionPane.CANCEL_OPTION){								saving = true;								continue;							}						}						BugSaver.saveBugs(xmlFile, BugSet.getMainBugSet(), MainFrame.this.curProject);					}				else return;				}			}