|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.jdt.internal.core.util.ReferenceInfoAdapter
org.eclipse.jdt.internal.core.SourceMapper
public class SourceMapper
A SourceMapper maps source code in a ZIP file to binary types in a JAR. The SourceMapper uses the fuzzy parser to identify source fragments in a .java file, and attempts to match the source code with children in a binary type. A SourceMapper is associated with a JarPackageFragment by an AttachSourceOperation.
JarPackageFragment
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface org.eclipse.jdt.internal.compiler.ISourceElementRequestor |
---|
ISourceElementRequestor.FieldInfo, ISourceElementRequestor.MethodInfo, ISourceElementRequestor.TypeInfo, ISourceElementRequestor.TypeParameterInfo |
Field Summary | |
---|---|
static SourceRange |
UNKNOWN_RANGE
The unknown source range {-1, 0} |
static boolean |
VERBOSE
|
Fields inherited from interface org.eclipse.jdt.internal.compiler.util.SuffixConstants |
---|
EXTENSION_class, EXTENSION_CLASS, EXTENSION_java, EXTENSION_JAVA, SUFFIX_class, SUFFIX_CLASS, SUFFIX_java, SUFFIX_JAVA, SUFFIX_STRING_class, SUFFIX_STRING_CLASS, SUFFIX_STRING_java, SUFFIX_STRING_JAVA |
Constructor Summary | |
---|---|
SourceMapper()
|
|
SourceMapper(org.eclipse.core.runtime.IPath sourcePath,
java.lang.String rootPath,
java.util.Map options)
Creates a SourceMapper that locates source in the zip file
at the given location in the specified package fragment root. |
Method Summary | |
---|---|
void |
acceptImport(int declarationStart,
int declarationEnd,
char[][] tokens,
boolean onDemand,
int modifiers)
|
void |
acceptLineSeparatorPositions(int[] positions)
|
void |
acceptPackage(ImportReference importReference)
|
void |
acceptProblem(CategorizedProblem problem)
|
void |
close()
Closes this SourceMapper 's zip file. |
void |
enterCompilationUnit()
|
void |
enterConstructor(ISourceElementRequestor.MethodInfo methodInfo)
|
void |
enterField(ISourceElementRequestor.FieldInfo fieldInfo)
|
void |
enterInitializer(int declarationSourceStart,
int modifiers)
|
void |
enterMethod(ISourceElementRequestor.MethodInfo methodInfo)
|
void |
enterType(ISourceElementRequestor.TypeInfo typeInfo)
|
void |
exitCompilationUnit(int declarationEnd)
|
void |
exitConstructor(int declarationEnd)
|
void |
exitField(int initializationStart,
int declarationEnd,
int declarationSourceEnd)
|
void |
exitInitializer(int declarationEnd)
|
void |
exitMethod(int declarationEnd,
Expression defaultValue)
|
void |
exitType(int declarationEnd)
|
char[] |
findSource(IType type,
IBinaryType info)
Locates and returns source code for the given (binary) type, in this SourceMapper's ZIP file, or returns null if source
code cannot be found. |
char[] |
findSource(IType type,
java.lang.String simpleSourceFileName)
Locates and returns source code for the given (binary) type, in this SourceMapper's ZIP file, or returns null if source
code cannot be found. |
char[] |
findSource(java.lang.String fullName)
|
char[][] |
getImports(BinaryType type)
Return a char[][] array containing the imports of the attached source for the binary type |
char[][] |
getMethodParameterNames(IMethod method)
Returns parameters names for the given method, or null if no parameter names are known for the method. |
SourceRange |
getNameRange(IJavaElement element)
Returns the SourceRange for the name of the given element, or {-1, -1} if no source range is known for the name of the element. |
SourceRange |
getSourceRange(IJavaElement element)
Returns the SourceRange for the given element, or
{-1, -1} if no source range is known for the element. |
void |
mapSource(IType type,
char[] contents,
IBinaryType info)
Maps the given source code to the given binary type and its children. |
ISourceRange |
mapSource(IType type,
char[] contents,
IBinaryType info,
IJavaElement elementToFind)
Maps the given source code to the given binary type and its children. |
Methods inherited from class org.eclipse.jdt.internal.core.util.ReferenceInfoAdapter |
---|
acceptAnnotationTypeReference, acceptAnnotationTypeReference, acceptConstructorReference, acceptFieldReference, acceptMethodReference, acceptTypeReference, acceptTypeReference, acceptUnknownReference, acceptUnknownReference |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.eclipse.jdt.internal.compiler.ISourceElementRequestor |
---|
acceptAnnotationTypeReference, acceptAnnotationTypeReference, acceptConstructorReference, acceptFieldReference, acceptMethodReference, acceptTypeReference, acceptTypeReference, acceptUnknownReference, acceptUnknownReference |
Field Detail |
---|
public static boolean VERBOSE
public static final SourceRange UNKNOWN_RANGE
Constructor Detail |
---|
public SourceMapper()
public SourceMapper(org.eclipse.core.runtime.IPath sourcePath, java.lang.String rootPath, java.util.Map options)
SourceMapper
that locates source in the zip file
at the given location in the specified package fragment root.
Method Detail |
---|
public void acceptImport(int declarationStart, int declarationEnd, char[][] tokens, boolean onDemand, int modifiers)
acceptImport
in interface ISourceElementRequestor
declarationStart
- This is the position of the first character of the import
keyword.declarationEnd
- This is the position of the ';' ending the import statement or
the end of the comment following the import.tokens
- This are the tokens of the import like specified in the source.onDemand
- set to true if the import is an import on demand (e.g. import
java.io.*). False otherwise.modifiers
- can be set to static from 1.5 on.ISourceElementRequestor
public void acceptLineSeparatorPositions(int[] positions)
acceptLineSeparatorPositions
in interface ISourceElementRequestor
ISourceElementRequestor
public void acceptPackage(ImportReference importReference)
acceptPackage
in interface ISourceElementRequestor
ISourceElementRequestor
public void acceptProblem(CategorizedProblem problem)
acceptProblem
in interface ISourceElementRequestor
ISourceElementRequestor
public void close()
SourceMapper
's zip file. Once this is done, this
SourceMapper
cannot be used again.
public void enterType(ISourceElementRequestor.TypeInfo typeInfo)
enterType
in interface ISourceElementRequestor
ISourceElementRequestor
public void enterCompilationUnit()
enterCompilationUnit
in interface ISourceElementRequestor
ISourceElementRequestor
public void enterConstructor(ISourceElementRequestor.MethodInfo methodInfo)
enterConstructor
in interface ISourceElementRequestor
ISourceElementRequestor
public void enterField(ISourceElementRequestor.FieldInfo fieldInfo)
enterField
in interface ISourceElementRequestor
ISourceElementRequestor
public void enterInitializer(int declarationSourceStart, int modifiers)
enterInitializer
in interface ISourceElementRequestor
ISourceElementRequestor
public void enterMethod(ISourceElementRequestor.MethodInfo methodInfo)
enterMethod
in interface ISourceElementRequestor
ISourceElementRequestor
public void exitType(int declarationEnd)
exitType
in interface ISourceElementRequestor
ISourceElementRequestor
public void exitCompilationUnit(int declarationEnd)
exitCompilationUnit
in interface ISourceElementRequestor
ISourceElementRequestor
public void exitConstructor(int declarationEnd)
exitConstructor
in interface ISourceElementRequestor
ISourceElementRequestor
public void exitField(int initializationStart, int declarationEnd, int declarationSourceEnd)
exitField
in interface ISourceElementRequestor
ISourceElementRequestor
public void exitInitializer(int declarationEnd)
exitInitializer
in interface ISourceElementRequestor
ISourceElementRequestor
public void exitMethod(int declarationEnd, Expression defaultValue)
exitMethod
in interface ISourceElementRequestor
ISourceElementRequestor
public char[] findSource(IType type, IBinaryType info)
null
if source
code cannot be found.
public char[] findSource(IType type, java.lang.String simpleSourceFileName)
null
if source
code cannot be found.
The given simpleSourceFileName is the .java file name (without the enclosing
folder) used to create the given type (e.g. "A.java" for x/y/A$Inner.class)
public char[] findSource(java.lang.String fullName)
public SourceRange getNameRange(IJavaElement element)
public char[][] getMethodParameterNames(IMethod method)
public SourceRange getSourceRange(IJavaElement element)
SourceRange
for the given element, or
{-1, -1} if no source range is known for the element.
public void mapSource(IType type, char[] contents, IBinaryType info)
public ISourceRange mapSource(IType type, char[] contents, IBinaryType info, IJavaElement elementToFind)
public char[][] getImports(BinaryType type)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |