public class ClassFile extends Openable implements IClassFile, SuffixConstants
IClassFile| Modifier and Type | Field and Description |
|---|---|
protected BinaryType |
binaryType |
protected java.lang.String |
name |
JEM_ANNOTATION, JEM_CLASSFILE, JEM_COMPILATIONUNIT, JEM_COUNT, JEM_DELIMITER_ESCAPE, JEM_ESCAPE, JEM_FIELD, JEM_IMPORTDECLARATION, JEM_INITIALIZER, JEM_JAVAPROJECT, JEM_LAMBDA_EXPRESSION, JEM_LAMBDA_METHOD, JEM_LOCALVARIABLE, JEM_METHOD, JEM_PACKAGEDECLARATION, JEM_PACKAGEFRAGMENT, JEM_PACKAGEFRAGMENTROOT, JEM_STRING, JEM_TYPE, JEM_TYPE_PARAMETER, NO_ELEMENTS, NO_INFO, parentANNOTATION, CLASS_FILE, COMPILATION_UNIT, FIELD, IMPORT_CONTAINER, IMPORT_DECLARATION, INITIALIZER, JAVA_MODEL, JAVA_PROJECT, LOCAL_VARIABLE, METHOD, PACKAGE_DECLARATION, PACKAGE_FRAGMENT, PACKAGE_FRAGMENT_ROOT, TYPE, TYPE_PARAMETEREXTENSION_aj, EXTENSION_AJ, EXTENSION_class, EXTENSION_CLASS, EXTENSION_java, EXTENSION_JAVA, SUFFIX_aj, SUFFIX_AJ, SUFFIX_class, SUFFIX_CLASS, SUFFIX_java, SUFFIX_JAVA, SUFFIX_STRING_aj, SUFFIX_STRING_AJ, SUFFIX_STRING_class, SUFFIX_STRING_CLASS, SUFFIX_STRING_java, SUFFIX_STRING_JAVA| Modifier | Constructor and Description |
|---|---|
protected |
ClassFile(PackageFragment parent,
java.lang.String nameWithoutExtension) |
| Modifier and Type | Method and Description |
|---|---|
ICompilationUnit |
becomeWorkingCopy(IProblemRequestor problemRequestor,
WorkingCopyOwner owner,
IProgressMonitor monitor)
Changes this class file handle into a working copy.
|
protected boolean |
buildStructure(OpenableElementInfo info,
IProgressMonitor pm,
java.util.Map newElements,
IResource underlyingResource)
Creates the children elements for this class file adding the resulting
new handles and info objects to the newElements table.
|
void |
close()
Closes this element and its buffer (if any).
|
void |
codeComplete(int offset,
CompletionRequestor requestor)
Performs code completion at the given offset position in this compilation unit,
reporting results to the given completion requestor.
|
void |
codeComplete(int offset,
CompletionRequestor requestor,
IProgressMonitor monitor)
Performs code completion at the given offset position in this compilation unit,
reporting results to the given completion requestor.
|
void |
codeComplete(int offset,
CompletionRequestor requestor,
WorkingCopyOwner owner,
IProgressMonitor monitor)
Performs code completion at the given offset position in this compilation unit,
reporting results to the given completion requestor.
|
void |
codeComplete(int offset,
ICodeCompletionRequestor requestor)
Deprecated.
- should use codeComplete(int, ICompletionRequestor) instead
|
void |
codeComplete(int offset,
ICompletionRequestor requestor)
Deprecated.
|
void |
codeComplete(int offset,
ICompletionRequestor requestor,
WorkingCopyOwner owner)
Deprecated.
|
IJavaElement[] |
codeSelect(int offset,
int length)
Returns the Java elements corresponding to the given selected text in this compilation unit.
|
IJavaElement[] |
codeSelect(int offset,
int length,
WorkingCopyOwner owner)
Returns the Java elements corresponding to the given selected text in this compilation unit.
|
protected java.lang.Object |
createElementInfo()
Returns a new element info for this element.
|
boolean |
equals(java.lang.Object o)
Returns true if this handle represents the same Java element
as the given handle.
|
boolean |
existsUsingJarTypeCache() |
protected IJavaElement |
findElement(IJavaElement elt,
int position,
SourceMapper mapper)
Finds the deepest
IJavaElement in the hierarchy of
elt's children (including |
IType |
findPrimaryType()
Finds the primary type of this Java type root (that is, the type with the same name as the
compilation unit, or the type of a class file), or
null if no such a type exists. |
java.lang.String |
getAttachedJavadoc(IProgressMonitor monitor)
Returns the Javadoc as HTML source if this element has attached Javadoc,
null otherwise. |
IBinaryType |
getBinaryTypeInfo()
Returns the
ClassFileReaderspecific for this IClassFile, based
on its underlying resource, or null if unable to create
the diet class file. |
IBuffer |
getBuffer()
Note: a buffer with no unsaved changes can be closed by the Java Model
since it has a finite number of buffers allowed open at one time.
|
byte[] |
getBytes()
Returns the bytes contained in this class file.
|
IClassFile |
getClassFile() |
IResource |
getCorrespondingResource()
A class file has a corresponding resource unless it is contained
in a jar.
|
IJavaElement |
getElementAt(int position)
Returns the smallest element within this Java type root that
includes the given source position (that is, a method, field, etc.), or
null if there is no element other than the Java type root
itself at the given position, or if the given position is not
within the source range of the source of this Java type root. |
IJavaElement |
getElementAtConsideringSibling(int position) |
java.lang.String |
getElementName()
Returns the name of this element.
|
int |
getElementType()
Returns this element's kind encoded as an integer.
|
IJavaElement |
getHandleFromMemento(java.lang.String token,
MementoTokenizer memento,
WorkingCopyOwner owner) |
protected char |
getHandleMementoDelimiter()
Returns the
char that marks the start of this handles
contribution to a memento. |
java.lang.String |
getName() |
ISourceRange |
getNameRange()
Returns the name range associated with this element.
|
IPath |
getPath()
Returns the path to the innermost resource enclosing this element.
|
java.lang.String |
getSource()
Returns the source code associated with this element.
|
ISourceRange |
getSourceRange()
Returns the source range associated with this element.
|
java.lang.String |
getTopLevelTypeName() |
IType |
getType()
Returns the type contained in this class file.
|
java.lang.String |
getTypeName() |
ITypeRoot |
getTypeRoot() |
IJavaElement |
getWorkingCopy(IProgressMonitor monitor,
IBufferFactory factory)
Deprecated.
|
ICompilationUnit |
getWorkingCopy(WorkingCopyOwner owner,
IProgressMonitor monitor)
Returns a working copy on the source associated with this class file using the given
factory to create the buffer, or
null if there is no source associated
with the class file. |
protected boolean |
hasBuffer()
Returns true if this element may have an associated source buffer,
otherwise false.
|
int |
hashCode()
Returns the hash code for this Java element.
|
boolean |
isClass()
Returns whether this type represents a class.
|
boolean |
isInterface()
Returns whether this type represents an interface.
|
boolean |
isReadOnly()
Returns true - class files are always read only.
|
protected IBuffer |
openBuffer(IProgressMonitor pm,
java.lang.Object info)
Opens and returns buffer on the source code associated with this class file.
|
IResource |
resource(PackageFragmentRoot root) |
static char[] |
translatedName(char[] name)
Returns the Java Model representation of the given name
which is provided in diet class file format, or
null
if the given name is null. |
protected IStatus |
validateExistence(IResource underlyingResource) |
bufferChanged, canBeRemovedFromCache, canBufferBeRemovedFromCache, closeBuffer, closing, codeComplete, codeSelect, exists, findRecommendedLineSeparator, generateInfos, getBufferFactory, getBufferManager, getOpenable, getPackageFragmentRoot, getResource, getUnderlyingResource, hasUnsavedChanges, isConsistent, isOpen, isSourceElement, isStructureKnown, makeConsistent, open, openAncestors, resource, resourceExists, saveappendEscapedDelimiter, escapeMementoName, findNode, getAncestor, getChildren, getChildrenOfType, getCompilationUnit, getElementInfo, getElementInfo, getHandleFromMemento, getHandleIdentifier, getHandleMemento, getHandleMemento, getJavadocBaseLocation, getJavaModel, getJavaProject, getLibraryJavadocLocation, getOpenableParent, getParent, getPrimaryElement, getPrimaryElement, getSchedulingRule, getSourceElementAt, getSourceMapper, getURLContents, hasChildren, isAncestorOf, newDoesNotExistStatus, newJavaModelException, newNotPresentException, openWhenClosed, readableName, resolved, tabString, toDebugString, toString, toString, toStringAncestors, toStringChildren, toStringInfo, toStringInfo, toStringName, toStringWithAncestors, toStringWithAncestors, unresolved, validateAndCacheclone, finalize, getClass, notify, notifyAll, wait, wait, waitexists, getAncestor, getHandleIdentifier, getJavaModel, getJavaProject, getOpenable, getParent, getPrimaryElement, getResource, getSchedulingRule, getUnderlyingResource, isStructureKnowngetChildren, hasChildrenfindRecommendedLineSeparator, hasUnsavedChanges, isConsistent, isOpen, makeConsistent, open, saveexistsprotected java.lang.String name
protected BinaryType binaryType
protected ClassFile(PackageFragment parent, java.lang.String nameWithoutExtension)
public ICompilationUnit becomeWorkingCopy(IProblemRequestor problemRequestor, WorkingCopyOwner owner, IProgressMonitor monitor) throws JavaModelException
IClassFileIBuffer is
created using the given owner. Uses the primary owner if null is
specified.
When switching to working copy mode, problems are reported to the given
IProblemRequestor. Note that once in working copy mode, the given
IProblemRequestor is ignored. Only the original IProblemRequestor
is used to report subsequent problems.
Once in working copy mode, changes to this working copy or its children are done in memory. Only the new buffer is affected.
Using ICompilationUnit.commitWorkingCopy(boolean, IProgressMonitor) on the working copy
will throw a JavaModelException as a class file is implicetly read-only.
If this class file was already in working copy mode, an internal counter is incremented and no
other action is taken on this working copy. To bring this working copy back into the original mode
(where it reflects the underlying resource), ICompilationUnit.discardWorkingCopy() must be call as many
times as IClassFile.becomeWorkingCopy(IProblemRequestor, WorkingCopyOwner, IProgressMonitor).
The primary compilation unit of a class file's working copy does not exist if the class file is not
in working copy mode (classFileWorkingCopy.getPrimary().exists() == false).
The resource of a class file's working copy is null if the class file is in an external jar file.
becomeWorkingCopy in interface IClassFileproblemRequestor - a requestor which will get notified of problems detected during
reconciling as they are discovered. The requestor can be set to null indicating
that the client is not interested in problems.owner - the given WorkingCopyOwner, or null for the primary ownermonitor - a progress monitor used to report progress while opening this compilation unit
or null if no progress should be reportedJavaModelException - if this compilation unit could not become a working copy.ICompilationUnit.discardWorkingCopy()protected boolean buildStructure(OpenableElementInfo info, IProgressMonitor pm, java.util.Map newElements, IResource underlyingResource) throws JavaModelException
buildStructure in class OpenableJavaModelExceptionOpenable,
Signature@Deprecated
public void codeComplete(int offset,
ICompletionRequestor requestor)
throws JavaModelException
ICodeAssistoffset
is the 0-based index of the character, after which code assist is desired.
An offset of -1 indicates to code assist at the beginning of this
compilation unit.codeComplete in interface ICodeAssistoffset - the given offset positionrequestor - the given completion requestorJavaModelException - if code assist could not be performed. Reasons include:ICodeAssist.codeComplete(int, ICompletionRequestor)@Deprecated
public void codeComplete(int offset,
ICompletionRequestor requestor,
WorkingCopyOwner owner)
throws JavaModelException
ICodeAssistoffset
is the 0-based index of the character, after which code assist is desired.
An offset of -1 indicates to code assist at the beginning of this
compilation unit.
It considers types in the working copies with the given owner first. In other words,
the owner's working copies will take precedence over their original compilation units
in the workspace.
Note that if a working copy is empty, it will be as if the original compilation unit had been deleted.
codeComplete in interface ICodeAssistoffset - the given offset positionrequestor - the given completion requestorowner - the owner of working copies that take precedence over their original compilation unitsJavaModelException - if code assist could not be performed. Reasons include:ICodeAssist.codeComplete(int, ICompletionRequestor, WorkingCopyOwner)public void codeComplete(int offset,
CompletionRequestor requestor)
throws JavaModelException
ICodeAssistoffset
is the 0-based index of the character, after which code assist is desired.
An offset of -1 indicates to code assist at the beginning of this
compilation unit.
codeComplete in interface ICodeAssistoffset - the given offset positionrequestor - the given completion requestorJavaModelException - if code assist could not be performed. Reasons include:public void codeComplete(int offset,
CompletionRequestor requestor,
IProgressMonitor monitor)
throws JavaModelException
ICodeAssistoffset
is the 0-based index of the character, after which code assist is desired.
An offset of -1 indicates to code assist at the beginning of this
compilation unit.
If IProgressMonitor is not null then some proposals which
can be very long to compute are proposed. To avoid that the code assist operation
take too much time a IProgressMonitor which automatically cancel the code
assist operation when a specified amount of time is reached could be used.
new IProgressMonitor() {
private final static int TIMEOUT = 500; //ms
private long endTime;
public void beginTask(String name, int totalWork) {
fEndTime= System.currentTimeMillis() + TIMEOUT;
}
public boolean isCanceled() {
return endTime <= System.currentTimeMillis();
}
...
};
codeComplete in interface ICodeAssistoffset - the given offset positionrequestor - the given completion requestormonitor - the progress monitor used to report progressJavaModelException - if code assist could not be performed. Reasons include:public void codeComplete(int offset,
CompletionRequestor requestor,
WorkingCopyOwner owner,
IProgressMonitor monitor)
throws JavaModelException
ICodeAssistoffset
is the 0-based index of the character, after which code assist is desired.
An offset of -1 indicates to code assist at the beginning of this
compilation unit.
It considers types in the working copies with the given owner first. In other words,
the owner's working copies will take precedence over their original compilation units
in the workspace.
Note that if a working copy is empty, it will be as if the original compilation unit had been deleted.
If IProgressMonitor is not null then some proposals which
can be very long to compute are proposed. To avoid that the code assist operation
take too much time a IProgressMonitor which automatically cancel the code
assist operation when a specified amount of time is reached could be used.
new IProgressMonitor() {
private final static int TIMEOUT = 500; //ms
private long endTime;
public void beginTask(String name, int totalWork) {
fEndTime= System.currentTimeMillis() + TIMEOUT;
}
public boolean isCanceled() {
return endTime <= System.currentTimeMillis();
}
...
};
codeComplete in interface ICodeAssistoffset - the given offset positionrequestor - the given completion requestorowner - the owner of working copies that take precedence over their original compilation unitsmonitor - the progress monitor used to report progressJavaModelException - if code assist could not be performed. Reasons include:public IJavaElement[] codeSelect(int offset, int length) throws JavaModelException
ICodeAssistoffset is the 0-based index of the first selected character.
The length is the number of selected characters.
Note that if the length is 0 and the offset is inside an identifier
or the index just after an identifier then this identifier is considered as the selection.
codeSelect in interface ICodeAssistoffset - the given offset positionlength - the number of selected charactersJavaModelException - if code resolve could not be performed. Reasons include:
ICodeAssist.codeSelect(int, int)public IJavaElement[] codeSelect(int offset, int length, WorkingCopyOwner owner) throws JavaModelException
ICodeAssistoffset is the 0-based index of the first selected character.
The length is the number of selected characters.
It considers types in the working copies with the given owner first. In other words,
the owner's working copies will take precedence over their original compilation units
in the workspace.
Note that if the length is 0 and the offset is inside an identifier
or the index just after an identifier then this identifier is considered as the selection.
Note that if a working copy is empty, it will be as if the original compilation unit had been deleted.
codeSelect in interface ICodeAssistoffset - the given offset positionlength - the number of selected charactersowner - the owner of working copies that take precedence over their original compilation unitsJavaModelException - if code resolve could not be performed. Reasons include:
ICodeAssist.codeSelect(int, int, WorkingCopyOwner)protected java.lang.Object createElementInfo()
createElementInfo in class Openablepublic boolean equals(java.lang.Object o)
JavaElementIf a subclass has other requirements for equality, this method must be overridden.
equals in class JavaElementObject.equals(java.lang.Object)public boolean existsUsingJarTypeCache()
protected IJavaElement findElement(IJavaElement elt, int position, SourceMapper mapper)
IJavaElement in the hierarchy of
elt's children (including elt itself)
which has a source range that encloses position
according to mapper.public IType findPrimaryType()
ITypeRootnull if no such a type exists.findPrimaryType in interface ITypeRootnull if no such a type existsITypeRoot.findPrimaryType()public java.lang.String getAttachedJavadoc(IProgressMonitor monitor)
throws JavaModelException
IJavaElementReturns the Javadoc as HTML source if this element has attached Javadoc,
null otherwise.
This should be used only for binary elements. Source elements will always return null.
The encoding used to read the Javadoc is the one defined by the content type of the file. If none is defined, then the project's encoding of this Java element is used. If the project's encoding cannot be retrieved, then the platform encoding is used.
In case the Javadoc doesn't exist for this element, null is returned.
The HTML is extracted from the attached Javadoc and provided as is. No transformation or validation is done.
getAttachedJavadoc in interface IJavaElementgetAttachedJavadoc in class JavaElementmonitor - the given progress monitor, can be nullnull if noneJavaModelException - if:IClasspathAttribute.JAVADOC_LOCATION_ATTRIBUTE_NAMEpublic IBinaryType getBinaryTypeInfo() throws JavaModelException
ClassFileReaderspecific for this IClassFile, based
on its underlying resource, or null if unable to create
the diet class file.
There are two cases to consider:JavaModelException - when the IFile resource or JAR is not available
or when this class file is not present in the JARpublic byte[] getBytes()
throws JavaModelException
IClassFilegetBytes in interface IClassFileJavaModelException - if this element does not exist or if an
exception occurs while accessing its corresponding resourcepublic java.lang.String getName()
public void close()
throws JavaModelException
IOpenableNote: Although IOpenable.close() is exposed in the API, clients are
not expected to open and close elements - the Java model does this automatically
as elements are accessed.
close in interface IOpenableclose in class JavaElementJavaModelException - if an error occurs closing this elementIOpenablepublic IBuffer getBuffer() throws JavaModelException
OpenablegetBuffer in interface IOpenablegetBuffer in class Openablenull
if this element does not have a bufferJavaModelException - if this element does not exist or if an
exception occurs while accessing its corresponding resource.IOpenablepublic IClassFile getClassFile()
getClassFile in class JavaElementIMemberpublic ITypeRoot getTypeRoot()
IMember.getTypeRoot()public IResource getCorrespondingResource()
throws JavaModelException
getCorrespondingResource in interface IJavaElementgetCorrespondingResource in class Openablenull if noneJavaModelException - if this element does not exist or if an
exception occurs while accessing its corresponding resourceIJavaElementpublic IJavaElement getElementAt(int position) throws JavaModelException
ITypeRootnull if there is no element other than the Java type root
itself at the given position, or if the given position is not
within the source range of the source of this Java type root.getElementAt in interface ITypeRootposition - a source position inside the Java type rootnull
if none (excluding the Java type root).JavaModelException - if the Java type root does not exist or if an
exception occurs while accessing its corresponding resourceIClassFilepublic IJavaElement getElementAtConsideringSibling(int position) throws JavaModelException
JavaModelExceptionpublic java.lang.String getElementName()
IJavaElementgetElementName in interface IJavaElementgetElementName in class JavaElementIAdaptablepublic int getElementType()
IJavaElementgetElementType in interface IJavaElementIJavaElementIJavaElementpublic IJavaElement getHandleFromMemento(java.lang.String token, MementoTokenizer memento, WorkingCopyOwner owner)
getHandleFromMemento in class JavaElementprotected char getHandleMementoDelimiter()
JavaElementchar that marks the start of this handles
contribution to a memento.getHandleMementoDelimiter in class JavaElementJavaElement.getHandleMemento()public IPath getPath()
IJavaElementgetPath in interface IJavaElementpublic IResource resource(PackageFragmentRoot root)
public java.lang.String getSource()
throws JavaModelException
ISourceReferencegetSourceRange.
For class files, this returns the source of the entire compilation unit associated with the class file (if there is one).
getSource in interface ISourceReferencenull if this element has no
associated source codeJavaModelException - if an exception occurs while accessing its corresponding resourceISourceReferencepublic ISourceRange getSourceRange() throws JavaModelException
ISourceReferenceFor class files, this returns the range of the entire compilation unit associated with the class file (if there is one).
If this element has no associated source code, either null is returned,
or a source range with a -1 offset and a 0 length. SourceRange.isAvailable(ISourceRange)
can be used to detect that case.
getSourceRange in interface ISourceReferencenull or [-1, 0] if this element has no
associated source codeJavaModelException - if an exception occurs while accessing its corresponding resourceISourceReferencepublic java.lang.String getTopLevelTypeName()
public IType getType()
IClassFilegetType in interface IClassFileIClassFilepublic java.lang.String getTypeName()
public ICompilationUnit getWorkingCopy(WorkingCopyOwner owner, IProgressMonitor monitor) throws JavaModelException
IClassFilenull if there is no source associated
with the class file.
The buffer will be automatically initialized with the source of the class file upon creation.
The only valid operations on this working copy are getBuffer() or getOriginalElement.
getWorkingCopy in interface IClassFilegetWorkingCopy in interface ITypeRootowner - a progress monitor used to report progress while opening this compilation unit
or null if no progress should be reportedmonitor - the factory that creates a buffer that is used to get the content of the working copy
or null if the internal factory should be usedJavaModelException - if the source of this class file can
not be determined. Reasons include:
@Deprecated public IJavaElement getWorkingCopy(IProgressMonitor monitor, IBufferFactory factory) throws JavaModelException
IClassFilenull if there is no source associated
with the class file.
The buffer will be automatically initialized with the source of the class file upon creation.
The only valid operations on this working copy are getBuffer() or getOriginalElement.
getWorkingCopy in interface IClassFilegetWorkingCopy in interface ITypeRootmonitor - a progress monitor used to report progress while opening this compilation unit
or null if no progress should be reportedfactory - the factory that creates a buffer that is used to get the content of the working copy
or null if the internal factory should be usedJavaModelException - if the source of this class file can
not be determined. Reasons include:
IClassFileprotected boolean hasBuffer()
Openablepublic int hashCode()
JavaElementhashCode in class JavaElementpublic boolean isClass()
throws JavaModelException
IClassFileisClass in interface IClassFiletrue if the class file represents a class.JavaModelException - if this element does not exist or if an
exception occurs while accessing its corresponding resourceIClassFilepublic boolean isInterface()
throws JavaModelException
IClassFileisInterface in interface IClassFiletrue if the class file represents an interface.JavaModelException - if this element does not exist or if an
exception occurs while accessing its corresponding resourceIClassFilepublic boolean isReadOnly()
isReadOnly in interface IJavaElementisReadOnly in class JavaElementtrue if this element is read-onlyIJavaElementprotected IBuffer openBuffer(IProgressMonitor pm, java.lang.Object info) throws JavaModelException
null is returned.openBuffer in class OpenableJavaModelExceptionOpenablepublic static char[] translatedName(char[] name)
null
if the given name is null.
ClassFileReader format is similar to "java/lang/Object",
and corresponding Java Model format is "java.lang.Object".
@Deprecated
public void codeComplete(int offset,
ICodeCompletionRequestor requestor)
throws JavaModelException
ICodeAssistoffset
is the 0-based index of the character, after which code assist is desired.
An offset of -1 indicates to code assist at the beginning of this
compilation unit.codeComplete in interface ICodeAssistoffset - the given offset positionrequestor - the given completion requestorJavaModelException - if code assist could not be performed. Reasons include:ICodeAssist.codeComplete(int, ICodeCompletionRequestor)protected IStatus validateExistence(IResource underlyingResource)
validateExistence in class Openablepublic ISourceRange getNameRange()
ISourceReferenceIf the element is an IMember, it returns
the source range of this member's simple name,
or null if this member does not have a name
(for example, an initializer), or if this member does not have
associated source code (for example, a binary type).
If this element is an IImportDeclaration, the source range
of this import declaration's name, or null if this import
declaration does not have associated source code (for example, a binary type).
The source range for the name includes the trailing '*' if the call to
IImportDeclaration.isOnDemand() returns true.
If this element is an IPackageDeclaration, the source range of
this package declaration's name, or null if this package
declaration does not have associated source code (for example, a binary type).
If this element is an IAnnotation, the source range of
this annotation's name, or null if this annotation does not have
associated source code (for example, in a binary type).
If this element is an ITypeParameter, the source range of this
type parameter's name, or null if this type parameter does not have
associated source code (for example, in a binary type).
If this element is an ITypeRoot or IImportContainer, it
returns null.
getNameRange in interface ISourceReferencenull if
not available