Use of Plugin GenModels [message #302268] |
Tue, 18 April 2006 08:49  |
Eclipse User |
|
|
|
I am using the EcoreImporter to programmatically create a GenModel on an
Ecore model.
The Ecore Model contains EClasses which have as a SuperType an EClass "A"
defined in a Plugin created in the standard way.
When I come to run genModel.validate(); I get an error:
"Problems encountered in the model ;
org.eclipse.core.runtime.CoreException
Problems encountered in the model
The package 'uk.co.his.diagram.metamodel#/' is needed but isn't
accessible from the Generator model"
I know from EcorePlugin.getEPackageNsURIToGenModelLocationMap() what the
location of the genmodels of this nsuri "uk.co.his.diagram.metamodel" is.
I can add these to the GenModel using its getUsedGenPackages list;
Map map = EcorePlugin.getEPackageNsURIToGenModelLocationMap();
URI coreMetamodelGenModelURI = (URI)map.get("uk.co.his.metamodel.core");
if(coreMetamodelGenModelURI != null)
{
ResourceSet resSet = modelImporter.createResourceSet();
Resource res = resSet.getResource(coreMetamodelGenModelURI, true);
if(res != null)
{
GenModel externalGenModel = (GenModel)res.getContents().get(0);
if(externalGenModel != null)
{
for(Iterator iter = externalGenModel.getGenPackages().iterator();
iter.hasNext(); )
{
GenPackage externalGenPkg = (GenPackage)iter.next();
generator.getUsedGenPackages().add(externalGenPkg);
}
}
}
}
However I now get a different set of diagnostic errors along the lines of
...
Problems encountered in the model
Unable to resolve proxy
'platform:/plugin/uk.co.his.tool2.metamodel.core/genmodel/Me taModel.ecore#//core/Object/canAddAll/index'
Its use is by
'platform:/plugin/uk.co.his.tool2.metamodel.core/genmodel/Me tamodel.genmodel#//@genPackages.1/@nestedGenPackages.0/@genC lasses.15/@genOperations.8/@genParameters.2'
platform:/plugin/uk.co.his.tool2.metamodel.core/genmodel/Met aModel.ecore
is a file created along with the original
platform:/plugin/uk.co.his.tool2.metamodel.core/genmodel/Met amodel.genmodel
when I was importing the original Ecore model to create a gen model.
What am I doing wrong? Is there any neater way to get the GenModel code to
pick up genmodels which are already registered?
Thanks
|
|
|
|
Powered by
FUDForum. Page generated in 0.05430 seconds