Klasse TypeHierarchy
- Alle implementierten Schnittstellen:
IElementChangedListener
,ITypeHierarchy
- Bekannte direkte Unterklassen:
RegionBasedTypeHierarchy
- Siehe auch:
-
Feldübersicht
Modifizierer und TypFeldBeschreibungprotected ChangeCollector
protected ArrayList
<ITypeHierarchyChangedListener> Change listeners - null if no one is listening.protected boolean
Whether this hierarchy should contains subtypes.static boolean
protected IType
The type the hierarchy was specifically computed for, possibly null.boolean
protected static final IType[]
protected Region
A region describing the packages considered by this hierarchy.protected org.eclipse.core.runtime.SubMonitor
The progress monitor to report work completed too.protected IJavaProject
The Java Project in which the hierarchy is being built - this provides the context for determining a classpath and namelookup rules.protected Region
A region describing the projects considered by this hierarchy.protected TypeVector
protected Map
<IType, TypeVector> protected ICompilationUnit[]
-
Konstruktorübersicht
KonstruktorBeschreibungCreates an empty TypeHierarchyTypeHierarchy
(IType type, ICompilationUnit[] workingCopies, IJavaProject project, boolean computeSubtypes) Creates a TypeHierarchy on the given type.TypeHierarchy
(IType type, ICompilationUnit[] workingCopies, IJavaSearchScope scope, boolean computeSubtypes) Creates a TypeHierarchy on the given type. -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungprotected void
addInterface
(IType type) Adds the type to the collection of interfaces.protected void
addRootClass
(IType type) Adds the type to the collection of root classes if the classes is not already present in the collection.protected void
addSubtype
(IType type, IType subtype) Adds the given subtype to the type.void
Adds the given listener for changes to this type hierarchy.void
cacheFlags
(IType type, int flags) cacheFlags.protected void
cacheSuperclass
(IType type, IType superclass) Caches the handle of the superclass for the specified type.protected void
cacheSuperInterfaces
(IType type, IType[] superinterfaces) Caches all of the superinterfaces that are specified for the type.protected void
Checks with the progress monitor to see whether the creation of the type hierarchy should be canceled.protected void
compute()
Compute this type hierarchy.boolean
Returns whether the given type is part of this hierarchy.void
Determines if the change affects this hierarchy, and fires change notification if required.boolean
exists()
Returns whether the type and project this hierarchy was created on exist.void
Notifies listeners that this hierarchy has changed and needs refreshing.IType[]
Returns all classes in this type hierarchy's graph, in no particular order.IType[]
Returns all interfaces in this type hierarchy's graph, in no particular order.IType[]
getAllSubtypes
(IType type) Returns all resolved subtypes (direct and indirect) of the given type, in no particular order, limited to the types in this type hierarchy's graph.IType[]
getAllSuperclasses
(IType type) Returns all resolved superclasses of the given class, in bottom-up order.IType[]
getAllSuperInterfaces
(IType type) Returns all resolved superinterfaces (direct and indirect) of the given type.IType[]
getAllSupertypes
(IType type) Returns all resolved supertypes of the given type, in bottom-up order.IType[]
Returns all types in this type hierarchy's graph, in no particular order.int
getCachedFlags
(IType type) Return the flags associated with the given type (would be equivalent toIMember.getFlags()
), or-1
if this information wasn't cached on the hierarchy during its computation.IType[]
getExtendingInterfaces
(IType type) Returns all interfaces resolved to extend the given interface, in no particular order, limited to the interfaces in this hierarchy's graph.IType[]
getImplementingClasses
(IType type) Returns all classes resolved to implement the given interface, in no particular order, limited to the classes in this type hierarchy's graph.IType[]
Returns all classes in the graph which have no resolved superclass, in no particular order.IType[]
Returns all interfaces in the graph which have no resolved superinterfaces, in no particular order.IType[]
getSubclasses
(IType type) Returns the direct resolved subclasses of the given class, in no particular order, limited to the classes in this type hierarchy's graph.IType[]
getSubtypes
(IType type) Returns the direct resolved subtypes of the given type, in no particular order, limited to the types in this type hierarchy's graph.getSuperclass
(IType type) Returns the resolved superclass of the given class, ornull
if the given class has no superclass, the superclass could not be resolved, or if the given type is an interface.IType[]
getSuperInterfaces
(IType type) Returns the direct resolved interfaces that the given type implements or extends, in no particular order, limited to the interfaces in this type hierarchy's graph.IType[]
getSupertypes
(IType type) Returns the resolved supertypes of the given type, in no particular order, limited to the types in this type hierarchy's graph.getType()
Returns the type this hierarchy was computed for.protected IType[]
growAndAddToArray
(IType[] array, IType addition) Adds the new element to a new array that contains all of the elements of the old array.protected IType[]
growAndAddToArray
(IType[] array, IType[] additions) Adds the new elements to a new array that contains all of the elements of the old array.boolean
protected void
initialize
(int size) Initializes this hierarchy's internal tables with the given size.protected void
Initializes the file, package and project regionsboolean
isAffected
(IJavaElementDelta delta, int eventType) Returns true if the given delta could change this type hierarchyprotected boolean
isAffectedByOpenable
(IJavaElementDelta delta, IJavaElement element, int eventType) Returns true if the given type delta (a compilation unit delta or a class file delta) could affect this type hierarchy.Returns the java project this hierarchy was created in.static ITypeHierarchy
load
(IType type, InputStream input, WorkingCopyOwner owner) protected boolean
Returnstrue
if an equivalent package fragment is included in the package region.protected static byte[]
readUntil
(InputStream input, byte separator) protected static byte[]
readUntil
(InputStream input, byte separator, int offset) void
refresh
(org.eclipse.core.runtime.IProgressMonitor monitor) Re-computes the type hierarchy reporting progress.void
Removes the given listener from this type hierarchy.void
store
(OutputStream output, org.eclipse.core.runtime.IProgressMonitor monitor) Stores the type hierarchy in an output stream.toString()
protected void
worked
(int work)
-
Felddetails
-
DEBUG
public static boolean DEBUG -
project
The Java Project in which the hierarchy is being built - this provides the context for determining a classpath and namelookup rules. Possibly null. -
focusType
The type the hierarchy was specifically computed for, possibly null. -
workingCopies
-
classToSuperclass
-
typeToSuperInterfaces
-
typeToSubtypes
-
typeFlags
-
rootClasses
-
interfaces
-
missingTypes
-
NO_TYPE
-
progressMonitor
protected org.eclipse.core.runtime.SubMonitor progressMonitorThe progress monitor to report work completed too. -
changeListeners
Change listeners - null if no one is listening. -
files
-
packageRegion
A region describing the packages considered by this hierarchy. Null if not activated. -
projectRegion
A region describing the projects considered by this hierarchy. Null if not activated. -
computeSubtypes
protected boolean computeSubtypesWhether this hierarchy should contains subtypes. -
needsRefresh
public boolean needsRefresh -
changeCollector
-
-
Konstruktordetails
-
TypeHierarchy
public TypeHierarchy()Creates an empty TypeHierarchy -
TypeHierarchy
public TypeHierarchy(IType type, ICompilationUnit[] workingCopies, IJavaProject project, boolean computeSubtypes) Creates a TypeHierarchy on the given type. -
TypeHierarchy
public TypeHierarchy(IType type, ICompilationUnit[] workingCopies, IJavaSearchScope scope, boolean computeSubtypes) Creates a TypeHierarchy on the given type.
-
-
Methodendetails
-
initializeRegions
protected void initializeRegions()Initializes the file, package and project regions -
addInterface
Adds the type to the collection of interfaces. -
addRootClass
Adds the type to the collection of root classes if the classes is not already present in the collection. -
addSubtype
Adds the given subtype to the type. -
addTypeHierarchyChangedListener
Beschreibung aus Schnittstelle kopiert:ITypeHierarchy
Adds the given listener for changes to this type hierarchy. Listeners are notified when this type hierarchy changes and needs to be refreshed. Has no effect if an identical listener is already registered.- Angegeben von:
addTypeHierarchyChangedListener
in SchnittstelleITypeHierarchy
- Parameter:
listener
- the listener- Siehe auch:
-
cacheFlags
cacheFlags. -
cacheSuperclass
Caches the handle of the superclass for the specified type. As a side effect cache this type as a subtype of the superclass. -
cacheSuperInterfaces
Caches all of the superinterfaces that are specified for the type. -
checkCanceled
protected void checkCanceled()Checks with the progress monitor to see whether the creation of the type hierarchy should be canceled. Should be regularly called so that the user can cancel.- Löst aus:
org.eclipse.core.runtime.OperationCanceledException
- if cancelling the operation has been requested- Siehe auch:
-
compute
Compute this type hierarchy.- Löst aus:
JavaModelException
org.eclipse.core.runtime.CoreException
-
contains
Beschreibung aus Schnittstelle kopiert:ITypeHierarchy
Returns whether the given type is part of this hierarchy.- Angegeben von:
contains
in SchnittstelleITypeHierarchy
- Parameter:
type
- the given type- Gibt zurück:
- true if the given type is part of this hierarchy, false otherwise
- Siehe auch:
-
elementChanged
Determines if the change affects this hierarchy, and fires change notification if required.- Angegeben von:
elementChanged
in SchnittstelleIElementChangedListener
- Parameter:
event
- the change event
-
exists
public boolean exists()Beschreibung aus Schnittstelle kopiert:ITypeHierarchy
Returns whether the type and project this hierarchy was created on exist.- Angegeben von:
exists
in SchnittstelleITypeHierarchy
- Gibt zurück:
- true if the type and project this hierarchy was created on exist, false otherwise
- Siehe auch:
-
fireChange
public void fireChange()Notifies listeners that this hierarchy has changed and needs refreshing. Note that listeners can be removed as we iterate through the list. -
getAllClasses
Beschreibung aus Schnittstelle kopiert:ITypeHierarchy
Returns all classes in this type hierarchy's graph, in no particular order. Any classes in the creation region which were not resolved to have any subtypes or supertypes are not included in the result.- Angegeben von:
getAllClasses
in SchnittstelleITypeHierarchy
- Gibt zurück:
- all classes in this type hierarchy's graph
- Siehe auch:
-
getAllInterfaces
Beschreibung aus Schnittstelle kopiert:ITypeHierarchy
Returns all interfaces in this type hierarchy's graph, in no particular order. Any interfaces in the creation region which were not resolved to have any subtypes or supertypes are not included in the result.- Angegeben von:
getAllInterfaces
in SchnittstelleITypeHierarchy
- Gibt zurück:
- all interfaces in this type hierarchy's graph
- Siehe auch:
-
getAllSubtypes
Beschreibung aus Schnittstelle kopiert:ITypeHierarchy
Returns all resolved subtypes (direct and indirect) of the given type, in no particular order, limited to the types in this type hierarchy's graph. An empty array is returned if there are no resolved subtypes for the given type.- Angegeben von:
getAllSubtypes
in SchnittstelleITypeHierarchy
- Parameter:
type
- the given type- Gibt zurück:
- all resolved subtypes (direct and indirect) of the given type
- Siehe auch:
-
getAllSuperclasses
Beschreibung aus Schnittstelle kopiert:ITypeHierarchy
Returns all resolved superclasses of the given class, in bottom-up order. An empty array is returned if there are no resolved superclasses for the given class.NOTE: once a type hierarchy has been created, it is more efficient to query the hierarchy for superclasses than to query a class recursively up the superclass chain. Querying an element performs a dynamic resolution, whereas the hierarchy returns a pre-computed result.
- Angegeben von:
getAllSuperclasses
in SchnittstelleITypeHierarchy
- Parameter:
type
- the given type- Gibt zurück:
- all resolved superclasses of the given class, in bottom-up order, an empty array if none.
- Siehe auch:
-
getAllSuperInterfaces
Beschreibung aus Schnittstelle kopiert:ITypeHierarchy
Returns all resolved superinterfaces (direct and indirect) of the given type. If the given type is a class, this includes all superinterfaces of all superclasses. An empty array is returned if there are no resolved superinterfaces for the given type.NOTE: once a type hierarchy has been created, it is more efficient to query the hierarchy for superinterfaces than to query a type recursively. Querying an element performs a dynamic resolution, whereas the hierarchy returns a pre-computed result.
- Angegeben von:
getAllSuperInterfaces
in SchnittstelleITypeHierarchy
- Parameter:
type
- the given type- Gibt zurück:
- all resolved superinterfaces (direct and indirect) of the given type, an empty array if none
- Siehe auch:
-
getAllSupertypes
Beschreibung aus Schnittstelle kopiert:ITypeHierarchy
Returns all resolved supertypes of the given type, in bottom-up order. An empty array is returned if there are no resolved supertypes for the given type.Note that
java.lang.Object
is NOT considered to be a supertype of any interface type.NOTE: once a type hierarchy has been created, it is more efficient to query the hierarchy for supertypes than to query a type recursively up the supertype chain. Querying an element performs a dynamic resolution, whereas the hierarchy returns a pre-computed result.
- Angegeben von:
getAllSupertypes
in SchnittstelleITypeHierarchy
- Parameter:
type
- the given type- Gibt zurück:
- all resolved supertypes of the given class, in bottom-up order, an empty array if none
- Siehe auch:
-
getAllTypes
Beschreibung aus Schnittstelle kopiert:ITypeHierarchy
Returns all types in this type hierarchy's graph, in no particular order. Any types in the creation region which were not resolved to have any subtypes or supertypes are not included in the result.- Angegeben von:
getAllTypes
in SchnittstelleITypeHierarchy
- Gibt zurück:
- all types in this type hierarchy's graph
- Siehe auch:
-
getCachedFlags
Beschreibung aus Schnittstelle kopiert:ITypeHierarchy
Return the flags associated with the given type (would be equivalent toIMember.getFlags()
), or-1
if this information wasn't cached on the hierarchy during its computation.- Angegeben von:
getCachedFlags
in SchnittstelleITypeHierarchy
- Parameter:
type
- the given type- Gibt zurück:
- the modifier flags for this member
- Siehe auch:
-
getExtendingInterfaces
Beschreibung aus Schnittstelle kopiert:ITypeHierarchy
Returns all interfaces resolved to extend the given interface, in no particular order, limited to the interfaces in this hierarchy's graph. Returns an empty collection if the given type is a class, or if no interfaces were resolved to extend the given interface.- Angegeben von:
getExtendingInterfaces
in SchnittstelleITypeHierarchy
- Parameter:
type
- the given type- Gibt zurück:
- all interfaces resolved to extend the given interface limited to the interfaces in this hierarchy's graph, an empty array if none.
- Siehe auch:
-
getImplementingClasses
Beschreibung aus Schnittstelle kopiert:ITypeHierarchy
Returns all classes resolved to implement the given interface, in no particular order, limited to the classes in this type hierarchy's graph. Returns an empty collection if the given type is a class, or if no classes were resolved to implement the given interface.- Angegeben von:
getImplementingClasses
in SchnittstelleITypeHierarchy
- Parameter:
type
- the given type- Gibt zurück:
- all classes resolved to implement the given interface limited to the classes in this type hierarchy's graph, an empty array if none
- Siehe auch:
-
getRootClasses
Beschreibung aus Schnittstelle kopiert:ITypeHierarchy
Returns all classes in the graph which have no resolved superclass, in no particular order.- Angegeben von:
getRootClasses
in SchnittstelleITypeHierarchy
- Gibt zurück:
- all classes in the graph which have no resolved superclass
- Siehe auch:
-
getRootInterfaces
Beschreibung aus Schnittstelle kopiert:ITypeHierarchy
Returns all interfaces in the graph which have no resolved superinterfaces, in no particular order.- Angegeben von:
getRootInterfaces
in SchnittstelleITypeHierarchy
- Gibt zurück:
- all interfaces in the graph which have no resolved superinterfaces
- Siehe auch:
-
getSubclasses
Beschreibung aus Schnittstelle kopiert:ITypeHierarchy
Returns the direct resolved subclasses of the given class, in no particular order, limited to the classes in this type hierarchy's graph. Returns an empty collection if the given type is an interface, or if no classes were resolved to be subclasses of the given class.- Angegeben von:
getSubclasses
in SchnittstelleITypeHierarchy
- Parameter:
type
- the given type- Gibt zurück:
- the direct resolved subclasses of the given class limited to the classes in this type hierarchy's graph, an empty collection if none.
- Siehe auch:
-
getSubtypes
Beschreibung aus Schnittstelle kopiert:ITypeHierarchy
Returns the direct resolved subtypes of the given type, in no particular order, limited to the types in this type hierarchy's graph. If the type is a class, this returns the resolved subclasses. If the type is an interface, this returns both the classes which implement the interface and the interfaces which extend it.- Angegeben von:
getSubtypes
in SchnittstelleITypeHierarchy
- Parameter:
type
- the given type- Gibt zurück:
- the direct resolved subtypes of the given type limited to the types in this type hierarchy's graph
- Siehe auch:
-
getSuperclass
Beschreibung aus Schnittstelle kopiert:ITypeHierarchy
Returns the resolved superclass of the given class, ornull
if the given class has no superclass, the superclass could not be resolved, or if the given type is an interface.- Angegeben von:
getSuperclass
in SchnittstelleITypeHierarchy
- Parameter:
type
- the given type- Gibt zurück:
- the resolved superclass of the given class,
or
null
if the given class has no superclass, the superclass could not be resolved, or if the given type is an interface - Siehe auch:
-
getSuperInterfaces
Beschreibung aus Schnittstelle kopiert:ITypeHierarchy
Returns the direct resolved interfaces that the given type implements or extends, in no particular order, limited to the interfaces in this type hierarchy's graph. For classes, this gives the interfaces that the class implements. For interfaces, this gives the interfaces that the interface extends.- Angegeben von:
getSuperInterfaces
in SchnittstelleITypeHierarchy
- Parameter:
type
- the given type- Gibt zurück:
- the direct resolved interfaces that the given type implements or extends limited to the interfaces in this type hierarchy's graph
- Siehe auch:
-
getSupertypes
Beschreibung aus Schnittstelle kopiert:ITypeHierarchy
Returns the resolved supertypes of the given type, in no particular order, limited to the types in this type hierarchy's graph. For classes, this returns its superclass and the interfaces that the class implements. For interfaces, this returns the interfaces that the interface extends. As a consequencejava.lang.Object
is NOT considered to be a supertype of any interface type.- Angegeben von:
getSupertypes
in SchnittstelleITypeHierarchy
- Parameter:
type
- the given type- Gibt zurück:
- the resolved supertypes of the given type limited to the types in this type hierarchy's graph
- Siehe auch:
-
getType
Beschreibung aus Schnittstelle kopiert:ITypeHierarchy
Returns the type this hierarchy was computed for. Returnsnull
if this hierarchy was computed for a region.- Angegeben von:
getType
in SchnittstelleITypeHierarchy
- Gibt zurück:
- the type this hierarchy was computed for
- Siehe auch:
-
growAndAddToArray
Adds the new elements to a new array that contains all of the elements of the old array. Returns the new array. -
growAndAddToArray
Adds the new element to a new array that contains all of the elements of the old array. Returns the new array. -
hasFineGrainChanges
public boolean hasFineGrainChanges() -
initialize
protected void initialize(int size) Initializes this hierarchy's internal tables with the given size. -
isAffected
Returns true if the given delta could change this type hierarchy- Parameter:
eventType
- TODO
-
isAffectedByOpenable
protected boolean isAffectedByOpenable(IJavaElementDelta delta, IJavaElement element, int eventType) Returns true if the given type delta (a compilation unit delta or a class file delta) could affect this type hierarchy.- Parameter:
eventType
- TODO
-
javaProject
Returns the java project this hierarchy was created in. -
readUntil
protected static byte[] readUntil(InputStream input, byte separator) throws JavaModelException, IOException - Löst aus:
JavaModelException
IOException
-
readUntil
protected static byte[] readUntil(InputStream input, byte separator, int offset) throws IOException, JavaModelException - Löst aus:
IOException
JavaModelException
-
load
public static ITypeHierarchy load(IType type, InputStream input, WorkingCopyOwner owner) throws JavaModelException - Löst aus:
JavaModelException
-
packageRegionContainsSamePackageFragment
Returnstrue
if an equivalent package fragment is included in the package region. Package fragments are equivalent if they both have the same name. -
refresh
Beschreibung aus Schnittstelle kopiert:ITypeHierarchy
Re-computes the type hierarchy reporting progress.- Angegeben von:
refresh
in SchnittstelleITypeHierarchy
- Parameter:
monitor
- the given progress monitor- Löst aus:
JavaModelException
- if unable to refresh the hierarchy- Siehe auch:
-
removeTypeHierarchyChangedListener
Beschreibung aus Schnittstelle kopiert:ITypeHierarchy
Removes the given listener from this type hierarchy. Has no effect if an identical listener is not registered.- Angegeben von:
removeTypeHierarchyChangedListener
in SchnittstelleITypeHierarchy
- Parameter:
listener
- the listener- Siehe auch:
-
store
public void store(OutputStream output, org.eclipse.core.runtime.IProgressMonitor monitor) throws JavaModelException Beschreibung aus Schnittstelle kopiert:ITypeHierarchy
Stores the type hierarchy in an output stream. This stored hierarchy can be load by IType#loadTypeHierachy(IJavaProject, InputStream, IProgressMonitor). Listeners of this hierarchy are not stored. Only hierarchies created by the following methods can be store:- IType#newSupertypeHierarchy(IProgressMonitor)
- IType#newTypeHierarchy(IJavaProject, IProgressMonitor)
- IType#newTypeHierarchy(IProgressMonitor)
- Angegeben von:
store
in SchnittstelleITypeHierarchy
- Parameter:
output
- output stream where the hierarchy will be storedmonitor
- the given progress monitor- Löst aus:
JavaModelException
- if unable to store the hierarchy in the ouput stream- Siehe auch:
-
toString
-
worked
protected void worked(int work) - Siehe auch:
-