Source Code Cross Referenced for SimpleCSDocumentHandler.java in  » IDE-Eclipse » Eclipse-plug-in-development » org » eclipse » pde » internal » core » text » cheatsheet » simple » 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 » IDE Eclipse » Eclipse plug in development » org.eclipse.pde.internal.core.text.cheatsheet.simple 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*******************************************************************************
002:         * Copyright (c) 2007 IBM Corporation and others.
003:         * All rights reserved. This program and the accompanying materials
004:         * are made available under the terms of the Eclipse Public License v1.0
005:         * which accompanies this distribution, and is available at
006:         * http://www.eclipse.org/legal/epl-v10.html
007:         *
008:         * Contributors:
009:         *     IBM Corporation - initial API and implementation
010:         *******************************************************************************/package org.eclipse.pde.internal.core.text.cheatsheet.simple;
011:
012:        import org.eclipse.jface.text.IDocument;
013:        import org.eclipse.pde.internal.core.text.IDocumentAttributeNode;
014:        import org.eclipse.pde.internal.core.text.IDocumentElementNode;
015:        import org.eclipse.pde.internal.core.text.NodeDocumentHandler;
016:        import org.xml.sax.Attributes;
017:        import org.xml.sax.SAXException;
018:
019:        /**
020:         * SimpleCSDocumentHandler
021:         *
022:         */
023:        public class SimpleCSDocumentHandler extends NodeDocumentHandler {
024:
025:            private SimpleCSModel fModel;
026:
027:            private String fCollapsibleParentName;
028:
029:            /**
030:             * @param reconciling
031:             */
032:            public SimpleCSDocumentHandler(SimpleCSModel model,
033:                    boolean reconciling) {
034:                super (reconciling, model.getFactory());
035:                fModel = model;
036:                fCollapsibleParentName = null;
037:            }
038:
039:            /* (non-Javadoc)
040:             * @see org.eclipse.pde.internal.core.text.DocumentHandler#getDocument()
041:             */
042:            protected IDocument getDocument() {
043:                return fModel.getDocument();
044:            }
045:
046:            /* (non-Javadoc)
047:             * @see org.eclipse.pde.internal.core.text.NodeDocumentHandler#getRootNode()
048:             */
049:            protected IDocumentElementNode getRootNode() {
050:                return (IDocumentElementNode) fModel.getSimpleCS();
051:            }
052:
053:            /**
054:             * @param tagName
055:             */
056:            private void setCollapsibleParentName(String tagName) {
057:                fCollapsibleParentName = tagName;
058:            }
059:
060:            /**
061:             * @return
062:             */
063:            private String getCollapsibleParentName() {
064:                return fCollapsibleParentName;
065:            }
066:
067:            /* (non-Javadoc)
068:             * @see org.eclipse.pde.internal.core.text.DocumentHandler#startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)
069:             */
070:            public void startElement(String uri, String localName, String name,
071:                    Attributes attributes) throws SAXException {
072:
073:                IDocumentElementNode parent = getLastParsedDocumentNode();
074:                if ((parent != null) && (parent.isContentCollapsed() == true)) {
075:                    setCollapsibleParentName(parent.getXMLTagName());
076:                    processCollapsedStartElement(name, attributes, parent);
077:                } else {
078:                    super .startElement(uri, localName, name, attributes);
079:                }
080:            }
081:
082:            /* (non-Javadoc)
083:             * @see org.eclipse.pde.internal.core.text.DocumentHandler#endElement(java.lang.String, java.lang.String, java.lang.String)
084:             */
085:            public void endElement(String uri, String localName, String name)
086:                    throws SAXException {
087:
088:                if ((getCollapsibleParentName() != null)
089:                        && (getCollapsibleParentName().equals(name))) {
090:                    setCollapsibleParentName(null);
091:                }
092:
093:                if ((getCollapsibleParentName() != null)) {
094:                    IDocumentElementNode parent = getLastParsedDocumentNode();
095:                    processCollapsedEndElement(name, parent);
096:                } else {
097:                    super .endElement(uri, localName, name);
098:                }
099:            }
100:
101:            /**
102:             * @param name
103:             * @param parent
104:             */
105:            private void processCollapsedEndElement(String name,
106:                    IDocumentElementNode parent) {
107:                // Get the document node
108:                IDocumentElementNode node = getDocumentNode(name, parent);
109:                // If the start element is self-terminating, no end tag is required
110:                boolean terminate = node.canTerminateStartTag();
111:                if (terminate) {
112:                    return;
113:                }
114:                // Serialize the document node XML end tag
115:                StringBuffer endElementString = new StringBuffer();
116:                endElementString.append('<');
117:                endElementString.append('/');
118:                endElementString.append(name);
119:                endElementString.append('>');
120:                // Set the XML end tag string as text in the text node
121:                getDocumentTextNode(endElementString.toString(), parent);
122:            }
123:
124:            /**
125:             * @param name
126:             * @param attributes
127:             * @param parent
128:             */
129:            private void processCollapsedStartElement(String name,
130:                    Attributes attributes, IDocumentElementNode parent) {
131:                // Create the document node
132:                IDocumentElementNode node = getDocumentNode(name, parent);
133:                // Create the attributes
134:                for (int i = 0; i < attributes.getLength(); i++) {
135:                    String attName = attributes.getQName(i);
136:                    String attValue = attributes.getValue(i);
137:                    IDocumentAttributeNode attribute = getDocumentAttribute(
138:                            attName, attValue, node);
139:                    if (attribute != null) {
140:                        node.setXMLAttribute(attribute);
141:                    }
142:                }
143:                // Serialize the document node XML start tag
144:                boolean terminate = node.canTerminateStartTag();
145:                String startElementString = node.writeShallow(terminate);
146:                // Set the XML start tag string as text in the text node
147:                getDocumentTextNode(startElementString, parent);
148:            }
149:
150:        }
w__w___w___.__j__a_v___a2_s___._co_m_ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.