Class AbstractFeatureScopeSession
- java.lang.Object
-
- org.eclipse.xtext.xbase.scoping.batch.AbstractFeatureScopeSession
-
- All Implemented Interfaces:
IFeatureScopeSession,IVisibilityHelper
- Direct Known Subclasses:
AbstractNestedFeatureScopeSession,RootFeatureScopeSession
public abstract class AbstractFeatureScopeSession extends java.lang.Object implements IFeatureScopeSession
Skeleton implementation for feature scope sessions. It introduces a simple means to identify the nesting level (getId(). Requested scopes for other things that features are delegated to thedefault scope provider. The concrete scope computation is performed bya utility.
-
-
Field Summary
-
Fields inherited from interface org.eclipse.xtext.xbase.typesystem.util.IVisibilityHelper
ALL
-
-
Constructor Summary
Constructors Constructor Description AbstractFeatureScopeSession()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidaddExtensionProviders(java.util.List<ExpressionBucket> result)IFeatureScopeSessionaddImports(ITypeImporter.Client importer)Add types to the session that are either imported statically or as extension.IFeatureScopeSessionaddLocalElement(org.eclipse.xtext.naming.QualifiedName name, org.eclipse.xtext.common.types.JvmIdentifiableElement element, ITypeReferenceOwner owner)Add a locally defined identifiable to this scope.protected voidaddLocalElements(java.util.List<org.eclipse.xtext.resource.IEObjectDescription> result)IFeatureScopeSessionaddLocalElements(java.util.Map<org.eclipse.xtext.naming.QualifiedName,org.eclipse.xtext.common.types.JvmIdentifiableElement> elements, ITypeReferenceOwner owner)Add locally defined identifiables to this scope.IFeatureScopeSessionaddNestedTypesToScope(org.eclipse.xtext.common.types.JvmDeclaredType type)Make inherited and declared nested classes oftypeavailable by their simple names.IFeatureScopeSessionaddToExtensionScope(java.util.Map<XExpression,LightweightTypeReference> extensionProviders)Add receivers to the session that contribute extensions.IFeatureScopeSessionaddTypesToStaticScope(java.util.List<? extends org.eclipse.xtext.common.types.JvmType> staticFeatureProviders, java.util.List<? extends org.eclipse.xtext.common.types.JvmType> extensionProviders)Add types to the session that are imported statically either as plain static imports or with an extension semantic.IFeatureScopeSessioncaptureLocalElements()Allows to capture the available local elements as if they have been defined on thethistype as a member.protected org.eclipse.xtext.scoping.IScopecreateConstructorScope(org.eclipse.emf.ecore.EObject context, org.eclipse.emf.ecore.EReference reference, IResolvedTypes resolvedTypes)protected org.eclipse.xtext.scoping.IScopecreateFeatureCallScope(org.eclipse.emf.ecore.EObject context, org.eclipse.emf.ecore.EReference reference, IResolvedTypes resolvedTypes)protected org.eclipse.xtext.scoping.IScopecreateTypeScope(org.eclipse.emf.ecore.EObject context, org.eclipse.emf.ecore.EReference reference, IResolvedTypes resolvedTypes)IFeatureScopeSessiondropLocalElements()Allows to drop certain local elements from the current scope such as the enclosingthisfor static inner classes.protected abstract ConstructorScopesgetConstructorScopes()protected abstract org.eclipse.xtext.scoping.IScopeProvidergetDefaultScopeProvider()java.util.List<org.eclipse.xtext.common.types.JvmDeclaredType>getEnclosingTypes()Returns a list of enclosing types that provide an instance in the current context.java.util.List<ExpressionBucket>getExtensionProviders()All extension providers as expression buckets.protected abstract FeatureScopesgetFeatureScopes()protected abstract intgetId()A simple means to identify the session.java.util.List<org.eclipse.xtext.resource.IEObjectDescription>getLocalElements()Return all local elements that are known in this session.java.util.List<org.eclipse.xtext.common.types.JvmDeclaredType>getNestedTypeDeclarators()Returns enclosing types that declare available nested types.IFeatureScopeSessiongetNextCaptureLayer()Returns the next layer of the captured scopes.protected abstract IResolvedFeatures.ProvidergetResolvedFeaturesProvider()org.eclipse.xtext.scoping.IScopegetScope(org.eclipse.emf.ecore.EObject context, org.eclipse.emf.ecore.EReference reference, IResolvedTypes types)Return the scope for the givencontextandreferencebased on the known resolvedtypes.java.util.List<TypeBucket>getStaticallyImportedExtensionTypes()All statically imported extension types as type buckets.java.util.List<TypeBucket>getStaticallyImportedTypes()All statically imported types as type buckets.protected abstract TypeScopesgetTypeScopes()IFeatureScopeSessiontoConstructorContext()Forks this session with a constructor context.IFeatureScopeSessiontoInstanceContext()Forks this session with an instance context.protected AbstractNestedFeatureScopeSessiontryCreateNestedSessionWithVisibilityContext(java.util.Map<org.eclipse.xtext.naming.QualifiedName,org.eclipse.xtext.common.types.JvmIdentifiableElement> elements, ITypeReferenceOwner owner, org.eclipse.xtext.naming.QualifiedName thisName)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.eclipse.xtext.xbase.scoping.batch.IFeatureScopeSession
getLocalElement, isConstructorContext, isInstanceContext, isVisible
-
Methods inherited from interface org.eclipse.xtext.xbase.typesystem.util.IVisibilityHelper
isVisible
-
-
-
-
Method Detail
-
getScope
public org.eclipse.xtext.scoping.IScope getScope(org.eclipse.emf.ecore.EObject context, org.eclipse.emf.ecore.EReference reference, IResolvedTypes types)Description copied from interface:IFeatureScopeSessionReturn the scope for the givencontextandreferencebased on the known resolvedtypes.- Specified by:
getScopein interfaceIFeatureScopeSession- Parameters:
context- the context object. May not benull.reference- the reference that holds the unresolved proxy. May not benull.types- the already computed types.- See Also:
IScopeProvider.getScope(EObject, EReference)
-
addTypesToStaticScope
public IFeatureScopeSession addTypesToStaticScope(java.util.List<? extends org.eclipse.xtext.common.types.JvmType> staticFeatureProviders, java.util.List<? extends org.eclipse.xtext.common.types.JvmType> extensionProviders)
Description copied from interface:IFeatureScopeSessionAdd types to the session that are imported statically either as plain static imports or with an extension semantic.- Specified by:
addTypesToStaticScopein interfaceIFeatureScopeSession- Parameters:
staticFeatureProviders- the static feature providers. May not benull.extensionProviders- the static extension providers. May not benull.- Returns:
- a configured session.
-
addImports
public IFeatureScopeSession addImports(ITypeImporter.Client importer)
Description copied from interface:IFeatureScopeSessionAdd types to the session that are either imported statically or as extension.- Specified by:
addImportsin interfaceIFeatureScopeSession- Parameters:
importer- the description of the imported types.- Returns:
- a configured session.
-
getResolvedFeaturesProvider
protected abstract IResolvedFeatures.Provider getResolvedFeaturesProvider()
-
getFeatureScopes
protected abstract FeatureScopes getFeatureScopes()
-
getConstructorScopes
protected abstract ConstructorScopes getConstructorScopes()
-
getTypeScopes
protected abstract TypeScopes getTypeScopes()
-
getDefaultScopeProvider
protected abstract org.eclipse.xtext.scoping.IScopeProvider getDefaultScopeProvider()
-
getId
protected abstract int getId()
A simple means to identify the session.
-
addToExtensionScope
public IFeatureScopeSession addToExtensionScope(java.util.Map<XExpression,LightweightTypeReference> extensionProviders)
Description copied from interface:IFeatureScopeSessionAdd receivers to the session that contribute extensions. The expressions in the map will be cloned on demand prior to adding them to the model. They are prototypes.- Specified by:
addToExtensionScopein interfaceIFeatureScopeSession- Parameters:
extensionProviders- the expressions that yield extension receivers.- Returns:
- a configured session.
-
addNestedTypesToScope
public IFeatureScopeSession addNestedTypesToScope(org.eclipse.xtext.common.types.JvmDeclaredType type)
Description copied from interface:IFeatureScopeSessionMake inherited and declared nested classes oftypeavailable by their simple names.- Specified by:
addNestedTypesToScopein interfaceIFeatureScopeSession
-
getEnclosingTypes
public java.util.List<org.eclipse.xtext.common.types.JvmDeclaredType> getEnclosingTypes()
Description copied from interface:IFeatureScopeSessionReturns a list of enclosing types that provide an instance in the current context. The first element in the list is the innermost type.- Specified by:
getEnclosingTypesin interfaceIFeatureScopeSession
-
getNestedTypeDeclarators
public java.util.List<org.eclipse.xtext.common.types.JvmDeclaredType> getNestedTypeDeclarators()
Description copied from interface:IFeatureScopeSessionReturns enclosing types that declare available nested types. The first element in the list is the innermost type.- Specified by:
getNestedTypeDeclaratorsin interfaceIFeatureScopeSession
-
getNextCaptureLayer
public IFeatureScopeSession getNextCaptureLayer()
Description copied from interface:IFeatureScopeSessionReturns the next layer of the captured scopes.- Specified by:
getNextCaptureLayerin interfaceIFeatureScopeSession
-
toInstanceContext
public IFeatureScopeSession toInstanceContext()
Description copied from interface:IFeatureScopeSessionForks this session with an instance context. References to 'this' are only valid in instance contexts.- Specified by:
toInstanceContextin interfaceIFeatureScopeSession- See Also:
IFeatureScopeSession.isInstanceContext()
-
toConstructorContext
public IFeatureScopeSession toConstructorContext()
Description copied from interface:IFeatureScopeSessionForks this session with a constructor context. References to delegation constructors are only valid within this context.- Specified by:
toConstructorContextin interfaceIFeatureScopeSession- See Also:
IFeatureScopeSession.isInstanceContext()
-
dropLocalElements
public IFeatureScopeSession dropLocalElements()
Description copied from interface:IFeatureScopeSessionAllows to drop certain local elements from the current scope such as the enclosingthisfor static inner classes.- Specified by:
dropLocalElementsin interfaceIFeatureScopeSession
-
captureLocalElements
public IFeatureScopeSession captureLocalElements()
Description copied from interface:IFeatureScopeSessionAllows to capture the available local elements as if they have been defined on thethistype as a member. This will provide a proper scope for non static nested or local classes.- Specified by:
captureLocalElementsin interfaceIFeatureScopeSession
-
addLocalElement
public IFeatureScopeSession addLocalElement(org.eclipse.xtext.naming.QualifiedName name, org.eclipse.xtext.common.types.JvmIdentifiableElement element, ITypeReferenceOwner owner)
Description copied from interface:IFeatureScopeSessionAdd a locally defined identifiable to this scope. It will shadow previously registered locals. No validation of the given name is performed.- Specified by:
addLocalElementin interfaceIFeatureScopeSession- Parameters:
name- the qualified name of the identifiable.element- the element itself.- Returns:
- a configured session.
-
addLocalElements
public IFeatureScopeSession addLocalElements(java.util.Map<org.eclipse.xtext.naming.QualifiedName,org.eclipse.xtext.common.types.JvmIdentifiableElement> elements, ITypeReferenceOwner owner)
Description copied from interface:IFeatureScopeSessionAdd locally defined identifiables to this scope. Since the elements have unique names, they cannot shadow each other. However, they will shadow previously added local elements.- Specified by:
addLocalElementsin interfaceIFeatureScopeSession- Parameters:
elements- the local elements.- Returns:
- a configured session.
-
tryCreateNestedSessionWithVisibilityContext
protected AbstractNestedFeatureScopeSession tryCreateNestedSessionWithVisibilityContext(java.util.Map<org.eclipse.xtext.naming.QualifiedName,org.eclipse.xtext.common.types.JvmIdentifiableElement> elements, ITypeReferenceOwner owner, org.eclipse.xtext.naming.QualifiedName thisName)
-
createFeatureCallScope
protected org.eclipse.xtext.scoping.IScope createFeatureCallScope(org.eclipse.emf.ecore.EObject context, org.eclipse.emf.ecore.EReference reference, IResolvedTypes resolvedTypes)
-
createConstructorScope
protected org.eclipse.xtext.scoping.IScope createConstructorScope(org.eclipse.emf.ecore.EObject context, org.eclipse.emf.ecore.EReference reference, IResolvedTypes resolvedTypes)
-
createTypeScope
protected org.eclipse.xtext.scoping.IScope createTypeScope(org.eclipse.emf.ecore.EObject context, org.eclipse.emf.ecore.EReference reference, IResolvedTypes resolvedTypes)
-
getLocalElements
public java.util.List<org.eclipse.xtext.resource.IEObjectDescription> getLocalElements()
Description copied from interface:IFeatureScopeSessionReturn all local elements that are known in this session.- Specified by:
getLocalElementsin interfaceIFeatureScopeSession- Returns:
- all local elements. Never
null.
-
addLocalElements
protected void addLocalElements(java.util.List<org.eclipse.xtext.resource.IEObjectDescription> result)
- Parameters:
result- the list of all local elements. Shadowing semantics do not have to be applied.
-
getStaticallyImportedTypes
public java.util.List<TypeBucket> getStaticallyImportedTypes()
Description copied from interface:IFeatureScopeSessionAll statically imported types as type buckets. The list has usually two elements:- The implicitly imported types as a single bucket.
- The explicitly imported types as a single bucket.
- Specified by:
getStaticallyImportedTypesin interfaceIFeatureScopeSession
-
getStaticallyImportedExtensionTypes
public java.util.List<TypeBucket> getStaticallyImportedExtensionTypes()
Description copied from interface:IFeatureScopeSessionAll statically imported extension types as type buckets. The list has usually two elements:- The implicitly available extensions as a single bucket.
- The explicitly imported extensions as a single bucket.
- Specified by:
getStaticallyImportedExtensionTypesin interfaceIFeatureScopeSession
-
getExtensionProviders
public java.util.List<ExpressionBucket> getExtensionProviders()
Description copied from interface:IFeatureScopeSessionAll extension providers as expression buckets.- Specified by:
getExtensionProvidersin interfaceIFeatureScopeSession- Returns:
- the list of extension providers.
-
addExtensionProviders
protected void addExtensionProviders(java.util.List<ExpressionBucket> result)
- Parameters:
result- an aggregating parameter that accepts the extension providers.
-
-