org.eclipse.xtext.xbase.jvmmodel
Class JvmModelAssociator

java.lang.Object
  extended by org.eclipse.xtext.xbase.jvmmodel.JvmModelAssociator
All Implemented Interfaces:
IDerivedStateComputer, IJvmModelAssociations, IJvmModelAssociator, ILogicalContainerProvider
Direct Known Subclasses:
IXtendJvmAssociations.Impl

public class JvmModelAssociator
extends java.lang.Object
implements IJvmModelAssociations, IJvmModelAssociator, ILogicalContainerProvider, IDerivedStateComputer

Author:
Jan Koehnlein - Initial contribution and API, Sven Efftinge

Nested Class Summary
protected static class JvmModelAssociator.Adapter
           
static class JvmModelAssociator.JvmDeclaredTypeAcceptor
           
 
Constructor Summary
JvmModelAssociator()
           
 
Method Summary
 void associate(org.eclipse.emf.ecore.EObject sourceElement, org.eclipse.emf.ecore.EObject jvmElement)
           
 void associateLogicalContainer(org.eclipse.emf.ecore.EObject logicalChild, JvmIdentifiableElement element)
           
 void associatePrimary(org.eclipse.emf.ecore.EObject sourceElement, org.eclipse.emf.ecore.EObject jvmElement)
           
 void cleanAssociationState(org.eclipse.emf.ecore.resource.Resource resource)
           
 void discardDerivedState(DerivedStateAwareResource resource)
          is called when the resource is updated.
 XExpression getAssociatedExpression(JvmIdentifiableElement element)
           
 java.util.Set<org.eclipse.emf.ecore.EObject> getJvmElements(org.eclipse.emf.ecore.EObject sourceElement)
           
 JvmIdentifiableElement getLogicalContainer(org.eclipse.emf.ecore.EObject object)
           
protected  java.util.Map<org.eclipse.emf.ecore.EObject,JvmIdentifiableElement> getLogicalContainerMapping(org.eclipse.emf.ecore.resource.Resource resource)
           
 JvmIdentifiableElement getNearestLogicalContainer(org.eclipse.emf.ecore.EObject context)
           
protected  JvmModelAssociator.Adapter getOrInstall(org.eclipse.emf.ecore.resource.Resource resource)
           
 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(DerivedStateAwareResource resource, boolean preIndexingPhase)
          callback to do modifications when and before getContents is called the first time on a resource.
 void removeLogicalChildAssociation(JvmIdentifiableElement container)
           
 void setCompleter(JvmModelCompleter completer)
           
 void setInferrer(IJvmModelInferrer inferrer)
           
protected  com.google.common.collect.ListMultimap<org.eclipse.emf.ecore.EObject,org.eclipse.emf.ecore.EObject> sourceToTargetMap(org.eclipse.emf.ecore.resource.Resource res)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JvmModelAssociator

public JvmModelAssociator()
Method Detail

setCompleter

public void setCompleter(JvmModelCompleter completer)

setInferrer

public void setInferrer(IJvmModelInferrer inferrer)

getOrInstall

protected JvmModelAssociator.Adapter getOrInstall(org.eclipse.emf.ecore.resource.Resource resource)

getLogicalContainerMapping

protected java.util.Map<org.eclipse.emf.ecore.EObject,JvmIdentifiableElement> getLogicalContainerMapping(org.eclipse.emf.ecore.resource.Resource resource)

getAssociatedExpression

public XExpression getAssociatedExpression(JvmIdentifiableElement element)
Specified by:
getAssociatedExpression in interface ILogicalContainerProvider
Returns:
the XExpression associated with the given JvmIdentifiableElement

getLogicalContainer

public JvmIdentifiableElement getLogicalContainer(org.eclipse.emf.ecore.EObject object)
Specified by:
getLogicalContainer in interface ILogicalContainerProvider
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 JvmIdentifiableElement getNearestLogicalContainer(org.eclipse.emf.ecore.EObject context)
Specified by:
getNearestLogicalContainer in interface ILogicalContainerProvider
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.

associateLogicalContainer

public void associateLogicalContainer(org.eclipse.emf.ecore.EObject logicalChild,
                                      JvmIdentifiableElement element)
Specified by:
associateLogicalContainer in interface IJvmModelAssociator

removeLogicalChildAssociation

public void removeLogicalChildAssociation(JvmIdentifiableElement container)
Specified by:
removeLogicalChildAssociation in interface IJvmModelAssociator

sourceToTargetMap

protected com.google.common.collect.ListMultimap<org.eclipse.emf.ecore.EObject,org.eclipse.emf.ecore.EObject> sourceToTargetMap(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)
Specified by:
associate in interface IJvmModelAssociator

associatePrimary

public void associatePrimary(org.eclipse.emf.ecore.EObject sourceElement,
                             org.eclipse.emf.ecore.EObject jvmElement)
Specified by:
associatePrimary in interface IJvmModelAssociator

getJvmElements

public java.util.Set<org.eclipse.emf.ecore.EObject> getJvmElements(org.eclipse.emf.ecore.EObject sourceElement)
Specified by:
getJvmElements in interface IJvmModelAssociations

getSourceElements

public java.util.Set<org.eclipse.emf.ecore.EObject> getSourceElements(org.eclipse.emf.ecore.EObject jvmElement)
Specified by:
getSourceElements in interface IJvmModelAssociations

getPrimarySourceElement

public org.eclipse.emf.ecore.EObject getPrimarySourceElement(org.eclipse.emf.ecore.EObject jvmElement)
Specified by:
getPrimarySourceElement in interface IJvmModelAssociations

installDerivedState

public void installDerivedState(DerivedStateAwareResource resource,
                                boolean preIndexingPhase)
Description copied from interface: IDerivedStateComputer
callback to do modifications when and before getContents is called the first time on a resource.

Specified by:
installDerivedState in interface IDerivedStateComputer
Parameters:
resource - the resource to install derived state on
preIndexingPhase - whether the call is done in a pre-linking phase. During this phase clients may not do linking which relies on indexed information, because the index might not be fully computed yet.

discardDerivedState

public void discardDerivedState(DerivedStateAwareResource resource)
Description copied from interface: IDerivedStateComputer
is called when the resource is updated. Clients should revert all the changes they did during IDerivedStateComputer.installDerivedState(DerivedStateAwareResource, boolean)

Specified by:
discardDerivedState in interface IDerivedStateComputer

cleanAssociationState

public void cleanAssociationState(org.eclipse.emf.ecore.resource.Resource resource)