Bug 507347 - View Model not loaded for Classes from SubPackages
Summary: View Model not loaded for Classes from SubPackages
Status: CLOSED MOVED
Alias: None
Product: ECP
Classification: Modeling
Component: EMF Forms (show other bugs)
Version: 1.10.0   Edit
Hardware: PC Linux
: P2 normal (vote)
Target Milestone: 2.0.0   Edit
Assignee: Eugen Neufeld CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords: helpwanted
Depends on:
Blocks:
 
Reported: 2016-11-10 07:38 EST by Eugen Neufeld CLA
Modified: 2024-02-28 11:55 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Eugen Neufeld CLA 2016-11-10 07:38:15 EST
If you have an Ecore where you have a package and directly inside it a subpackage without an EClassifier next to the subpackage, then the view model for Classes of this subpackage is not loaded.
The problem is, that EMF doesn't generate any package description for the parent package. But the ViewModel expects this parent package to exists. This way the uri of the rootEClass cannot be resolved and the ECLass of the ViewModel doesn't fit the provided EClass when retrieving the view.

We need to handle this case in the EcoreHelper class.
Comment 1 Eclipse Genie CLA 2018-11-20 13:47:39 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.
Comment 2 Alexander Fedorov CLA 2019-01-14 04:45:06 EST
@Eugen, many thanks for your comment, it was so helpful to find the workaround!

This bug is still actual and it blocks the EMF Forms usage for the good part of .ecore with subpackages. 

For the .ecore like:

<?xml version="1.0" encoding="UTF-8"?>
<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="emfforms" nsURI="http://www.example.org/emfforms" nsPrefix="emfforms">
  <eSubpackages name="subpackage" nsURI="http://www.example.org/emfforms/subpackage/1.0.0"
      nsPrefix="subpackage">
    <eClassifiers xsi:type="ecore:EClass" name="Subtype">
      <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
    </eClassifiers>
  </eSubpackages>
</ecore:EPackage>


The .view is saved with hrefs like

<?xml version="1.0" encoding="ASCII"?>
<org.eclipse.emf.ecp.view.model:View xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:org.eclipse.emf.ecp.view.model="http://org/eclipse/emf/ecp/view/model/1170" xmi:id="_R3wuUBfeEemBw6aVb088JQ" name="Subtype">
  <rootEClass href="http://www.example.org/emfforms#//subpackage/Subtype"/>
  <children xsi:type="org.eclipse.emf.ecp.view.model:Control" xmi:id="_R5P8EBfeEemBw6aVb088JQ" name="Control name">
    <domainModelReference xsi:type="org.eclipse.emf.ecp.view.model:FeaturePathDomainModelReference" xmi:id="_R5P8ERfeEemBw6aVb088JQ">
      <domainModelEFeature xsi:type="ecore:EAttribute" href="http://www.example.org/emfforms#//subpackage/Subtype/name"/>
    </domainModelReference>
  </children>
  <ecorePaths>/org.example.ecore/model/subpackages.ecore</ecorePaths>
</org.eclipse.emf.ecp.view.model:View>


And then ViewModelFileExtensionsManager is unable to resolve view.getRootEClass() to EClass instance
Comment 3 Eugen Neufeld CLA 2019-01-14 05:27:38 EST
@Alexander
Yes it is still a valid issue.
The main reason nobody worked on this issue is, that subpackages are not well supported in many tools based on EMF.
Maximilian lists the use of subpackages as one of the 5 don't when using EMF https://eclipsesource.com/blogs/2013/03/19/emf-dos-and-donts-5/

Nonetheless we would love to have a fix for this. Any help is appreciated.
Comment 4 Eclipse Genie CLA 2021-01-04 16:43:53 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.
Comment 5 Eclipse Genie CLA 2022-12-26 10:49:54 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.
Comment 6 Eclipse Webmaster CLA 2024-02-28 11:55:55 EST
This issue has been migrated to https://api.github.com/eclipse-ecp/issues/org.eclipse.emf.ecp.core.