Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [EMF Forms] Multiple views of a model class with e4
[EMF Forms] Multiple views of a model class with e4 [message #1758429] Tue, 28 March 2017 15:08 Go to next message
Alex Wesp is currently offline Alex WespFriend
Messages: 6
Registered: November 2015
Junior Member
Dear Community,

I try to use a tree master detail view together with a detailed view in two different parts in a e4 application. Therefor I added to the view model package (org.eclipse.emf.ecp.makeithappen.model.viewmodel) a new task tree view with root class Task (TaskTree.view). The e4 package (org.eclipse.emf.ecp.makeithappen.application.sample.e4) was extended by a new class for the new view and the Application. e4xmi was enlarged by a new part to call the new task tree view. All other files of the eclipse example are unchanged. But after starting the application neither the tree view nor the detailed view are shown. Instead the console shows a warning "Multiple view models have been found for the given View Model Loading Properties". What did I wrong?

Thanks in advance for your help!
Re: [EMF Forms] Multiple views of a model class with e4 [message #1758484 is a reply to message #1758429] Wed, 29 March 2017 08:16 Go to previous messageGo to next message
Eugen Neufeld is currently offline Eugen NeufeldFriend
Messages: 174
Registered: May 2015
Senior Member
Hi Alexander,
could you provide the plugin.xml of the viewmodel bundle?

Thanks and cheers,
Eugen


--
Eugen Neufeld

Get professional Eclipse developer support:
http://eclipsesource.com/en/services/developer-support/
Re: [EMF Forms] Multiple views of a model class with e4 [message #1758540 is a reply to message #1758484] Wed, 29 March 2017 18:34 Go to previous messageGo to next message
Alex Wesp is currently offline Alex WespFriend
Messages: 6
Registered: November 2015
Junior Member
Hi Eugen,

thanks for your help. Please see the plugin.xml.
  • Attachment: plugin.xml
    (Size: 0.33KB, Downloaded 416 times)
Re: [EMF Forms] Multiple views of a model class with e4 [message #1758575 is a reply to message #1758540] Thu, 30 March 2017 09:12 Go to previous messageGo to next message
Eugen Neufeld is currently offline Eugen NeufeldFriend
Messages: 174
Registered: May 2015
Senior Member
Hi Alexander,
the Problem is, that you now have simply registered two view model.
EMFForms cannot distinguish between the two.
You need to change your registration to:
<plugin>
  <extension point="org.eclipse.emf.ecp.view.model.provider.xmi.file">
    <file filePath="viewmodels/TaskTree.view"/>
    <file filePath="viewmodels/Task.view">
      <filter key="detail" value="true"></filter>
    </file>
    <file filePath="viewmodels/User.view"></file>
  </extension>
</plugin>

You can check this Tutorial: http://eclipsesource.com/blogs/tutorials/emf-forms-view-model-elements/#treemasterdetail
The CodeBlock is broken, should be fixed soon.

I think that in your case it would be better to provide the view model directly when rendering using this call:
org.eclipse.emf.ecp.view.internal.swt.ECPSWTViewRendererImpl.render(Composite, EObject, VView)


In order to retrieve the correct view from the registry you can use this:
VViewModelLoadingProperties properties = VViewFactory.eINSTANCE.createViewModelLoadingProperties();
properties.addNonInheritableProperty("detail", true);
final VView view = ViewProviderHelper.getView(dmr, properties);

The example above will retrieve the Task.view. For the TaskTree.view just provide null instead of the properties .

Cheers,
Eugen


--
Eugen Neufeld

Get professional Eclipse developer support:
http://eclipsesource.com/en/services/developer-support/
Re: [EMF Forms] Multiple views of a model class with e4 [message #1758714 is a reply to message #1758575] Fri, 31 March 2017 21:40 Go to previous message
Alex Wesp is currently offline Alex WespFriend
Messages: 6
Registered: November 2015
Junior Member
Hi Eugen,

thank for your quick help. It works!

Conclusion:
To enlarge the example model I did the following things:
in viewmodel:
1) Generate a new tree view and detail view for the task object
2) modify the plugin.xml so that the tree view and task view can be distinguished by the view provider
in e4:
3) create classes for task part und task tree part
4) add in Application.e4xmi additional parts for task view and task tree view
5) creating a 16x16.gif icon instead of 256x256 for better reading
6) adding the treemasterdetail.model, -edit, -ui.swt to product file

Hint:
The views are not connected with each other. This means that inserted data are not shown in other views.

For everybody who is interested here the corrected files.

Have fun.

Previous Topic:[EMF/EMF Forms] RCP Dependencies / Requirements
Next Topic:[EMF Forms] Iterating over properties
Goto Forum:
  


Current Time: Tue Mar 19 10:41:57 GMT 2024

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

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

Back to the top