Package org.eclipse.xtext.xbase.jvmmodel
Class JvmModelAssociator
- java.lang.Object
-
- org.eclipse.xtext.xbase.jvmmodel.JvmModelAssociator
-
- All Implemented Interfaces:
org.eclipse.xtext.resource.IDerivedStateComputer,IJvmModelAssociations,IJvmModelAssociator,ILogicalContainerProvider
public class JvmModelAssociator extends java.lang.Object implements IJvmModelAssociations, IJvmModelAssociator, ILogicalContainerProvider, org.eclipse.xtext.resource.IDerivedStateComputer
- Since:
- 2.7
- Noreference:
- This class is not intended to be referenced by clients.
- Noextend:
- This class is not intended to be subclassed by clients.
- Noinstantiate:
- This class is not intended to be instantiated by clients.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classJvmModelAssociator.Adapterstatic classJvmModelAssociator.JvmDeclaredTypeAcceptorprotected static classJvmModelAssociator.ListBasedSet<E>
-
Constructor Summary
Constructors Constructor Description JvmModelAssociator()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidassociate(org.eclipse.emf.ecore.EObject sourceElement, org.eclipse.emf.ecore.EObject jvmElement)Associated the given source element with the given jvmElement.voidassociateLogicalContainer(XExpression logicalChild, org.eclipse.xtext.common.types.JvmIdentifiableElement element)Sets the givenJvmIdentifiableElementas the logical container of the givenXExpression.voidassociatePrimary(org.eclipse.emf.ecore.EObject sourceElement, org.eclipse.emf.ecore.EObject jvmElement)Associated the given source element with the given jvmElement and marks the association as primary on both sides.protected voidcheckLanguageResource(org.eclipse.emf.ecore.resource.Resource eResource)protected voidcheckSameResource(org.eclipse.emf.ecore.resource.Resource eResource, org.eclipse.emf.ecore.resource.Resource eResource2)voidcleanAssociationState(org.eclipse.emf.ecore.resource.Resource resource)voiddiscardDerivedState(org.eclipse.xtext.resource.DerivedStateAwareResource resource)XExpressiongetAssociatedExpression(org.eclipse.xtext.common.types.JvmIdentifiableElement element)java.util.Set<org.eclipse.emf.ecore.EObject>getJvmElements(org.eclipse.emf.ecore.EObject sourceElement)protected org.eclipse.xtext.common.types.JvmIdentifiableElementgetLogicalContainer(org.eclipse.emf.ecore.EObject object, boolean considerContainer)org.eclipse.xtext.common.types.JvmIdentifiableElementgetLogicalContainer(XExpression context)protected java.util.Map<org.eclipse.emf.ecore.EObject,org.eclipse.xtext.common.types.JvmIdentifiableElement>getLogicalContainerMapping(org.eclipse.emf.ecore.resource.Resource resource)org.eclipse.xtext.common.types.JvmIdentifiableElementgetNearestLogicalContainer(org.eclipse.emf.ecore.EObject context)protected JvmModelAssociator.AdaptergetOrInstall(org.eclipse.emf.ecore.resource.Resource resource)org.eclipse.emf.ecore.EObjectgetPrimaryJvmElement(org.eclipse.emf.ecore.EObject sourceElement)org.eclipse.emf.ecore.EObjectgetPrimarySourceElement(org.eclipse.emf.ecore.EObject jvmElement)protected org.eclipse.emf.ecore.resource.ResourcegetResource(org.eclipse.emf.common.notify.Notifier ctx)java.util.Set<org.eclipse.emf.ecore.EObject>getSourceElements(org.eclipse.emf.ecore.EObject jvmElement)voidinstallDerivedState(org.eclipse.xtext.resource.DerivedStateAwareResource resource, boolean preIndexingPhase)booleanisPrimaryJvmElement(org.eclipse.emf.ecore.EObject jvmElement)static <K,V>
voidputIntoSmallSetMap(K key, V value, java.util.Map<? super K,java.util.Set<V>> map)static <K,V>
voidputIntoSmallSetMap(K key, V value, java.util.Map<? super K,java.util.Set<V>> map, boolean head)voidremoveAllAssociation(org.eclipse.emf.ecore.EObject jvmElement)Removes all associations for the given jvm element.voidremoveAssociation(org.eclipse.emf.ecore.EObject sourceElement, org.eclipse.emf.ecore.EObject jvmElement)Removes an association between the given source and jvm elements.voidremoveLogicalChildAssociation(org.eclipse.xtext.common.types.JvmIdentifiableElement container)Removes the logically contained child of the given identifiable.voidsetCompleter(JvmModelCompleter completer)voidsetInferrerProvider(com.google.inject.Provider<IJvmModelInferrer> inferrerProvider)protected java.util.Map<org.eclipse.emf.ecore.EObject,java.util.Set<org.eclipse.emf.ecore.EObject>>sourceToTargetMap(org.eclipse.emf.ecore.resource.Resource res)protected java.util.Map<org.eclipse.emf.ecore.EObject,java.util.Set<org.eclipse.emf.ecore.EObject>>targetToSourceMap(org.eclipse.emf.ecore.resource.Resource res)
-
-
-
Method Detail
-
setCompleter
public void setCompleter(JvmModelCompleter completer)
-
setInferrerProvider
public void setInferrerProvider(com.google.inject.Provider<IJvmModelInferrer> inferrerProvider)
- Since:
- 2.8
- Noreference:
- This method is not intended to be referenced by clients
-
getOrInstall
protected JvmModelAssociator.Adapter getOrInstall(org.eclipse.emf.ecore.resource.Resource resource)
-
getLogicalContainerMapping
protected java.util.Map<org.eclipse.emf.ecore.EObject,org.eclipse.xtext.common.types.JvmIdentifiableElement> getLogicalContainerMapping(org.eclipse.emf.ecore.resource.Resource resource)
-
getAssociatedExpression
public XExpression getAssociatedExpression(org.eclipse.xtext.common.types.JvmIdentifiableElement element)
- Specified by:
getAssociatedExpressionin interfaceILogicalContainerProvider- Returns:
- the XExpression associated with the given
JvmIdentifiableElement
-
getLogicalContainer
public org.eclipse.xtext.common.types.JvmIdentifiableElement getLogicalContainer(XExpression context)
- Specified by:
getLogicalContainerin interfaceILogicalContainerProvider- Returns:
- the JvmIdentifiableElement that directly contains the given expression and therefore
defines its scope.
nullif this expression doesn't have such a context.
-
getNearestLogicalContainer
public org.eclipse.xtext.common.types.JvmIdentifiableElement getNearestLogicalContainer(org.eclipse.emf.ecore.EObject context)
- Specified by:
getNearestLogicalContainerin interfaceILogicalContainerProvider- Returns:
- the JvmIdentifiableElement that contains the given expression or any of its containers
and therefore defines its scope.
nullif this expression doesn't live in such a context.
-
getLogicalContainer
protected org.eclipse.xtext.common.types.JvmIdentifiableElement getLogicalContainer(org.eclipse.emf.ecore.EObject object, boolean considerContainer)
-
associateLogicalContainer
public void associateLogicalContainer(XExpression logicalChild, org.eclipse.xtext.common.types.JvmIdentifiableElement element)
Description copied from interface:IJvmModelAssociatorSets the givenJvmIdentifiableElementas the logical container of the givenXExpression. The container must be an instanceofJvmExecutableorJvmField. The logical container is used to scope and link the given expression. Associating the logical container of an expression, automatically removes any previously logical containers for the given expression.- Specified by:
associateLogicalContainerin interfaceIJvmModelAssociator- Parameters:
logicalChild- the expression that is put into a scopeelement- a method, constructor or field that should act as the logical container of the given expression
-
removeLogicalChildAssociation
public void removeLogicalChildAssociation(org.eclipse.xtext.common.types.JvmIdentifiableElement container)
Description copied from interface:IJvmModelAssociatorRemoves the logically contained child of the given identifiable.- Specified by:
removeLogicalChildAssociationin interfaceIJvmModelAssociator
-
sourceToTargetMap
protected java.util.Map<org.eclipse.emf.ecore.EObject,java.util.Set<org.eclipse.emf.ecore.EObject>> sourceToTargetMap(org.eclipse.emf.ecore.resource.Resource res)
-
targetToSourceMap
protected java.util.Map<org.eclipse.emf.ecore.EObject,java.util.Set<org.eclipse.emf.ecore.EObject>> targetToSourceMap(org.eclipse.emf.ecore.resource.Resource res)
-
getResource
protected org.eclipse.emf.ecore.resource.Resource getResource(org.eclipse.emf.common.notify.Notifier ctx)
-
associate
public void associate(org.eclipse.emf.ecore.EObject sourceElement, org.eclipse.emf.ecore.EObject jvmElement)Description copied from interface:IJvmModelAssociatorAssociated the given source element with the given jvmElement.- Specified by:
associatein interfaceIJvmModelAssociator- Parameters:
sourceElement- the source EObjectjvmElement- the inferred EObject
-
checkLanguageResource
protected void checkLanguageResource(org.eclipse.emf.ecore.resource.Resource eResource)
-
checkSameResource
protected void checkSameResource(org.eclipse.emf.ecore.resource.Resource eResource, org.eclipse.emf.ecore.resource.Resource eResource2)
-
associatePrimary
public void associatePrimary(org.eclipse.emf.ecore.EObject sourceElement, org.eclipse.emf.ecore.EObject jvmElement)Description copied from interface:IJvmModelAssociatorAssociated the given source element with the given jvmElement and marks the association as primary on both sides.- Specified by:
associatePrimaryin interfaceIJvmModelAssociator- Parameters:
sourceElement- the source EObjectjvmElement- the inferred EObject
-
putIntoSmallSetMap
public static <K,V> void putIntoSmallSetMap(K key, V value, java.util.Map<? super K,java.util.Set<V>> map)
-
putIntoSmallSetMap
public static <K,V> void putIntoSmallSetMap(K key, V value, java.util.Map<? super K,java.util.Set<V>> map, boolean head)
-
getJvmElements
public java.util.Set<org.eclipse.emf.ecore.EObject> getJvmElements(org.eclipse.emf.ecore.EObject sourceElement)
- Specified by:
getJvmElementsin interfaceIJvmModelAssociations- Returns:
- all JVM elements associated with the given source element.
-
getSourceElements
public java.util.Set<org.eclipse.emf.ecore.EObject> getSourceElements(org.eclipse.emf.ecore.EObject jvmElement)
- Specified by:
getSourceElementsin interfaceIJvmModelAssociations- Returns:
- all source elements associated with the given JVM element.
-
getPrimarySourceElement
public org.eclipse.emf.ecore.EObject getPrimarySourceElement(org.eclipse.emf.ecore.EObject jvmElement)
- Specified by:
getPrimarySourceElementin interfaceIJvmModelAssociations- Returns:
- the primary source element for the given JVM element.
-
installDerivedState
public void installDerivedState(org.eclipse.xtext.resource.DerivedStateAwareResource resource, boolean preIndexingPhase)- Specified by:
installDerivedStatein interfaceorg.eclipse.xtext.resource.IDerivedStateComputer
-
discardDerivedState
public void discardDerivedState(org.eclipse.xtext.resource.DerivedStateAwareResource resource)
- Specified by:
discardDerivedStatein interfaceorg.eclipse.xtext.resource.IDerivedStateComputer
-
cleanAssociationState
public void cleanAssociationState(org.eclipse.emf.ecore.resource.Resource resource)
-
removeAssociation
public void removeAssociation(org.eclipse.emf.ecore.EObject sourceElement, org.eclipse.emf.ecore.EObject jvmElement)Description copied from interface:IJvmModelAssociatorRemoves an association between the given source and jvm elements.- Specified by:
removeAssociationin interfaceIJvmModelAssociator
-
removeAllAssociation
public void removeAllAssociation(org.eclipse.emf.ecore.EObject jvmElement)
Description copied from interface:IJvmModelAssociatorRemoves all associations for the given jvm element.- Specified by:
removeAllAssociationin interfaceIJvmModelAssociator
-
getPrimaryJvmElement
public org.eclipse.emf.ecore.EObject getPrimaryJvmElement(org.eclipse.emf.ecore.EObject sourceElement)
- Specified by:
getPrimaryJvmElementin interfaceIJvmModelAssociations- Returns:
- the primary JVM element for the given source element.
-
isPrimaryJvmElement
public boolean isPrimaryJvmElement(org.eclipse.emf.ecore.EObject jvmElement)
- Specified by:
isPrimaryJvmElementin interfaceIJvmModelAssociations- Returns:
- whether the given JVM element is a primary JVM element.
-
-