1 19 20 25 26 package org.netbeans.test.editor.suites.abbrevs; 27 28 import java.io.FileWriter ; 29 import java.io.PrintWriter ; 30 import java.util.Iterator ; 31 import java.util.Map ; 32 import java.util.Set ; 33 import org.netbeans.jellytools.modules.editor.Abbreviations; 34 35 39 public class GenerateAbbreviationsList { 40 41 42 public GenerateAbbreviationsList() { 43 } 44 45 48 public static void main(String [] args) { 49 Map map = Abbreviations.listAbbreviations("Java Editor"); 50 Set keys = map.keySet(); 51 Iterator keysIterator = keys.iterator(); 52 53 try { 54 PrintWriter pw = new PrintWriter (new FileWriter ("/tmp/abbrevs.xml")); 55 56 pw.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"); 57 58 pw.println("<Test Name=\"Abbreviations\" Author=\"ehucka\" Version=\"1.1\">"); 59 pw.println("<TestSubTest Name=\"BasicTests\" Author=\"ehucka\" Version=\"1.0\" Own_logger=\"true\">"); 60 pw.println("<TestStep Name=\"InvokeAllActions\">"); 61 while (keysIterator.hasNext()) { 62 Object key = keysIterator.next(); 63 Object value = map.get(key); 64 65 System.err.println("\t{" + key.toString() + ", " + value.toString() + "},"); 66 pw.println("<TestStringAction Name=\"string\" String=\""+key.toString()+" \" />"); 67 pw.println("<TestLogAction Name=\"caret-end-line\" Command=\"\" />"); 68 pw.println("<TestLogAction Name=\"insert-break\" Command=\"\" />"); 69 } 70 pw.println("</TestStep>"); 71 pw.println("</TestSubTest>"); 72 pw.println("<Comment>"); 73 pw.println("<![CDATA[\"Test of invoking all abbreviations.\"]]>"); 74 pw.println("</Comment>"); 75 pw.println("</Test>\n"); 76 77 pw.close(); 78 } catch (Exception ex) { 79 ex.printStackTrace(); 80 } 81 } 82 83 } 84 | Popular Tags |