org.eclipse.ocl.examples.xtext.base.cs2as
Class CS2Pivot

java.lang.Object
  extended by org.eclipse.ocl.examples.pivot.utilities.AbstractConversion
      extended by org.eclipse.ocl.examples.xtext.base.cs2as.CS2Pivot
All Implemented Interfaces:
org.eclipse.emf.common.notify.Adapter, org.eclipse.emf.common.notify.Adapter.Internal, MetaModelManagedAdapter, MetaModelManagerListener
Direct Known Subclasses:
BaseCS2Pivot

public abstract class CS2Pivot
extends AbstractConversion
implements MetaModelManagedAdapter

CS2Pivot manages the equivalence between a Concrete Syntax Resources and their corresponding Pivot Resources creating a CS2PivotConversion to update.


Nested Class Summary
static class CS2Pivot.AbstractUnresolvedProxyMessageProvider
           
static class CS2Pivot.DefaultMessageBinder
          Default message binder that just invokes NLS.bind(String, Object[]).
static interface CS2Pivot.MessageBinder
          Interface for an optional message binder that may be used to affix additional context for standalone and command line applications.
static class CS2Pivot.MessageBinderWithLineContext
          Message binder that prefixes the uri and line number to the return from NLS.bind(String, Object[]).
static interface CS2Pivot.UnresolvedProxyMessageProvider
           
 
Nested classes/interfaces inherited from class org.eclipse.ocl.examples.pivot.utilities.AbstractConversion
AbstractConversion.Predicate<T extends org.eclipse.emf.ecore.EObject>
 
Nested classes/interfaces inherited from interface org.eclipse.emf.common.notify.Adapter
org.eclipse.emf.common.notify.Adapter.Internal
 
Field Summary
protected  CSI2PivotMapping cs2PivotMapping
          CS to Pivot mapping controller for aliases and CSIs.
protected  java.util.Set<? extends BaseCSResource> csResources
          The CS resource mapped by this CS2Pivot.
static boolean showContext
          Whether to show file and line number context at the start of messages.
 
Fields inherited from class org.eclipse.ocl.examples.pivot.utilities.AbstractConversion
metaModelManager
 
Constructor Summary
protected CS2Pivot(CS2Pivot aConverter)
           
  CS2Pivot(java.util.Map<? extends BaseCSResource,? extends ASResource> cs2asResourceMap, MetaModelManager metaModelManager)
           
 
Method Summary
static void addUnresolvedProxyMessageProvider(CS2Pivot.UnresolvedProxyMessageProvider unresolvedProxyMessageProvider)
           
static Element basicGetType(TypedTypeRefCS csTypedRef)
           
 java.lang.String bind(org.eclipse.emf.ecore.EObject csContext, java.lang.String messageTemplate, java.lang.Object... bindings)
           
static org.eclipse.emf.common.util.EList<org.eclipse.emf.ecore.EObject> computeRootContainmentFeatures(RootCS csRoot)
          Return the containment features ordered so that library and import features are processed before anything else.
protected abstract  BaseCSVisitor<Continuation<?>> createContainmentVisitor(CS2PivotConversion cs2PivotConversion)
           
protected  CS2PivotConversion createConversion(org.eclipse.xtext.diagnostics.IDiagnosticConsumer diagnosticsConsumer, java.util.Collection<? extends BaseCSResource> csResources)
           
protected abstract  BaseCSVisitor<Element> createLeft2RightVisitor(CS2PivotConversion cs2PivotConversion)
           
protected abstract  BaseCSVisitor<Continuation<?>> createPostOrderVisitor(CS2PivotConversion converter)
           
protected abstract  BaseCSVisitor<Continuation<?>> createPreOrderVisitor(CS2PivotConversion converter)
           
 void dispose()
           
static CS2Pivot findAdapter(org.eclipse.emf.ecore.resource.ResourceSet resourceSet)
           
 ModelElementCS getCSElement(Element pivotElement)
           
 java.util.Collection<? extends BaseCSResource> getCSResources()
           
static java.util.List<org.eclipse.xtext.nodemodel.ILeafNode> getDocumentationNodes(org.eclipse.xtext.nodemodel.ICompositeNode node)
           
static CS2Pivot.MessageBinder getMessageBinder()
           
<T extends Element>
T
getPivotElement(java.lang.Class<T> pivotClass, ModelElementCS csElement)
           
 Element getPivotElement(ModelElementCS csElement)
           
 ASResource getPivotResource(BaseCSResource csResource)
           
 java.util.Collection<? extends org.eclipse.emf.ecore.resource.Resource> getPivotResources()
           
 org.eclipse.emf.common.notify.Notifier getTarget()
           
static org.eclipse.xtext.diagnostics.DiagnosticMessage getUnresolvedProxyMessage(org.eclipse.emf.ecore.EReference eReference, org.eclipse.emf.ecore.EObject csContext, java.lang.String linkText)
           
static java.lang.String getUnresolvedProxyText(org.eclipse.emf.ecore.EReference eReference, org.eclipse.emf.ecore.EObject csContext, java.lang.String linkText)
           
 void installPivotDefinition(ModelElementCS csElement, Element newPivotElement)
          Install the mapping from a CS element that defines a pivot element to the defined pivot element.
 void installPivotReference(ElementRefCS csElement, Element newPivotElement, org.eclipse.emf.ecore.EReference eReference)
          Install the mapping from a CS element to a completely independent pivot element.
 void installPivotUsage(ModelElementCS csElement, Element newPivotElement)
          Install the mapping from a CS element to a related pivot element.
 boolean isAdapterFor(MetaModelManager metaModelManager)
           
 boolean isAdapterForType(java.lang.Object type)
           
 void metaModelManagerDisposed(MetaModelManager metaModelManager)
          Respond to disposal of the MetaModelManager by eliminating all further usage.
 void notifyChanged(org.eclipse.emf.common.notify.Notification notification)
           
static void printDiagnostic(java.lang.String message, boolean dispose, int indent)
           
<T extends Element>
T
refreshModelElement(java.lang.Class<T> pivotClass, org.eclipse.emf.ecore.EClass pivotEClass, ModelElementCS csElement)
           
static void setElementType(PathNameCS pathNameCS, org.eclipse.emf.ecore.EClass elementType, ElementCS csContext, ScopeFilter scopeFilter)
           
static CS2Pivot.MessageBinder setMessageBinder(CS2Pivot.MessageBinder messageBinder)
          Define an alternative message binder.
 void setTarget(org.eclipse.emf.common.notify.Notifier newTarget)
           
 void unsetTarget(org.eclipse.emf.common.notify.Notifier oldTarget)
           
 void update(org.eclipse.xtext.diagnostics.IDiagnosticConsumer diagnosticsConsumer)
           
 
Methods inherited from class org.eclipse.ocl.examples.pivot.utilities.AbstractConversion
basicGet, getEPackage, getMetaModelManager, isId, refreshList, refreshSet
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

showContext

public static boolean showContext
Whether to show file and line number context at the start of messages.


csResources

@NonNull
protected final java.util.Set<? extends BaseCSResource> csResources
The CS resource mapped by this CS2Pivot.


cs2PivotMapping

@NonNull
protected final CSI2PivotMapping cs2PivotMapping
CS to Pivot mapping controller for aliases and CSIs.

Constructor Detail

CS2Pivot

public CS2Pivot(@NonNull
                java.util.Map<? extends BaseCSResource,? extends ASResource> cs2asResourceMap,
                @NonNull
                MetaModelManager metaModelManager)

CS2Pivot

protected CS2Pivot(@NonNull
                   CS2Pivot aConverter)
Method Detail

computeRootContainmentFeatures

public static org.eclipse.emf.common.util.EList<org.eclipse.emf.ecore.EObject> computeRootContainmentFeatures(RootCS csRoot)
Return the containment features ordered so that library and import features are processed before anything else.


addUnresolvedProxyMessageProvider

public static void addUnresolvedProxyMessageProvider(CS2Pivot.UnresolvedProxyMessageProvider unresolvedProxyMessageProvider)

basicGetType

public static Element basicGetType(TypedTypeRefCS csTypedRef)

getUnresolvedProxyMessage

@Nullable
public static org.eclipse.xtext.diagnostics.DiagnosticMessage getUnresolvedProxyMessage(@NonNull
                                                                                                 org.eclipse.emf.ecore.EReference eReference,
                                                                                                 @NonNull
                                                                                                 org.eclipse.emf.ecore.EObject csContext,
                                                                                                 @NonNull
                                                                                                 java.lang.String linkText)

getUnresolvedProxyText

@Nullable
public static java.lang.String getUnresolvedProxyText(@NonNull
                                                               org.eclipse.emf.ecore.EReference eReference,
                                                               @NonNull
                                                               org.eclipse.emf.ecore.EObject csContext,
                                                               @NonNull
                                                               java.lang.String linkText)

findAdapter

@Nullable
public static CS2Pivot findAdapter(@NonNull
                                            org.eclipse.emf.ecore.resource.ResourceSet resourceSet)

getDocumentationNodes

public static java.util.List<org.eclipse.xtext.nodemodel.ILeafNode> getDocumentationNodes(@NonNull
                                                                                          org.eclipse.xtext.nodemodel.ICompositeNode node)

getMessageBinder

public static CS2Pivot.MessageBinder getMessageBinder()

printDiagnostic

public static void printDiagnostic(@NonNull
                                   java.lang.String message,
                                   boolean dispose,
                                   int indent)

setElementType

public static void setElementType(@NonNull
                                  PathNameCS pathNameCS,
                                  org.eclipse.emf.ecore.EClass elementType,
                                  @NonNull
                                  ElementCS csContext,
                                  @Nullable
                                  ScopeFilter scopeFilter)

setMessageBinder

public static CS2Pivot.MessageBinder setMessageBinder(CS2Pivot.MessageBinder messageBinder)
Define an alternative message binder. THe default null messageBinder uses NLS.bind(String, Object[])


bind

@NonNull
public java.lang.String bind(@NonNull
                                     org.eclipse.emf.ecore.EObject csContext,
                                     java.lang.String messageTemplate,
                                     java.lang.Object... bindings)

createContainmentVisitor

@NonNull
protected abstract BaseCSVisitor<Continuation<?>> createContainmentVisitor(@NonNull
                                                                                   CS2PivotConversion cs2PivotConversion)

createConversion

@NonNull
protected CS2PivotConversion createConversion(@NonNull
                                                      org.eclipse.xtext.diagnostics.IDiagnosticConsumer diagnosticsConsumer,
                                                      @NonNull
                                                      java.util.Collection<? extends BaseCSResource> csResources)

createLeft2RightVisitor

@NonNull
protected abstract BaseCSVisitor<Element> createLeft2RightVisitor(@NonNull
                                                                          CS2PivotConversion cs2PivotConversion)

createPostOrderVisitor

@NonNull
protected abstract BaseCSVisitor<Continuation<?>> createPostOrderVisitor(@NonNull
                                                                                 CS2PivotConversion converter)

createPreOrderVisitor

@NonNull
protected abstract BaseCSVisitor<Continuation<?>> createPreOrderVisitor(@NonNull
                                                                                CS2PivotConversion converter)

dispose

public void dispose()

getCSElement

@Nullable
public ModelElementCS getCSElement(@NonNull
                                            Element pivotElement)

getCSResources

@NonNull
public java.util.Collection<? extends BaseCSResource> getCSResources()

getPivotElement

public Element getPivotElement(@NonNull
                               ModelElementCS csElement)

getPivotElement

@Nullable
public <T extends Element> T getPivotElement(@NonNull
                                                      java.lang.Class<T> pivotClass,
                                                      @NonNull
                                                      ModelElementCS csElement)

getPivotResource

public ASResource getPivotResource(@NonNull
                                   BaseCSResource csResource)

getPivotResources

public java.util.Collection<? extends org.eclipse.emf.ecore.resource.Resource> getPivotResources()

getTarget

public org.eclipse.emf.common.notify.Notifier getTarget()
Specified by:
getTarget in interface org.eclipse.emf.common.notify.Adapter

installPivotDefinition

public void installPivotDefinition(@NonNull
                                   ModelElementCS csElement,
                                   @NonNull
                                   Element newPivotElement)
Install the mapping from a CS element that defines a pivot element to the defined pivot element. The definition is 'owned' by the CS element, so if the CS element vanishes, so does the pivot element.


installPivotReference

public void installPivotReference(@NonNull
                                  ElementRefCS csElement,
                                  @NonNull
                                  Element newPivotElement,
                                  @NonNull
                                  org.eclipse.emf.ecore.EReference eReference)
Install the mapping from a CS element to a completely independent pivot element. If the pivot element vanishes, the reference is stale, if the CS element the pivot element is less referenced.


installPivotUsage

public void installPivotUsage(@NonNull
                              ModelElementCS csElement,
                              @NonNull
                              Element newPivotElement)
Install the mapping from a CS element to a related pivot element. This normally arises when more than one CS element are associated with a single pivot element. In this case one of the CS elements is the defining CS element and the others are users.


isAdapterForType

public boolean isAdapterForType(java.lang.Object type)
Specified by:
isAdapterForType in interface org.eclipse.emf.common.notify.Adapter

isAdapterFor

public boolean isAdapterFor(@NonNull
                            MetaModelManager metaModelManager)
Specified by:
isAdapterFor in interface MetaModelManagedAdapter

metaModelManagerDisposed

public void metaModelManagerDisposed(@NonNull
                                     MetaModelManager metaModelManager)
Description copied from interface: MetaModelManagerListener
Respond to disposal of the MetaModelManager by eliminating all further usage.

Specified by:
metaModelManagerDisposed in interface MetaModelManagerListener

notifyChanged

public void notifyChanged(org.eclipse.emf.common.notify.Notification notification)
Specified by:
notifyChanged in interface org.eclipse.emf.common.notify.Adapter

refreshModelElement

@NonNull
public <T extends Element> T refreshModelElement(@NonNull
                                                         java.lang.Class<T> pivotClass,
                                                         @NonNull
                                                         org.eclipse.emf.ecore.EClass pivotEClass,
                                                         @Nullable
                                                         ModelElementCS csElement)

setTarget

public void setTarget(org.eclipse.emf.common.notify.Notifier newTarget)
Specified by:
setTarget in interface org.eclipse.emf.common.notify.Adapter

unsetTarget

public void unsetTarget(org.eclipse.emf.common.notify.Notifier oldTarget)
Specified by:
unsetTarget in interface org.eclipse.emf.common.notify.Adapter.Internal

update

public void update(@NonNull
                   org.eclipse.xtext.diagnostics.IDiagnosticConsumer diagnosticsConsumer)