Package org.eclipse.xtext.xbase.imports
Class TypeUsageCollector
- java.lang.Object
-
- org.eclipse.xtext.xbase.imports.TypeUsageCollector
-
- Direct Known Subclasses:
ImportedTypesCollector
public class TypeUsageCollector extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classTypeUsageCollector.PreferredType
-
Constructor Summary
Constructors Constructor Description TypeUsageCollector()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidacceptPreferredType(org.eclipse.emf.ecore.EObject owner, org.eclipse.emf.ecore.EReference referenceToTypeOrMember)protected voidacceptPreferredType(org.eclipse.xtext.common.types.JvmTypeReference ref)protected voidacceptStaticExtensionImport(org.eclipse.xtext.common.types.JvmMember member)protected voidacceptStaticImport(org.eclipse.xtext.common.types.JvmMember member)protected voidacceptType(org.eclipse.xtext.common.types.JvmTypeReference ref)protected voidacceptType(org.eclipse.xtext.common.types.JvmType type, org.eclipse.xtext.common.types.JvmType usedType, org.eclipse.xtext.util.ITextRegion refRegion)protected voidacceptType(org.eclipse.xtext.common.types.JvmType type, org.eclipse.xtext.util.ITextRegion refRegion)protected voidacceptUnresolvedType(java.lang.String usedTypeName, java.lang.String suffix, org.eclipse.xtext.util.ITextRegion refRegion)protected voidaddJavaDocReferences(org.eclipse.emf.ecore.EObject element)protected voidcollectAllReferences(org.eclipse.emf.ecore.EObject rootElement)protected voidcollectStaticImportsFrom(ILinkingCandidate linkingCandidate)protected voidcollectStaticImportsFrom(XExpression expression, org.eclipse.xtext.common.types.JvmIdentifiableElement feature)TypeUsagescollectTypeUsages(org.eclipse.xtext.resource.XtextResource resource)protected TypeUsageCollector.PreferredTypefindPreferredType(org.eclipse.emf.ecore.EObject owner, org.eclipse.emf.ecore.EReference reference, java.lang.String text)Tries to locate the syntax for the type reference that the user used in the original code.protected TypeUsageCollector.PreferredTypefindPreferredType(org.eclipse.xtext.common.types.JvmDeclaredType referencedType, java.lang.String text)protected org.eclipse.xtext.common.types.JvmMembergetCurrentContext()protected java.lang.StringgetFirstNameSegment(java.lang.String text)protected org.eclipse.xtext.common.types.JvmIdentifiableElementgetReferencedElement(org.eclipse.emf.ecore.EObject owner, org.eclipse.emf.ecore.EReference reference)org.eclipse.xtext.resource.XtextResourcegetResource()protected TypeUsagesgetTypeUsages()protected booleanneedsStaticImport(org.eclipse.xtext.common.types.JvmDeclaredType declarator)
-
-
-
Method Detail
-
getResource
public org.eclipse.xtext.resource.XtextResource getResource()
-
getCurrentContext
protected org.eclipse.xtext.common.types.JvmMember getCurrentContext()
-
getTypeUsages
protected TypeUsages getTypeUsages()
-
collectTypeUsages
public TypeUsages collectTypeUsages(org.eclipse.xtext.resource.XtextResource resource)
-
collectAllReferences
protected void collectAllReferences(org.eclipse.emf.ecore.EObject rootElement)
-
collectStaticImportsFrom
protected void collectStaticImportsFrom(ILinkingCandidate linkingCandidate)
-
collectStaticImportsFrom
protected void collectStaticImportsFrom(XExpression expression, org.eclipse.xtext.common.types.JvmIdentifiableElement feature)
-
addJavaDocReferences
protected void addJavaDocReferences(org.eclipse.emf.ecore.EObject element)
-
acceptType
protected void acceptType(org.eclipse.xtext.common.types.JvmTypeReference ref)
-
acceptPreferredType
protected void acceptPreferredType(org.eclipse.xtext.common.types.JvmTypeReference ref)
-
findPreferredType
protected TypeUsageCollector.PreferredType findPreferredType(org.eclipse.emf.ecore.EObject owner, org.eclipse.emf.ecore.EReference reference, java.lang.String text)
Tries to locate the syntax for the type reference that the user used in the original code. Especially interesting for nested types, where one could prefer the (arguably) more explicit (or verbose)Resource$Factorywith an import oforg.eclipse.emf.core.Resourceover the probably shorterFactorywith an import oforg.eclipse.emf.core.Resource$Factory. The function relies on a node model to be available. Otherwise the actually referenced type is used as the preferred type.- Parameters:
owner- the referrer to the JVM concept.reference- a reference to aJvmTypeorJvmMemberthat is declared in a type.- Returns:
- the referenced type or one of its containers.
-
getReferencedElement
protected org.eclipse.xtext.common.types.JvmIdentifiableElement getReferencedElement(org.eclipse.emf.ecore.EObject owner, org.eclipse.emf.ecore.EReference reference)
-
getFirstNameSegment
protected java.lang.String getFirstNameSegment(java.lang.String text)
-
findPreferredType
protected TypeUsageCollector.PreferredType findPreferredType(org.eclipse.xtext.common.types.JvmDeclaredType referencedType, java.lang.String text)
-
acceptPreferredType
protected void acceptPreferredType(org.eclipse.emf.ecore.EObject owner, org.eclipse.emf.ecore.EReference referenceToTypeOrMember)
-
acceptType
protected void acceptType(org.eclipse.xtext.common.types.JvmType type, org.eclipse.xtext.util.ITextRegion refRegion)
-
acceptType
protected void acceptType(org.eclipse.xtext.common.types.JvmType type, org.eclipse.xtext.common.types.JvmType usedType, org.eclipse.xtext.util.ITextRegion refRegion)
-
acceptUnresolvedType
protected void acceptUnresolvedType(java.lang.String usedTypeName, java.lang.String suffix, org.eclipse.xtext.util.ITextRegion refRegion)
-
acceptStaticImport
protected void acceptStaticImport(org.eclipse.xtext.common.types.JvmMember member)
-
acceptStaticExtensionImport
protected void acceptStaticExtensionImport(org.eclipse.xtext.common.types.JvmMember member)
-
needsStaticImport
protected boolean needsStaticImport(org.eclipse.xtext.common.types.JvmDeclaredType declarator)
-
-