Standalone vs editor model compatibility [message #1021538] |
Wed, 20 March 2013 09:38 |
Valerian Merkling Messages: 71 Registered: May 2011 |
Member |
|
|
Hi everyone !
I'm trying tu build a standalone application, just a few swing form to edit my model.
I was able to make my app be able to read my .schema file with this code :
String path=f.getCanonicalPath();
ResourceSet resourceSet = new ResourceSetImpl();
resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(Resource.Factory.Registry.DEFAULT_EXTENSION, new XMIResourceFactoryImpl());
resourceSet.getPackageRegistry().put(SchemaPackage.eNS_URI, schemapack);
resource = resourceSet.getResource(URI.createFileURI(path), true);
EList<EObject> list = resource.getContents();
Everythings used to work fine (i mean i was able to work on the sime file with both my standalone app and the generated editor).
But i made a little change (deleted à EReference from the model), regenerated the code (model, edit and editor) and now, my standalone app can't load my file anymore.
Caused by: org.eclipse.emf.ecore.xmi.ClassNotFoundException: Class 'consignementReport' is not found or is abstract. (file:/D:/Mes%20documents/Test/workspace/sim-sgr/My.schema, 2, 58)
My Ecore say that the root EClass is DocumentRoot, which contains some ConsignementReportModel, and the containment reference is called consignementReport
And my problematic .schema file start with
<schema:consignementReport xmlns:schema="urn:sia-schema">
I guess the problem is here, my standalone app need the class name, and if i change it to ConsignementReportModel it's ok for the app, but not for the editor anymore..
So I would like to know how i can make them work together again and what is wrong in my code.
Regards,
Valerian
|
|
|
Re: Standalone vs editor model compatibility [message #1021566 is a reply to message #1021538] |
Wed, 20 March 2013 10:16 |
Ed Merks Messages: 33142 Registered: July 2009 |
Senior Member |
|
|
Valerian,
Comments below.
On 20/03/2013 10:38 AM, Valerian Merkling wrote:
> Hi everyone !
>
> I'm trying tu build a standalone application, just a few swing form to
> edit my model.
>
> I was able to make my app be able to read my .schema file with this
> code :
>
>
> String path=f.getCanonicalPath();
> ResourceSet resourceSet = new ResourceSetImpl();
> resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(Resource.Factory.Registry.DEFAULT_EXTENSION,
> new XMIResourceFactoryImpl());
> resourceSet.getPackageRegistry().put(SchemaPackage.eNS_URI, schemapack);
>
> resource = resourceSet.getResource(URI.createFileURI(path), true);
> EList<EObject> list = resource.getContents();
>
> Everythings used to work fine (i mean i was able to work on the sime
> file with both my standalone app and the generated editor).
> But i made a little change (deleted à EReference from the model),
> regenerated the code (model, edit and editor) and now, my standalone
> app can't load my file anymore.
>
> Caused by: org.eclipse.emf.ecore.xmi.ClassNotFoundException: Class
> 'consignementReport' is not found or is abstract.
> (file:/D:/Mes%20documents/Test/workspace/sim-sgr/My.schema, 2, 58)
>
> My Ecore say that the root EClass is DocumentRoot, which contains some
> ConsignementReportModel, and the containment reference is called
> consignementReport
>
> And my problematic .schema file start with <schema:consignementReport
> xmlns:schema="urn:sia-schema">
>
> I guess the problem is here, my standalone app need the class name,
> and if i change it to ConsignementReportModel it's ok for the app, but
> not for the editor anymore..
If your model is XML Schema based, you should use the generated resource
factory everywhere, including in your stand alone application. Try
invoking Generate Test Code... and have a look at the registrations in
the generated XyzExample.java; that's what you should use for stand
alone (and what should be registered in the plugin.xml and used when
running in Eclipse).
>
> So I would like to know how i can make them work together again and
> what is wrong in my code.
>
> Regards,
> Valerian
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
|
Powered by
FUDForum. Page generated in 0.02707 seconds