Class ViewModelContextFactory
- java.lang.Object
-
- org.eclipse.emf.ecp.view.spi.context.ViewModelContextFactory
-
public final class ViewModelContextFactory extends java.lang.ObjectThis Factory can be used to instantiateViewModelContexts.- Since:
- 1.2
- Author:
- Eugen Neufeld
-
-
Field Summary
Fields Modifier and Type Field Description static ViewModelContextFactoryINSTANCEThe singleton instance of the factory.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ViewModelContextcreateViewModelContext(VElement view, org.eclipse.emf.ecore.EObject domainObject)Instantiates a new view model context.ViewModelContextcreateViewModelContext(VElement view, org.eclipse.emf.ecore.EObject domainObject, java.util.Map<java.lang.String,?> contextValues)Instantiates a new view model context with initial context values.ViewModelContextcreateViewModelContext(VElement view, org.eclipse.emf.ecore.EObject domainObject, ViewModelService... modelServices)Instantiates a new view model context with specific services.ViewModelContextcreateViewModelContext(VElement view, org.eclipse.emf.ecore.EObject domainObject, ViewModelServiceProvider serviceProvider)Instantiates a new view model context with a provider of local service overrides.ViewModelContextcreateViewModelContext(VElement view, org.eclipse.emf.ecore.EObject domainObject, ViewModelServiceProvider serviceProvider, java.util.Map<java.lang.String,?> contextValues)Instantiates a new view model context with a provider of local service overrides and initial context values.static ViewModelServiceProviderprovide(ViewModelService... modelServices)Obtain a view-model service provider that statically provides a set of services.
-
-
-
Field Detail
-
INSTANCE
public static final ViewModelContextFactory INSTANCE
The singleton instance of the factory.
-
-
Method Detail
-
createViewModelContext
public ViewModelContext createViewModelContext(VElement view, org.eclipse.emf.ecore.EObject domainObject)
Instantiates a new view model context.- Parameters:
view- the viewdomainObject- the domain object- Returns:
- the created
ViewModelContext
-
createViewModelContext
public ViewModelContext createViewModelContext(VElement view, org.eclipse.emf.ecore.EObject domainObject, ViewModelService... modelServices)
Instantiates a new view model context with specific services. Note that this is useful for services that are not registered externally (via extension point or OSGi). If any of these services locally override registered implementations of the same interface, then it is better to use aViewModelServiceProviderthat can propagate the override to child contexts.- Parameters:
view- the viewdomainObject- the domain objectmodelServices- an array of services to use in theViewModelContext- Returns:
- the created
ViewModelContext - See Also:
createViewModelContext(VElement, EObject, ViewModelServiceProvider),ViewModelContext.getChildContext(EObject, VElement, org.eclipse.emf.ecp.view.spi.model.VView, ViewModelService...)
-
createViewModelContext
public ViewModelContext createViewModelContext(VElement view, org.eclipse.emf.ecore.EObject domainObject, ViewModelServiceProvider serviceProvider)
Instantiates a new view model context with a provider of local service overrides. TheserviceProvideris propagated to child contexts to override registered services in their scope, too.- Parameters:
view- the viewdomainObject- the domain objectserviceProvider- a provider of local view-model services to override any statically registered services of the same types. May benullif local service overrides are not needed- Returns:
- the created
ViewModelContext - Since:
- 1.16
-
createViewModelContext
public ViewModelContext createViewModelContext(VElement view, org.eclipse.emf.ecore.EObject domainObject, java.util.Map<java.lang.String,?> contextValues)
Instantiates a new view model context with initial context values. TheserviceProvideris propagated to child contexts to override registered services in their scope, too.- Parameters:
view- the viewdomainObject- the domain objectcontextValues- initial context values to set- Returns:
- the created
ViewModelContext - Since:
- 1.21
- See Also:
ViewModelContext.getContextValue(String)
-
createViewModelContext
public ViewModelContext createViewModelContext(VElement view, org.eclipse.emf.ecore.EObject domainObject, ViewModelServiceProvider serviceProvider, java.util.Map<java.lang.String,?> contextValues)
Instantiates a new view model context with a provider of local service overrides and initial context values. TheserviceProvideris propagated to child contexts to override registered services in their scope, too.- Parameters:
view- the viewdomainObject- the domain objectserviceProvider- a provider of local view-model services to override any statically registered services of the same types. May benullif local service overrides are not neededcontextValues- initial context values to set- Returns:
- the created
ViewModelContext - Since:
- 1.21
-
provide
public static ViewModelServiceProvider provide(ViewModelService... modelServices)
Obtain a view-model service provider that statically provides a set of services.- Parameters:
modelServices- model services to provider- Returns:
- the static provider of those services
- Since:
- 1.22
-
-