1 19 20 package edu.umd.cs.findbugs.gui2; 21 22 import java.io.File ; 23 import java.io.FileNotFoundException ; 24 import java.io.FileOutputStream ; 25 import java.io.IOException ; 26 import java.io.OutputStream ; 27 import java.util.Iterator ; 28 29 import javax.swing.JOptionPane ; 30 31 import edu.umd.cs.findbugs.Project; 32 import edu.umd.cs.findbugs.SortedBugCollection; 33 34 39 public class BugSaver { 40 41 private static String lastPlaceSaved; 42 public static void saveBugs(OutputStream out, BugSet data, Project p) 43 { 44 SortedBugCollection col=new SortedBugCollection(); 45 Iterator <BugLeafNode> iter = data.iterator(); 46 47 while (iter.hasNext()) 48 { 49 col.add(iter.next().getBug()); 50 } 51 52 try { 53 col.writeXML(out,p); 54 } catch (IOException e) { 55 Debug.println(e); 56 } 57 } 58 59 public static void saveBugs(File out, BugSet data, Project p) 60 { 61 try { 62 out.createNewFile(); 63 saveBugs(new FileOutputStream (out),data,p); 64 lastPlaceSaved=out.getAbsolutePath(); 65 } catch (IOException e) { 66 JOptionPane.showMessageDialog(null, "An error has occured in saving your file"); 67 } 68 } 69 70 public static String getLastPlaceSaved() 71 { 72 return lastPlaceSaved; 73 } 74 75 } 76 | Popular Tags |