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 class
JvmModelAssociator.Adapter
static class
JvmModelAssociator.JvmDeclaredTypeAcceptor
protected static class
JvmModelAssociator.ListBasedSet<E>
-
Constructor Summary
Constructors Constructor Description JvmModelAssociator()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
associate(org.eclipse.emf.ecore.EObject sourceElement, org.eclipse.emf.ecore.EObject jvmElement)
Associated the given source element with the given jvmElement.void
associateLogicalContainer(XExpression logicalChild, org.eclipse.xtext.common.types.JvmIdentifiableElement element)
Sets the givenJvmIdentifiableElement
as the logical container of the givenXExpression
.void
associatePrimary(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 void
checkLanguageResource(org.eclipse.emf.ecore.resource.Resource eResource)
protected void
checkSameResource(org.eclipse.emf.ecore.resource.Resource eResource, org.eclipse.emf.ecore.resource.Resource eResource2)
void
cleanAssociationState(org.eclipse.emf.ecore.resource.Resource resource)
void
discardDerivedState(org.eclipse.xtext.resource.DerivedStateAwareResource resource)
XExpression
getAssociatedExpression(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.JvmIdentifiableElement
getLogicalContainer(org.eclipse.emf.ecore.EObject object, boolean considerContainer)
org.eclipse.xtext.common.types.JvmIdentifiableElement
getLogicalContainer(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.JvmIdentifiableElement
getNearestLogicalContainer(org.eclipse.emf.ecore.EObject context)
protected JvmModelAssociator.Adapter
getOrInstall(org.eclipse.emf.ecore.resource.Resource resource)
org.eclipse.emf.ecore.EObject
getPrimaryJvmElement(org.eclipse.emf.ecore.EObject sourceElement)
org.eclipse.emf.ecore.EObject
getPrimarySourceElement(org.eclipse.emf.ecore.EObject jvmElement)
protected org.eclipse.emf.ecore.resource.Resource
getResource(org.eclipse.emf.common.notify.Notifier ctx)
java.util.Set<org.eclipse.emf.ecore.EObject>
getSourceElements(org.eclipse.emf.ecore.EObject jvmElement)
void
installDerivedState(org.eclipse.xtext.resource.DerivedStateAwareResource resource, boolean preIndexingPhase)
boolean
isPrimaryJvmElement(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)
void
removeAllAssociation(org.eclipse.emf.ecore.EObject jvmElement)
Removes all associations for the given jvm element.void
removeAssociation(org.eclipse.emf.ecore.EObject sourceElement, org.eclipse.emf.ecore.EObject jvmElement)
Removes an association between the given source and jvm elements.void
removeLogicalChildAssociation(org.eclipse.xtext.common.types.JvmIdentifiableElement container)
Removes the logically contained child of the given identifiable.void
setCompleter(JvmModelCompleter completer)
void
setInferrerProvider(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:
getAssociatedExpression
in interfaceILogicalContainerProvider
- Returns:
- the XExpression associated with the given
JvmIdentifiableElement
-
getLogicalContainer
public org.eclipse.xtext.common.types.JvmIdentifiableElement getLogicalContainer(XExpression context)
- Specified by:
getLogicalContainer
in interfaceILogicalContainerProvider
- Returns:
- the JvmIdentifiableElement that directly contains the given expression and therefore
defines its scope.
null
if 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:
getNearestLogicalContainer
in interfaceILogicalContainerProvider
- Returns:
- the JvmIdentifiableElement that contains the given expression or any of its containers
and therefore defines its scope.
null
if 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:IJvmModelAssociator
Sets the givenJvmIdentifiableElement
as the logical container of the givenXExpression
. The container must be an instanceofJvmExecutable
orJvmField
. 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:
associateLogicalContainer
in 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:IJvmModelAssociator
Removes the logically contained child of the given identifiable.- Specified by:
removeLogicalChildAssociation
in 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:IJvmModelAssociator
Associated the given source element with the given jvmElement.- Specified by:
associate
in 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:IJvmModelAssociator
Associated the given source element with the given jvmElement and marks the association as primary on both sides.- Specified by:
associatePrimary
in 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:
getJvmElements
in 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:
getSourceElements
in 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:
getPrimarySourceElement
in 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:
installDerivedState
in interfaceorg.eclipse.xtext.resource.IDerivedStateComputer
-
discardDerivedState
public void discardDerivedState(org.eclipse.xtext.resource.DerivedStateAwareResource resource)
- Specified by:
discardDerivedState
in 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:IJvmModelAssociator
Removes an association between the given source and jvm elements.- Specified by:
removeAssociation
in interfaceIJvmModelAssociator
-
removeAllAssociation
public void removeAllAssociation(org.eclipse.emf.ecore.EObject jvmElement)
Description copied from interface:IJvmModelAssociator
Removes all associations for the given jvm element.- Specified by:
removeAllAssociation
in interfaceIJvmModelAssociator
-
getPrimaryJvmElement
public org.eclipse.emf.ecore.EObject getPrimaryJvmElement(org.eclipse.emf.ecore.EObject sourceElement)
- Specified by:
getPrimaryJvmElement
in interfaceIJvmModelAssociations
- Returns:
- the primary JVM element for the given source element.
-
isPrimaryJvmElement
public boolean isPrimaryJvmElement(org.eclipse.emf.ecore.EObject jvmElement)
- Specified by:
isPrimaryJvmElement
in interfaceIJvmModelAssociations
- Returns:
- whether the given JVM element is a primary JVM element.
-
-