Skip to main content



      Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » EMFForms: selecting different viewmodels programatically
EMFForms: selecting different viewmodels programatically [message #1816115] Mon, 21 October 2019 09:09 Go to next message
Eclipse UserFriend
Currently I use the method ECPSWTViewRenderer.INSTANCE.render(parent, eObject) to embed the EMFForm - based GUI into the application. This method invokation works well if there is only one viewmodel registered for a certain EObject.

Now I have several viewmodels registered to the same EObject to be able to render the GUI differently.

I saw that there are several overloaded versions of the ECPSWTViewRenderer.INSTANCE.render method, but I do not know how to parameterize that one correctly with the right viewmodel.

Thank you for your help in advance!
Tamás

[Updated on: Mon, 21 October 2019 09:11] by Moderator

Re: EMFForms: selecting different viewmodels programatically [message #1816204 is a reply to message #1816115] Wed, 23 October 2019 11:07 Go to previous message
Eclipse UserFriend
HI Tamas,

in order to provide the view model using the ECPSWTViewRenderer.INSTANCE.render method you need this call:
final VView view = ViewProviderHelper.getView(domainObject, null);
			final ViewModelContext viewModelContext = ViewModelContextFactory.INSTANCE.createViewModelContext(view, domainObject);
			ECPSWTViewRenderer.INSTANCE.render(content, viewModelContext);


You can use this only if you have the rendering step under control.

If you want to select the view model dynamically, you can provide a custom View Provider as an OSGi Service:
just extend
org.eclipse.emf.ecp.view.spi.provider.IViewProvider
or
org.eclipse.emf.ecp.view.spi.provider.IFilteredViewProvider


Best,
Eugen
Previous Topic:How to set Enum value in custom edapt migration
Next Topic:No property tester contributes a property org.eclipse.emf.ecp.core.project.open
Goto Forum:
  


Current Time: Mon Jun 23 15:54:46 EDT 2025

Powered by FUDForum. Page generated in 0.08208 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top