Class DependentModelProvider
java.lang.Object
com._1c.g5.v8.dt.bm.internal.xtext.DependentModelProvider
- All Implemented Interfaces:
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.
This implementation is thread-safe.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T extends org.eclipse.emf.ecore.EObject>
TgetDependentModel
(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>
TgetDependentModel
(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.
-
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 interfaceIDependentModelProvider
- Type Parameters:
T
- the generic type of dependent model root object- Parameters:
source
- the source object, cannot benull
.textFeature
- the text feature of the source object, cannot benull
.basePath
- the base project relative path with file extension of dependent resource, cannot benull
.cancelIndicator
- the cancel indicator, cannot benull
.- 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 interfaceIDependentModelProvider
- Type Parameters:
T
- the generic type of dependent model root object- Parameters:
source
- the source object, cannot benull
.textFeature
- the text feature of the source object, cannot benull
.basePath
- the base project relative path with file extension of dependent resource, cannot benull
.textProvider
- the text provider of the dependent model, cannot benull
.cancelIndicator
- the cancel indicator, cannot benull
.- 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 interfaceIDependentModelProvider
- Parameters:
dependent
- the dependent model object, cannot benull
.- 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 interfaceIDependentModelProvider
- Parameters:
dependent
- the dependent model object, cannot benull
.- 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 interfaceIDependentModelProvider
- Parameters:
root
- the root of dependent model, cannot benull
.
-