Class TypeUsageCollector

    • Constructor Detail

      • TypeUsageCollector

        public TypeUsageCollector()
    • 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 of org.eclipse.emf.core.Resource over the probably shorter Factory with an import of org.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 a JvmType or JvmMember 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)