Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Standalone vs editor model compatibility
Standalone vs editor model compatibility [message #1021538] Wed, 20 March 2013 09:38 Go to next message
Valerian Merkling is currently offline 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 Go to previous messageGo to next message
Ed Merks is currently offline Ed Merks
Messages: 26137
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
Re: Standalone vs editor model compatibility [message #1021647 is a reply to message #1021566] Wed, 20 March 2013 13:06 Go to previous message
Valerian Merkling is currently offline Valerian Merkling
Messages: 71
Registered: May 2011
Member
Perfect, it works, thanks a lot !
Previous Topic:Referenced objects not loaded
Next Topic:[CDO/EMF] latest stable integration build, code compatibility
Goto Forum:
  


Current Time: Thu Oct 23 02:24:30 GMT 2014

Powered by FUDForum. Page generated in 0.01888 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software