KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > test > editor > suites > abbrevs > GenerateAbbreviationsList


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 /*
21  * GenerateAbbreviationsList.java
22  *
23  * Created on August 29, 2002, 1:15 PM
24  */

25
26 package org.netbeans.test.editor.suites.abbrevs;
27
28 import java.io.FileWriter JavaDoc;
29 import java.io.PrintWriter JavaDoc;
30 import java.util.Iterator JavaDoc;
31 import java.util.Map JavaDoc;
32 import java.util.Set JavaDoc;
33 import org.netbeans.jellytools.modules.editor.Abbreviations;
34
35 /**
36  *
37  * @author jl105142
38  */

39 public class GenerateAbbreviationsList {
40
41     /** Creates a new instance of GenerateAbbreviationsList */
42     public GenerateAbbreviationsList() {
43     }
44
45     /**
46      * @param args the command line arguments
47      */

48     public static void main(String JavaDoc[] args) {
49         Map JavaDoc map = Abbreviations.listAbbreviations("Java Editor");
50         Set JavaDoc keys = map.keySet();
51         Iterator JavaDoc keysIterator = keys.iterator();
52         
53         try {
54             PrintWriter JavaDoc pw = new PrintWriter JavaDoc(new FileWriter JavaDoc("/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 JavaDoc key = keysIterator.next();
63                 Object JavaDoc 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 JavaDoc ex) {
79             ex.printStackTrace();
80         }
81     }
82     
83 }
84
Popular Tags