Source Code Cross Referenced for PrintnameLoader.java in  » Testing » KeY » de » uka » ilkd » key » ocl » gf » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Testing » KeY » de.uka.ilkd.key.ocl.gf 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        //Copyright (c) Hans-Joachim Daniels 2005
002:        //
003:        //This program is free software; you can redistribute it and/or modify
004:        //it under the terms of the GNU General Public License as published by
005:        //the Free Software Foundation; either version 2 of the License, or
006:        //(at your option) any later version.
007:        //
008:        //This program is distributed in the hope that it will be useful,
009:        //but WITHOUT ANY WARRANTY; without even the implied warranty of
010:        //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
011:        //GNU General Public License for more details.
012:        //
013:        //You can either finde the file LICENSE or LICENSE.TXT in the source 
014:        //distribution or in the .jar file of this application
015:
016:        package de.uka.ilkd.key.ocl.gf;
017:
018:        import java.io.IOException;
019:        import java.util.Hashtable;
020:        import java.util.logging.Level;
021:        import java.util.logging.Logger;
022:
023:        /**
024:         * @author daniels
025:         * asks GF to print all available printnames, parses that list and generates
026:         * the suiting Printname objects.
027:         */
028:        public class PrintnameLoader extends AbstractProber {
029:            private final static Logger nogger = Logger
030:                    .getLogger(Printname.class.getName());
031:            /**
032:             * The PrintnameManager on which the read Printnames
033:             * will be registered with their fun name.
034:             */
035:            private final PrintnameManager printnameManager;
036:            /**
037:             * Here, the funs with their types get stored
038:             */
039:            private final Hashtable funTypes = new Hashtable();
040:            /**
041:             * if the Printnames should have their type appended to their display names
042:             */
043:            private final boolean loadTypes;
044:
045:            /**
046:             * an initializing constructor, does nothing except setting fields
047:             * @param gfCapsule the read/write encapsulation of GF
048:             * @param pm The PrintnameManager on which the read Printnames
049:             * will be registered with their fun name.
050:             * @param withTypes true iff the Printnames should have their type 
051:             * appended to their display names
052:             */
053:            public PrintnameLoader(GfCapsule gfCapsule, PrintnameManager pm,
054:                    boolean withTypes) {
055:                super (gfCapsule);
056:                this .printnameManager = pm;
057:                this .loadTypes = withTypes;
058:            }
059:
060:            /** 
061:             * Reads the tree child of the XML from beginning to end.
062:             * Sets autocompleted to false, if the focus position is open.
063:             */
064:            protected void readMessage() {
065:                try {
066:                    String result = gfCapsule.fromProc.readLine();
067:                    if (nogger.isLoggable(Level.FINER)) {
068:                        nogger.finer("1 " + result);
069:                    }
070:                    //first read line is <message>, but this one gets filtered out in the next line
071:                    while (result.indexOf("/message") == -1) {
072:                        result = result.trim();
073:                        if (result.startsWith("printname fun ")) {
074:                            //unescape backslashes. Probably there are more
075:                            result = Linearization.unescapeTextFromGF(result);
076:                            this .printnameManager.addNewPrintnameLine(result,
077:                                    this .funTypes);
078:                        }
079:
080:                        result = gfCapsule.fromProc.readLine();
081:                        if (nogger.isLoggable(Level.FINER)) {
082:                            nogger.finer("1 " + result);
083:                        }
084:                    }
085:                    if (nogger.isLoggable(Level.FINER)) {
086:                        nogger.finer("finished loading printnames");
087:                    }
088:                } catch (IOException e) {
089:                    System.err.println(e.getMessage());
090:                    e.printStackTrace();
091:                }
092:
093:            }
094:
095:            /**
096:             * asks GF to print a list of all available printnames and 
097:             * calls the registered PrintnameManager to register those.
098:             * @param lang The module for which the grammars should be printed. 
099:             * If lang is "" or null, the last read grammar module is used. 
100:             */
101:            protected void readPrintnames(String lang) {
102:                //before, we want the types to be read.
103:                if (this .loadTypes) {
104:                    TypesLoader tl = new TypesLoader(gfCapsule, this .funTypes);
105:                    tl.readTypes();
106:                }
107:                //prints the printnames of the last loaded grammar,
108:                String sendString = "gf pg -printer=printnames";
109:                if (lang != null && !("".equals(lang))) {
110:                    sendString = sendString + " -lang=" + lang;
111:                }
112:                nogger.fine("collecting printnames :" + sendString);
113:                send(sendString);
114:                readGfedit();
115:            }
116:
117:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.