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


001:        /*******************************************************************************
002:         * Copyright (c) 2000, 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.internal.core;
011:
012:        import java.util.HashMap;
013:
014:        import org.eclipse.core.resources.IResource;
015:        import org.eclipse.core.runtime.IPath;
016:        import org.eclipse.core.runtime.IProgressMonitor;
017:        import org.eclipse.jdt.core.*;
018:        import org.eclipse.jdt.core.IJavaElement;
019:        import org.eclipse.jdt.core.JavaModelException;
020:        import org.eclipse.jdt.core.WorkingCopyOwner;
021:        import org.eclipse.jdt.internal.core.util.MementoTokenizer;
022:        import org.eclipse.jdt.internal.core.util.Util;
023:
024:        public class LocalVariable extends SourceRefElement implements 
025:                ILocalVariable {
026:
027:            String name;
028:            public int declarationSourceStart, declarationSourceEnd;
029:            public int nameStart, nameEnd;
030:            String typeSignature;
031:
032:            public LocalVariable(JavaElement parent, String name,
033:                    int declarationSourceStart, int declarationSourceEnd,
034:                    int nameStart, int nameEnd, String typeSignature) {
035:
036:                super (parent);
037:                this .name = name;
038:                this .declarationSourceStart = declarationSourceStart;
039:                this .declarationSourceEnd = declarationSourceEnd;
040:                this .nameStart = nameStart;
041:                this .nameEnd = nameEnd;
042:                this .typeSignature = typeSignature;
043:            }
044:
045:            protected void closing(Object info) {
046:                // a local variable has no info
047:            }
048:
049:            protected Object createElementInfo() {
050:                // a local variable has no info
051:                return null;
052:            }
053:
054:            public boolean equals(Object o) {
055:                if (!(o instanceof  LocalVariable))
056:                    return false;
057:                LocalVariable other = (LocalVariable) o;
058:                return this .declarationSourceStart == other.declarationSourceStart
059:                        && this .declarationSourceEnd == other.declarationSourceEnd
060:                        && this .nameStart == other.nameStart
061:                        && this .nameEnd == other.nameEnd && super .equals(o);
062:            }
063:
064:            public boolean exists() {
065:                return this .parent.exists(); // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=46192
066:            }
067:
068:            protected void generateInfos(Object info, HashMap newElements,
069:                    IProgressMonitor pm) {
070:                // a local variable has no info
071:            }
072:
073:            public IJavaElement getHandleFromMemento(String token,
074:                    MementoTokenizer memento, WorkingCopyOwner owner) {
075:                switch (token.charAt(0)) {
076:                case JEM_COUNT:
077:                    return getHandleUpdatingCountFromMemento(memento, owner);
078:                }
079:                return this ;
080:            }
081:
082:            /*
083:             * @see JavaElement#getHandleMemento(StringBuffer)
084:             */
085:            protected void getHandleMemento(StringBuffer buff) {
086:                ((JavaElement) getParent()).getHandleMemento(buff);
087:                buff.append(getHandleMementoDelimiter());
088:                buff.append(this .name);
089:                buff.append(JEM_COUNT);
090:                buff.append(this .declarationSourceStart);
091:                buff.append(JEM_COUNT);
092:                buff.append(this .declarationSourceEnd);
093:                buff.append(JEM_COUNT);
094:                buff.append(this .nameStart);
095:                buff.append(JEM_COUNT);
096:                buff.append(this .nameEnd);
097:                buff.append(JEM_COUNT);
098:                buff.append(this .typeSignature);
099:                if (this .occurrenceCount > 1) {
100:                    buff.append(JEM_COUNT);
101:                    buff.append(this .occurrenceCount);
102:                }
103:            }
104:
105:            protected char getHandleMementoDelimiter() {
106:                return JavaElement.JEM_LOCALVARIABLE;
107:            }
108:
109:            public IResource getCorrespondingResource() {
110:                return null;
111:            }
112:
113:            public String getElementName() {
114:                return this .name;
115:            }
116:
117:            public int getElementType() {
118:                return LOCAL_VARIABLE;
119:            }
120:
121:            public ISourceRange getNameRange() {
122:                return new SourceRange(this .nameStart, this .nameEnd
123:                        - this .nameStart + 1);
124:            }
125:
126:            public IPath getPath() {
127:                return this .parent.getPath();
128:            }
129:
130:            public IResource getResource() {
131:                return this .parent.getResource();
132:            }
133:
134:            /**
135:             * @see ISourceReference
136:             */
137:            public String getSource() throws JavaModelException {
138:                IOpenable openable = this .parent.getOpenableParent();
139:                IBuffer buffer = openable.getBuffer();
140:                if (buffer == null) {
141:                    return null;
142:                }
143:                ISourceRange range = getSourceRange();
144:                int offset = range.getOffset();
145:                int length = range.getLength();
146:                if (offset == -1 || length == 0) {
147:                    return null;
148:                }
149:                try {
150:                    return buffer.getText(offset, length);
151:                } catch (RuntimeException e) {
152:                    return null;
153:                }
154:            }
155:
156:            /**
157:             * @see ISourceReference
158:             */
159:            public ISourceRange getSourceRange() {
160:                return new SourceRange(this .declarationSourceStart,
161:                        this .declarationSourceEnd - this .declarationSourceStart
162:                                + 1);
163:            }
164:
165:            public String getTypeSignature() {
166:                return this .typeSignature;
167:            }
168:
169:            public IResource getUnderlyingResource() throws JavaModelException {
170:                return this .parent.getUnderlyingResource();
171:            }
172:
173:            public int hashCode() {
174:                return Util.combineHashCodes(this .parent.hashCode(),
175:                        this .nameStart);
176:            }
177:
178:            public boolean isStructureKnown() throws JavaModelException {
179:                return true;
180:            }
181:
182:            protected void toStringInfo(int tab, StringBuffer buffer,
183:                    Object info, boolean showResolvedInfo) {
184:                buffer.append(this .tabString(tab));
185:                if (info != NO_INFO) {
186:                    buffer.append(Signature.toString(this .getTypeSignature()));
187:                    buffer.append(" "); //$NON-NLS-1$
188:                }
189:                toStringName(buffer);
190:            }
191:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.