Class DependentModelProvider

java.lang.Object
com._1c.g5.v8.dt.bm.internal.xtext.DependentModelProvider
All Implemented Interfaces:
IDependentModelProvider

public class DependentModelProvider extends Object implements IDependentModelProvider
The default implementation of the service that holds dependent model loaded onto parent object in EMF adapter list. So when the text feature in the parent object has changed - the link between two models will be removed and depended model resource will be unloaded. Implementation uses same file extension to load resource, but generates new file name using base path, because parent model might have multiple containing object with text for dependent models and they might be loaded on the same time.
This implementation is thread-safe.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    <T extends org.eclipse.emf.ecore.EObject>
    T
    getDependentModel(org.eclipse.emf.ecore.EObject source, org.eclipse.emf.ecore.EStructuralFeature textFeature, org.eclipse.core.runtime.IPath basePath, BiFunction<org.eclipse.emf.ecore.EObject,org.eclipse.emf.ecore.EStructuralFeature,String> textProvider, org.eclipse.xtext.util.CancelIndicator cancelIndicator)
    Gets the dependent model by the source object and it's text feature provided.
    <T extends org.eclipse.emf.ecore.EObject>
    T
    getDependentModel(org.eclipse.emf.ecore.EObject source, org.eclipse.emf.ecore.EStructuralFeature textFeature, org.eclipse.core.runtime.IPath basePath, org.eclipse.xtext.util.CancelIndicator cancelIndicator)
    Gets the dependent model by the source object and it's text feature.
    org.eclipse.emf.ecore.EObject
    getParent(org.eclipse.emf.ecore.EObject dependent)
    Gets the parent object of the dependent model object.
    org.eclipse.emf.ecore.EStructuralFeature
    getParentFeature(org.eclipse.emf.ecore.EObject dependent)
    Gets the parent containing text feature of the dependent model object.
    void
    unload(org.eclipse.emf.ecore.EObject root)
    Explicitly unload dependent model object from resource and remove linkage to the parent object.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • DependentModelProvider

      public DependentModelProvider()
  • Method Details

    • getDependentModel

      public <T extends org.eclipse.emf.ecore.EObject> T getDependentModel(org.eclipse.emf.ecore.EObject source, org.eclipse.emf.ecore.EStructuralFeature textFeature, org.eclipse.core.runtime.IPath basePath, org.eclipse.xtext.util.CancelIndicator cancelIndicator)
      Description copied from interface: IDependentModelProvider
      Gets the dependent model by the source object and it's text feature.
      Specified by:
      getDependentModel in interface IDependentModelProvider
      Type Parameters:
      T - the generic type of dependent model root object
      Parameters:
      source - the source object, cannot be null.
      textFeature - the text feature of the source object, cannot be null.
      basePath - the base project relative path with file extension of dependent resource, cannot be null.
      cancelIndicator - the cancel indicator, cannot be null.
      Returns:
      the dependent model, may return null if cannot load .
    • getDependentModel

      public <T extends org.eclipse.emf.ecore.EObject> T getDependentModel(org.eclipse.emf.ecore.EObject source, org.eclipse.emf.ecore.EStructuralFeature textFeature, org.eclipse.core.runtime.IPath basePath, BiFunction<org.eclipse.emf.ecore.EObject,org.eclipse.emf.ecore.EStructuralFeature,String> textProvider, org.eclipse.xtext.util.CancelIndicator cancelIndicator)
      Description copied from interface: IDependentModelProvider
      Gets the dependent model by the source object and it's text feature provided.
      Specified by:
      getDependentModel in interface IDependentModelProvider
      Type Parameters:
      T - the generic type of dependent model root object
      Parameters:
      source - the source object, cannot be null.
      textFeature - the text feature of the source object, cannot be null.
      basePath - the base project relative path with file extension of dependent resource, cannot be null.
      textProvider - the text provider of the dependent model, cannot be null.
      cancelIndicator - the cancel indicator, cannot be null.
      Returns:
      the dependent model, may be null.
    • getParent

      public org.eclipse.emf.ecore.EObject getParent(org.eclipse.emf.ecore.EObject dependent)
      Description copied from interface: IDependentModelProvider
      Gets the parent object of the dependent model object.
      Specified by:
      getParent in interface IDependentModelProvider
      Parameters:
      dependent - the dependent model object, cannot be null.
      Returns:
      the parent object of dependent model, may return null if the model is not linked to it's parent.
    • getParentFeature

      public org.eclipse.emf.ecore.EStructuralFeature getParentFeature(org.eclipse.emf.ecore.EObject dependent)
      Description copied from interface: IDependentModelProvider
      Gets the parent containing text feature of the dependent model object.
      Specified by:
      getParentFeature in interface IDependentModelProvider
      Parameters:
      dependent - the dependent model object, cannot be null.
      Returns:
      the parent text feature, may return null if the model is not linked to it's parent.
    • unload

      public void unload(org.eclipse.emf.ecore.EObject root)
      Description copied from interface: IDependentModelProvider
      Explicitly unload dependent model object from resource and remove linkage to the parent object.
      Specified by:
      unload in interface IDependentModelProvider
      Parameters:
      root - the root of dependent model, cannot be null.