Class ViewModelContextFactory
- java.lang.Object
-
- org.eclipse.emf.ecp.view.spi.context.ViewModelContextFactory
-
public final class ViewModelContextFactory extends java.lang.Object
This Factory can be used to instantiateViewModelContexts
.- Since:
- 1.2
- Author:
- Eugen Neufeld
-
-
Field Summary
Fields Modifier and Type Field Description static ViewModelContextFactory
INSTANCE
The singleton instance of the factory.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ViewModelContext
createViewModelContext(VElement view, org.eclipse.emf.ecore.EObject domainObject)
Instantiates a new view model context.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.ViewModelContext
createViewModelContext(VElement view, org.eclipse.emf.ecore.EObject domainObject, ViewModelService... modelServices)
Instantiates a new view model context with specific services.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.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.static ViewModelServiceProvider
provide(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 aViewModelServiceProvider
that 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. TheserviceProvider
is 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 benull
if 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. TheserviceProvider
is 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. TheserviceProvider
is 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 benull
if 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
-
-