|
Re: Resolve an EClass that is a Proxy [message #1837379 is a reply to message #1837376] |
Fri, 29 January 2021 00:07 |
Yigal Spinner Messages: 127 Registered: July 2009 |
Senior Member |
|
|
After some investigate, I found that when I load the gemodel of the model B, the package for model A has the same folder as model B and therefore can't be loaded.
Here is a sample of the code:
// Load the genmodel
ResourceSet set = new ResourceSetImpl();
// Register the appropriate resource factory to handle all file
// extensions.
set.getResourceFactoryRegistry().getExtensionToFactoryMap().put(EcorePackage.eNAME, new XMIResourceFactoryImpl());
// Register the package to ensure it is available during loading.
set.getPackageRegistry().put(EcorePackage.eNS_URI, EcorePackage.eINSTANCE);
URI uri = URI.createFileURI(targetPackageFolder +"model/csm.genmodel");
Resource ecoreResource = set.getResource(uri, true);
if (!ecoreResource.getContents().isEmpty()) {
GenModel model = (GenModel) ecoreResource.getContents().get(0);
List<GenPackage> listPkgs = model.getUsedGenPackages();
for (GenPackage g1 : listPkgs) {
EPackage pk = g1.getEcorePackage();
// PK is NULL since the base location is invalid
}
In the genmodel file it is clear that the depended EPackage are in a different folder (see used Packages attribute):
<genmodel:GenModel xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
xmlns:genmodel="http://www.eclipse.org/emf/2002/GenModel" copyrightText="Copyrights 2018 Accenture. All rights reserved."
modelDirectory="/com.accenture.fso.fsd.transact.model.csm/src" editDirectory="/com.accenture.fso.fsd.transact.model.csm/src"
editorDirectory="/com.accenture.fso.fsd.editors.csm/src" modelPluginID="com.accenture.fso.fsd.transact.model.csm"
templateDirectory="platform:/plugin/com.accenture.fso.tools.emf.generator.validator/emftemplates"
dynamicTemplates="true" forceOverwrite="true" modelName="Csm" editPluginClass="com.accenture.fso.fsd.transact.model.csm.CsmPluginActivator"
editorPluginClass="com.accenture.fso.fsd.editors.csm.CsmEditorPluginActivator"
importerID="org.eclipse.emf.importer.ecore" complianceLevel="8.0" copyrightFields="false"
editPluginID="com.accenture.fso.fsd.transact.model.csm" editorPluginID="com.accenture.fso.fsd.editors.csm"
fontProviders="true" usedGenPackages="../../com.accenture.fso.mdd.model.types/model/etype.genmodel#//types ../../com.accenture.fso.fsd.app.model.fsdmodel/model/fsdmodel.genmodel#//fsdmodel"
styleProviders="true" modelDocumentation="1.4.0">
<foreignModel>file:/C:/Temp/csm.ecore</foreignModel>
[Updated on: Fri, 29 January 2021 00:31] Report message to a moderator
|
|
|
|
Re: Resolve an EClass that is a Proxy [message #1837418 is a reply to message #1837383] |
Fri, 29 January 2021 15:44 |
Yigal Spinner Messages: 127 Registered: July 2009 |
Senior Member |
|
|
Hi Ed,
The targetPackageFolder is a full path. But the usedGenPackages values are invalid as a reference. I modified the used packages manually:
usedGenPackages="../../../../../MDD/base/com.accenture.fso.mdd.model.types/model/etype.genmodel#//types ../../../../App/com.accenture.fso.fsd.app.model.fsdmodel/model/fsdmodel.genmodel#//fsdmodel"
Now, when I open the genmodle Editor, I get an error,
java.net.MalformedURLException: Unsupported "platform:" protocol variation "..".
at org.eclipse.core.internal.boot.PlatformURLHandler.openConnection(PlatformURLHandler.java:61)
at org.eclipse.osgi.internal.url.URLStreamHandlerProxy.openConnection(URLStreamHandlerProxy.java:123)
at java.base/java.net.URL.openConnection(URL.java:1051)
However the used package do load in my code but the Editor does not work.
How can I fix that?
Thanks
Yigal
[Updated on: Fri, 29 January 2021 15:47] Report message to a moderator
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.06195 seconds