Hi all,
I am using GWT with EMF and I want write files on client side containing 
description of some EMF object with the JSON format. For this purpose I use 
EMFJson tool  (https://emfjson.github.io/) with the following code but I 
can't write the file,. Have you an idea?

Here is the code:

        // As of here we preparing to save the model content
        ResourceSet resSet = new ResourceSetImpl();
        // Register the XMI resource factory for the * extension
        resSet.getPackageRegistry()
        .put(EcorePackage.eNS_URI,EcorePackage.eINSTANCE);

        resSet.getResourceFactoryRegistry()
        .getExtensionToFactoryMap()
        .put("*", new JsonResourceFactory());

        // Obtain a new resource set
        
        resSet.getURIConverter().getURIHandlers().add(new 
LocalStorageHandler());

        // create a resource
        URI uri = URI.createURI("file:///" + "D:/Spottest.json");
        GWT.log(uri.toString());
        Resource resource = resSet.createResource(uri);
        // Get the first model element and cast it to the right type,
        // everything is hierarchical included in this first node
        resource.getContents().add(custom);

        // now save the content.
        // resource.save(Collections.EMPTY_MAP);
        try {
            resource.save(Collections.EMPTY_MAP);
        } catch (Exception e) {
            GWT.log("Pb saved " + e.getMessage());
        }

Thanks a lot for your help.

Antonio

-- 
You received this message because you are subscribed to the Google Groups "GWT 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-web-toolkit/56b08495-9c94-4e83-8a7e-470ea05f4b77n%40googlegroups.com.

Reply via email to