Skip to content

Commit

Permalink
Moved EcoreGeneration to a standalone method.
Browse files Browse the repository at this point in the history
Signed-off-by: simonGraband <[email protected]>
  • Loading branch information
sgraband committed Nov 26, 2019
1 parent 4030e50 commit 227a20c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,21 @@ public static void main(String[] args) throws IOException
System.exit(-13);
}


ResourceSet resourceSet = new ResourceSetImpl();
createEcore(name, prefix, uri, workspacePath);
}

public static void createEcore(String name, String nsPrefix, String nsURI, Path workspacePath) throws IOException {
ResourceSet resourceSet = new ResourceSetImpl();
resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("*", new XMIResourceFactoryImpl());
XMLResource resource = (XMLResource) resourceSet.createResource(URI.createFileURI(workspacePath.toString()));

EPackage ePackage = EcoreFactory.eINSTANCE.createEPackage();
ePackage.setName(name);
ePackage.setNsPrefix(prefix);
ePackage.setNsURI(uri);
ePackage.setNsPrefix(nsPrefix);
ePackage.setNsURI(nsURI);
resource.setEncoding("UTF-8");
resource.getContents().add(ePackage);
resource.save(null);
}
}

}

0 comments on commit 227a20c

Please sign in to comment.