Source Code Cross Referenced for TextElement.java in  » IDE-Eclipse » jdt » org » eclipse » jdt » core » dom » 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 » jdt » org.eclipse.jdt.core.dom 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*******************************************************************************
002:         * Copyright (c) 2004, 2006 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.jdt.core.dom;
011:
012:        import java.util.ArrayList;
013:        import java.util.List;
014:
015:        import org.eclipse.jdt.internal.compiler.util.Util;
016:
017:        /**
018:         * AST node for a text element within a doc comment.
019:         * <pre>
020:         * TextElement:
021:         *     Sequence of characters not including a close comment delimiter <b>*</b><b>/</b>
022:         * </pre>
023:         * 
024:         * @see Javadoc
025:         * @since 3.0
026:         */
027:        public final class TextElement extends ASTNode implements  IDocElement {
028:
029:            /**
030:             * The "test" structural property of this node type.
031:             * 
032:             * @since 3.0
033:             */
034:            public static final SimplePropertyDescriptor TEXT_PROPERTY = new SimplePropertyDescriptor(
035:                    TextElement.class, "text", String.class, MANDATORY); //$NON-NLS-1$
036:
037:            /**
038:             * A list of property descriptors (element type: 
039:             * {@link StructuralPropertyDescriptor}),
040:             * or null if uninitialized.
041:             * @since 3.0
042:             */
043:            private static final List PROPERTY_DESCRIPTORS;
044:
045:            static {
046:                List propertyList = new ArrayList(2);
047:                createPropertyList(TextElement.class, propertyList);
048:                addProperty(TEXT_PROPERTY, propertyList);
049:                PROPERTY_DESCRIPTORS = reapPropertyList(propertyList);
050:            }
051:
052:            /**
053:             * Returns a list of structural property descriptors for this node type.
054:             * Clients must not modify the result.
055:             * 
056:             * @param apiLevel the API level; one of the
057:             * <code>AST.JLS*</code> constants
058:             * @return a list of property descriptors (element type: 
059:             * {@link StructuralPropertyDescriptor})
060:             * @since 3.0
061:             */
062:            public static List propertyDescriptors(int apiLevel) {
063:                return PROPERTY_DESCRIPTORS;
064:            }
065:
066:            /**
067:             * The text element; defaults to the empty string.
068:             */
069:            private String text = Util.EMPTY_STRING;
070:
071:            /**
072:             * Creates a new AST node for a text element owned by the given AST.
073:             * The new node has an empty text string.
074:             * <p>
075:             * N.B. This constructor is package-private; all subclasses must be 
076:             * declared in the same package; clients are unable to declare 
077:             * additional subclasses.
078:             * </p>
079:             * 
080:             * @param ast the AST that is to own this node
081:             */
082:            TextElement(AST ast) {
083:                super (ast);
084:            }
085:
086:            /* (omit javadoc for this method)
087:             * Method declared on ASTNode.
088:             */
089:            final List internalStructuralPropertiesForType(int apiLevel) {
090:                return propertyDescriptors(apiLevel);
091:            }
092:
093:            /* (omit javadoc for this method)
094:             * Method declared on ASTNode.
095:             */
096:            final Object internalGetSetObjectProperty(
097:                    SimplePropertyDescriptor property, boolean get, Object value) {
098:                if (property == TEXT_PROPERTY) {
099:                    if (get) {
100:                        return getText();
101:                    } else {
102:                        setText((String) value);
103:                        return null;
104:                    }
105:                }
106:                // allow default implementation to flag the error
107:                return super .internalGetSetObjectProperty(property, get, value);
108:            }
109:
110:            /* (omit javadoc for this method)
111:             * Method declared on ASTNode.
112:             */
113:            final int getNodeType0() {
114:                return TEXT_ELEMENT;
115:            }
116:
117:            /* (omit javadoc for this method)
118:             * Method declared on ASTNode.
119:             */
120:            ASTNode clone0(AST target) {
121:                TextElement result = new TextElement(target);
122:                result
123:                        .setSourceRange(this .getStartPosition(), this 
124:                                .getLength());
125:                result.setText(getText());
126:                return result;
127:            }
128:
129:            /* (omit javadoc for this method)
130:             * Method declared on ASTNode.
131:             */
132:            final boolean subtreeMatch0(ASTMatcher matcher, Object other) {
133:                // dispatch to correct overloaded match method
134:                return matcher.match(this , other);
135:            }
136:
137:            /* (omit javadoc for this method)
138:             * Method declared on ASTNode.
139:             */
140:            void accept0(ASTVisitor visitor) {
141:                visitor.visit(this );
142:                visitor.endVisit(this );
143:            }
144:
145:            /**
146:             * Returns this node's text.
147:             * 
148:             * @return the text of this node
149:             */
150:            public String getText() {
151:                return this .text;
152:            }
153:
154:            /**
155:             * Sets the text of this node to the given value.
156:             * <p>
157:             * The text element typically includes leading and trailing
158:             * whitespace that separates it from the immediately preceding
159:             * or following elements. The text element must not include
160:             * a block comment closing delimiter "*"+"/".
161:             * </p>
162:             * 
163:             * @param text the text of this node
164:             * @exception IllegalArgumentException if the text is null
165:             * or contains a block comment closing delimiter
166:             */
167:            public void setText(String text) {
168:                if (text == null) {
169:                    throw new IllegalArgumentException();
170:                }
171:                if (text.indexOf("*/") > 0) { //$NON-NLS-1$
172:                    throw new IllegalArgumentException();
173:                }
174:                preValueChange(TEXT_PROPERTY);
175:                this .text = text;
176:                postValueChange(TEXT_PROPERTY);
177:            }
178:
179:            /* (omit javadoc for this method)
180:             * Method declared on ASTNode.
181:             */
182:            int memSize() {
183:                int size = BASE_NODE_SIZE + 1 * 4;
184:                if (this .text != Util.EMPTY_STRING) {
185:                    // everything but our empty string costs
186:                    size += stringSize(this .text);
187:                }
188:                return size;
189:            }
190:
191:            /* (omit javadoc for this method)
192:             * Method declared on ASTNode.
193:             */
194:            int treeSize() {
195:                return memSize();
196:            }
197:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.