Community
Participate
Working Groups
In the VSM editor, in the "Metamodels" section of RepresentationDescriptions, we have buttons to select the metamodel "from the registry", "from the workspace", and "from the filesystem". We should add "from the Target Platform" button, based on the "Browse Target Platform Packages" button proposed by recent versions of EMF (see https://bugs.eclipse.org/bugs/attachment.cgi?id=257858 for a screenshot). The Sirius code for this custom section is at RepresentationDescriptionMetamodelPropertySectionSpec. The EMF code for the actual behavior we want can be found in org.eclipse.emf.ecore.presentation.EcoreActionBarContributor.ExtendedLoadResourceDialog.
There's a first very rough attempt at https://git.eclipse.org/r/#/c/72685/, but it looks like it might be more complex than initially thought, so moving to 4.1.
From what I understand, EMF itself uses a lot of "dirty tricks" (see org.eclipse.emf.ecore.plugin.EcorePlugin.PDEHelper, full of reflective calls, which is invoked from org.eclipse.emf.ecore.presentation.EcoreActionBarContributor.ExtendedLoadResourceActi on.TargetPlatformPackageDialog.updateElements()) to obtain the nsURIs for the EPackages declared in the plug-ins found in the target platform (it actually reflectively parses the EMF extension points from the plugin.xml of said plug-ins' JARs...). Even with this, it can only obtain the textual nsURIs of the packages, not actual EPackages instances. However, because of how our metamodel is designed, RepresentationDescription.getMetamodel() is actually a reference to actual EPackages. Why this was done this way and whether or not it was a good idea is another matter, but in practice I see no easy way to obtain what we need (loading the .ecore from the target platform archives like the PDEHelper does for the plugin.xml files? ugh...). Cédric, I'm adding you in CC in case I misunderstood something or if you have an idea. In the meantime, moving to 5.0 to re-evaluate, but if we really want this, it might require some deeper infrastructure work to make it possible.