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 class
TypeUsageCollector.PreferredType
-
Constructor Summary
Constructors Constructor Description TypeUsageCollector()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
acceptPreferredType(org.eclipse.emf.ecore.EObject owner, org.eclipse.emf.ecore.EReference referenceToTypeOrMember)
protected void
acceptPreferredType(org.eclipse.xtext.common.types.JvmTypeReference ref)
protected void
acceptStaticExtensionImport(org.eclipse.xtext.common.types.JvmMember member)
protected void
acceptStaticImport(org.eclipse.xtext.common.types.JvmMember member)
protected void
acceptType(org.eclipse.xtext.common.types.JvmTypeReference ref)
protected void
acceptType(org.eclipse.xtext.common.types.JvmType type, org.eclipse.xtext.common.types.JvmType usedType, org.eclipse.xtext.util.ITextRegion refRegion)
protected void
acceptType(org.eclipse.xtext.common.types.JvmType type, org.eclipse.xtext.util.ITextRegion refRegion)
protected void
acceptUnresolvedType(java.lang.String usedTypeName, java.lang.String suffix, org.eclipse.xtext.util.ITextRegion refRegion)
protected void
addJavaDocReferences(org.eclipse.emf.ecore.EObject element)
protected void
collectAllReferences(org.eclipse.emf.ecore.EObject rootElement)
protected void
collectStaticImportsFrom(ILinkingCandidate linkingCandidate)
protected void
collectStaticImportsFrom(XExpression expression, org.eclipse.xtext.common.types.JvmIdentifiableElement feature)
TypeUsages
collectTypeUsages(org.eclipse.xtext.resource.XtextResource resource)
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.protected TypeUsageCollector.PreferredType
findPreferredType(org.eclipse.xtext.common.types.JvmDeclaredType referencedType, java.lang.String text)
protected org.eclipse.xtext.common.types.JvmMember
getCurrentContext()
protected java.lang.String
getFirstNameSegment(java.lang.String text)
protected org.eclipse.xtext.common.types.JvmIdentifiableElement
getReferencedElement(org.eclipse.emf.ecore.EObject owner, org.eclipse.emf.ecore.EReference reference)
org.eclipse.xtext.resource.XtextResource
getResource()
protected TypeUsages
getTypeUsages()
protected boolean
needsStaticImport(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$Factory
with an import oforg.eclipse.emf.core.Resource
over the probably shorterFactory
with 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 aJvmType
orJvmMember
that 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)
-
-