Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 13:09 Go to next message
Tamas Miklossy is currently offline Tamas MiklossyFriend
Messages: 143
Registered: February 2016
Senior Member
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!

[Updated on: Mon, 21 October 2019 13:11]

Report message to a moderator

Re: EMFForms: selecting different viewmodels programatically [message #1816204 is a reply to message #1816115] Wed, 23 October 2019 15:07 Go to previous message
Eugen Neufeld is currently offline Eugen NeufeldFriend
Messages: 169
Registered: May 2015
Senior Member
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


Eugen Neufeld

Get professional Eclipse developer support:
Previous Topic:How to set Enum value in custom edapt migration
Next Topic:No property tester contributes a property
Goto Forum:

Current Time: Sat May 21 12:16:49 GMT 2022

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

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

Back to the top