summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjmusset2009-03-05 12:37:49 (EST)
committer jmusset2009-03-05 12:37:49 (EST)
commit0cc4223dc0bb422ff411e683f4436f0e19d26b11 (patch)
tree22ed863f4c0899cd8c15926bc8a8c91b03b5e398
parent54dd6a9d0bc0090d78e0646cb3fa767fe0f32ffb (diff)
downloadorg.eclipse.acceleo-0cc4223dc0bb422ff411e683f4436f0e19d26b11.zip
org.eclipse.acceleo-0cc4223dc0bb422ff411e683f4436f0e19d26b11.tar.gz
org.eclipse.acceleo-0cc4223dc0bb422ff411e683f4436f0e19d26b11.tar.bz2
Examples build for the renamed version
-rw-r--r--examples/org.eclipse.acceleo.module.example.ecore2python/src/org/eclipse/acceleo/module/ecore2python/CommonClass.java192
-rw-r--r--examples/org.eclipse.acceleo.module.example.ecore2python/src/org/eclipse/acceleo/module/ecore2python/Factory.java192
-rw-r--r--examples/org.eclipse.acceleo.module.example.ecore2python/src/org/eclipse/acceleo/module/ecore2python/Init.java192
-rw-r--r--examples/org.eclipse.acceleo.module.example.ecore2python/src/org/eclipse/acceleo/module/ecore2python/Parser.java192
-rw-r--r--examples/org.eclipse.acceleo.module.example.ecore2python/tasks/commonClass.xml2
-rw-r--r--examples/org.eclipse.acceleo.module.example.ecore2python/tasks/factory.xml2
-rw-r--r--examples/org.eclipse.acceleo.module.example.ecore2python/tasks/init.xml2
-rw-r--r--examples/org.eclipse.acceleo.module.example.ecore2python/tasks/parser.xml2
8 files changed, 376 insertions, 400 deletions
diff --git a/examples/org.eclipse.acceleo.module.example.ecore2python/src/org/eclipse/acceleo/module/ecore2python/CommonClass.java b/examples/org.eclipse.acceleo.module.example.ecore2python/src/org/eclipse/acceleo/module/ecore2python/CommonClass.java
index c61cf3b..4154efc 100644
--- a/examples/org.eclipse.acceleo.module.example.ecore2python/src/org/eclipse/acceleo/module/ecore2python/CommonClass.java
+++ b/examples/org.eclipse.acceleo.module.example.ecore2python/src/org/eclipse/acceleo/module/ecore2python/CommonClass.java
@@ -53,7 +53,7 @@ public class CommonClass {
*
* @generated
*/
- public static final String[] TEMPLATE_NAMES = {"packageToPythonCommonFile",};
+ public static final String[] TEMPLATE_NAMES = { "packageToPythonCommonFile", };
/**
* The root element of the module.
@@ -89,20 +89,20 @@ public class CommonClass {
* @generated
*/
public CommonClass(URI modelURI, File targetFolder, List<? extends Object> arguments) throws IOException {
- ResourceSet resourceSet = new ResourceSetImpl();
- registerResourceFactories(resourceSet);
- registerPackages(resourceSet);
- URL templateURL = CommonClass.class.getResource(MODULE_FILE_NAME + ".emtl");
- if (templateURL == null) {
- throw new IOException("'" + MODULE_FILE_NAME + ".emtl' not found");
- } else {
- URI templateURI = createTemplateURI(templateURL.getPath());
- module = (Module)load(templateURI, resourceSet);
- model = load(modelURI, resourceSet);
- this.targetFolder = targetFolder;
- this.arguments = arguments;
- }
- }
+ ResourceSet resourceSet = new ResourceSetImpl();
+ registerResourceFactories(resourceSet);
+ registerPackages(resourceSet);
+ URL templateURL = CommonClass.class.getResource(MODULE_FILE_NAME + ".emtl");
+ if (templateURL == null) {
+ throw new IOException("'" + MODULE_FILE_NAME + ".emtl' not found");
+ } else {
+ URI templateURI = createTemplateURI(templateURL.getPath());
+ module = (Module)load(templateURI, resourceSet);
+ model = load(modelURI, resourceSet);
+ this.targetFolder = targetFolder;
+ this.arguments = arguments;
+ }
+ }
/**
* Constructor.
@@ -118,20 +118,20 @@ public class CommonClass {
* @generated
*/
public CommonClass(EObject model, File targetFolder, List<? extends Object> arguments) throws IOException {
- ResourceSet resourceSet = model.eResource().getResourceSet();
- registerResourceFactories(resourceSet);
- registerPackages(resourceSet);
- URL templateURL = CommonClass.class.getResource(MODULE_FILE_NAME + ".emtl");
- if (templateURL == null) {
- throw new IOException("'" + MODULE_FILE_NAME + ".emtl' not found");
- } else {
- URI templateURI = createTemplateURI(templateURL.getPath());
- module = (Module)load(templateURI, resourceSet);
- this.model = model;
- this.targetFolder = targetFolder;
- this.arguments = arguments;
- }
- }
+ ResourceSet resourceSet = model.eResource().getResourceSet();
+ registerResourceFactories(resourceSet);
+ registerPackages(resourceSet);
+ URL templateURL = CommonClass.class.getResource(MODULE_FILE_NAME + ".emtl");
+ if (templateURL == null) {
+ throw new IOException("'" + MODULE_FILE_NAME + ".emtl' not found");
+ } else {
+ URI templateURI = createTemplateURI(templateURL.getPath());
+ module = (Module)load(templateURI, resourceSet);
+ this.model = model;
+ this.targetFolder = targetFolder;
+ this.arguments = arguments;
+ }
+ }
/**
* Creates the template URI.
@@ -161,17 +161,12 @@ public class CommonClass {
* @generated
*/
private void registerPackages(ResourceSet resourceSet) {
- resourceSet.getPackageRegistry().put(org.eclipse.emf.ecore.EcorePackage.eINSTANCE.getNsURI(),
- org.eclipse.emf.ecore.EcorePackage.eINSTANCE);
- resourceSet.getPackageRegistry().put(org.eclipse.ocl.ecore.EcorePackage.eINSTANCE.getNsURI(),
- org.eclipse.ocl.ecore.EcorePackage.eINSTANCE);
- resourceSet.getPackageRegistry().put(
- org.eclipse.ocl.expressions.ExpressionsPackage.eINSTANCE.getNsURI(),
- org.eclipse.ocl.expressions.ExpressionsPackage.eINSTANCE);
- resourceSet.getPackageRegistry().put(MtlPackage.eINSTANCE.getNsURI(), MtlPackage.eINSTANCE);
- resourceSet.getPackageRegistry().put("http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore",
- getOCLStdLibPackage());
- }
+ resourceSet.getPackageRegistry().put(org.eclipse.emf.ecore.EcorePackage.eINSTANCE.getNsURI(), org.eclipse.emf.ecore.EcorePackage.eINSTANCE);
+ resourceSet.getPackageRegistry().put(org.eclipse.ocl.ecore.EcorePackage.eINSTANCE.getNsURI(), org.eclipse.ocl.ecore.EcorePackage.eINSTANCE);
+ resourceSet.getPackageRegistry().put(org.eclipse.ocl.expressions.ExpressionsPackage.eINSTANCE.getNsURI(), org.eclipse.ocl.expressions.ExpressionsPackage.eINSTANCE);
+ resourceSet.getPackageRegistry().put(MtlPackage.eINSTANCE.getNsURI(), MtlPackage.eINSTANCE);
+ resourceSet.getPackageRegistry().put("http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore", getOCLStdLibPackage());
+ }
/**
* Returns the package containing the OCL standard library.
@@ -180,10 +175,10 @@ public class CommonClass {
* @generated
*/
private EPackage getOCLStdLibPackage() {
- EcoreEnvironmentFactory factory = new EcoreEnvironmentFactory();
- EcoreEnvironment environment = (EcoreEnvironment)factory.createEnvironment();
- return (EPackage)EcoreUtil.getRootContainer(environment.getOCLStandardLibrary().getBag());
- }
+ EcoreEnvironmentFactory factory = new EcoreEnvironmentFactory();
+ EcoreEnvironment environment = (EcoreEnvironment)factory.createEnvironment();
+ return (EPackage)EcoreUtil.getRootContainer(environment.getOCLStandardLibrary().getBag());
+ }
/**
* Updates the registry used for looking up resources factory in the given resource set.
@@ -193,13 +188,10 @@ public class CommonClass {
* @generated
*/
private void registerResourceFactories(ResourceSet resourceSet) {
- resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("ecore",
- new EcoreResourceFactoryImpl());
- resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("emtl",
- new org.eclipse.acceleo.model.mtl.resource.EMtlResourceFactoryImpl());
- resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(
- Resource.Factory.Registry.DEFAULT_EXTENSION, new XMIResourceFactoryImpl());
- }
+ resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("ecore", new EcoreResourceFactoryImpl());
+ resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("emtl", new org.eclipse.acceleo.model.mtl.resource.EMtlResourceFactoryImpl());
+ resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(Resource.Factory.Registry.DEFAULT_EXTENSION, new XMIResourceFactoryImpl());
+ }
/**
* The main method.
@@ -209,23 +201,23 @@ public class CommonClass {
* @generated
*/
public static void main(String[] args) {
- try {
- if (args.length < 2) {
- System.out.println("Arguments not valid : {model, folder}.");
- } else {
- URI modelURI = URI.createFileURI(args[0]);
- File folder = new File(args[1]);
- List<String> arguments = new ArrayList<String>();
- for (int i = 2; i < args.length; i++) {
- arguments.add(args[i]);
- }
- CommonClass generator = new CommonClass(modelURI, folder, arguments);
- generator.doGenerate();
- }
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
+ try {
+ if (args.length < 2) {
+ System.out.println("Arguments not valid : {model, folder}.");
+ } else {
+ URI modelURI = URI.createFileURI(args[0]);
+ File folder = new File(args[1]);
+ List<String> arguments = new ArrayList<String>();
+ for (int i = 2; i < args.length; i++) {
+ arguments.add(args[i]);
+ }
+ CommonClass generator = new CommonClass(modelURI, folder, arguments);
+ generator.doGenerate();
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
/**
* Launches the generation.
@@ -235,13 +227,13 @@ public class CommonClass {
* @generated
*/
public void doGenerate() throws IOException {
- if (!targetFolder.exists()) {
- targetFolder.mkdirs();
- }
- for (int i = 0; i < TEMPLATE_NAMES.length; i++) {
- AcceleoService.doGenerate(module, TEMPLATE_NAMES[i], model, arguments, targetFolder, false);
- }
- }
+ if (!targetFolder.exists()) {
+ targetFolder.mkdirs();
+ }
+ for (int i = 0; i < TEMPLATE_NAMES.length; i++) {
+ AcceleoService.doGenerate(module, TEMPLATE_NAMES[i], model, arguments, targetFolder, false);
+ }
+ }
/**
* Loads a model from an {@link org.eclipse.emf.common.util.URI URI} in a given {@link ResourceSet}.
@@ -260,16 +252,16 @@ public class CommonClass {
* @generated
*/
private EObject load(URI modelURI, ResourceSet resourceSet) throws IOException {
- EObject result = null;
- final Resource modelResource = createResource(modelURI, resourceSet);
- final Map<String, String> options = new HashMap<String, String>();
- options.put(XMLResource.OPTION_ENCODING, System.getProperty("file.encoding"));
- modelResource.load(options);
- if (modelResource.getContents().size() > 0) {
- result = modelResource.getContents().get(0);
- }
- return result;
- }
+ EObject result = null;
+ final Resource modelResource = createResource(modelURI, resourceSet);
+ final Map<String, String> options = new HashMap<String, String>();
+ options.put(XMLResource.OPTION_ENCODING, System.getProperty("file.encoding"));
+ modelResource.load(options);
+ if (modelResource.getContents().size() > 0) {
+ result = modelResource.getContents().get(0);
+ }
+ return result;
+ }
/**
* This will create a {@link Resource} given the model extension it is intended for and a ResourceSet.
@@ -282,20 +274,20 @@ public class CommonClass {
* @generated
*/
private Resource createResource(URI modelURI, ResourceSet resourceSet) {
- String fileExtension = modelURI.fileExtension();
- if (fileExtension == null || fileExtension.length() == 0) {
- fileExtension = Resource.Factory.Registry.DEFAULT_EXTENSION;
- }
- final Resource.Factory.Registry registry = Resource.Factory.Registry.INSTANCE;
- final Object resourceFactory = registry.getExtensionToFactoryMap().get(fileExtension);
- if (resourceFactory != null) {
- resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(fileExtension,
- resourceFactory);
- } else {
- resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(fileExtension,
- new XMIResourceFactoryImpl());
- }
- return resourceSet.createResource(modelURI);
- }
+ String fileExtension = modelURI.fileExtension();
+ if (fileExtension == null || fileExtension.length() == 0) {
+ fileExtension = Resource.Factory.Registry.DEFAULT_EXTENSION;
+ }
+ final Resource.Factory.Registry registry = Resource.Factory.Registry.INSTANCE;
+ final Object resourceFactory = registry.getExtensionToFactoryMap().get(fileExtension);
+ if (resourceFactory != null) {
+ resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(fileExtension,
+ resourceFactory);
+ } else {
+ resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(fileExtension,
+ new XMIResourceFactoryImpl());
+ }
+ return resourceSet.createResource(modelURI);
+ }
}
diff --git a/examples/org.eclipse.acceleo.module.example.ecore2python/src/org/eclipse/acceleo/module/ecore2python/Factory.java b/examples/org.eclipse.acceleo.module.example.ecore2python/src/org/eclipse/acceleo/module/ecore2python/Factory.java
index 03047c2..181db93 100644
--- a/examples/org.eclipse.acceleo.module.example.ecore2python/src/org/eclipse/acceleo/module/ecore2python/Factory.java
+++ b/examples/org.eclipse.acceleo.module.example.ecore2python/src/org/eclipse/acceleo/module/ecore2python/Factory.java
@@ -53,7 +53,7 @@ public class Factory {
*
* @generated
*/
- public static final String[] TEMPLATE_NAMES = {"packageToPythonFactoryFile",};
+ public static final String[] TEMPLATE_NAMES = { "packageToPythonFactoryFile", };
/**
* The root element of the module.
@@ -89,20 +89,20 @@ public class Factory {
* @generated
*/
public Factory(URI modelURI, File targetFolder, List<? extends Object> arguments) throws IOException {
- ResourceSet resourceSet = new ResourceSetImpl();
- registerResourceFactories(resourceSet);
- registerPackages(resourceSet);
- URL templateURL = Factory.class.getResource(MODULE_FILE_NAME + ".emtl");
- if (templateURL == null) {
- throw new IOException("'" + MODULE_FILE_NAME + ".emtl' not found");
- } else {
- URI templateURI = createTemplateURI(templateURL.getPath());
- module = (Module)load(templateURI, resourceSet);
- model = load(modelURI, resourceSet);
- this.targetFolder = targetFolder;
- this.arguments = arguments;
- }
- }
+ ResourceSet resourceSet = new ResourceSetImpl();
+ registerResourceFactories(resourceSet);
+ registerPackages(resourceSet);
+ URL templateURL = Factory.class.getResource(MODULE_FILE_NAME + ".emtl");
+ if (templateURL == null) {
+ throw new IOException("'" + MODULE_FILE_NAME + ".emtl' not found");
+ } else {
+ URI templateURI = createTemplateURI(templateURL.getPath());
+ module = (Module)load(templateURI, resourceSet);
+ model = load(modelURI, resourceSet);
+ this.targetFolder = targetFolder;
+ this.arguments = arguments;
+ }
+ }
/**
* Constructor.
@@ -118,20 +118,20 @@ public class Factory {
* @generated
*/
public Factory(EObject model, File targetFolder, List<? extends Object> arguments) throws IOException {
- ResourceSet resourceSet = model.eResource().getResourceSet();
- registerResourceFactories(resourceSet);
- registerPackages(resourceSet);
- URL templateURL = Factory.class.getResource(MODULE_FILE_NAME + ".emtl");
- if (templateURL == null) {
- throw new IOException("'" + MODULE_FILE_NAME + ".emtl' not found");
- } else {
- URI templateURI = createTemplateURI(templateURL.getPath());
- module = (Module)load(templateURI, resourceSet);
- this.model = model;
- this.targetFolder = targetFolder;
- this.arguments = arguments;
- }
- }
+ ResourceSet resourceSet = model.eResource().getResourceSet();
+ registerResourceFactories(resourceSet);
+ registerPackages(resourceSet);
+ URL templateURL = Factory.class.getResource(MODULE_FILE_NAME + ".emtl");
+ if (templateURL == null) {
+ throw new IOException("'" + MODULE_FILE_NAME + ".emtl' not found");
+ } else {
+ URI templateURI = createTemplateURI(templateURL.getPath());
+ module = (Module)load(templateURI, resourceSet);
+ this.model = model;
+ this.targetFolder = targetFolder;
+ this.arguments = arguments;
+ }
+ }
/**
* Creates the template URI.
@@ -161,17 +161,12 @@ public class Factory {
* @generated
*/
private void registerPackages(ResourceSet resourceSet) {
- resourceSet.getPackageRegistry().put(org.eclipse.emf.ecore.EcorePackage.eINSTANCE.getNsURI(),
- org.eclipse.emf.ecore.EcorePackage.eINSTANCE);
- resourceSet.getPackageRegistry().put(org.eclipse.ocl.ecore.EcorePackage.eINSTANCE.getNsURI(),
- org.eclipse.ocl.ecore.EcorePackage.eINSTANCE);
- resourceSet.getPackageRegistry().put(
- org.eclipse.ocl.expressions.ExpressionsPackage.eINSTANCE.getNsURI(),
- org.eclipse.ocl.expressions.ExpressionsPackage.eINSTANCE);
- resourceSet.getPackageRegistry().put(MtlPackage.eINSTANCE.getNsURI(), MtlPackage.eINSTANCE);
- resourceSet.getPackageRegistry().put("http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore",
- getOCLStdLibPackage());
- }
+ resourceSet.getPackageRegistry().put(org.eclipse.emf.ecore.EcorePackage.eINSTANCE.getNsURI(), org.eclipse.emf.ecore.EcorePackage.eINSTANCE);
+ resourceSet.getPackageRegistry().put(org.eclipse.ocl.ecore.EcorePackage.eINSTANCE.getNsURI(), org.eclipse.ocl.ecore.EcorePackage.eINSTANCE);
+ resourceSet.getPackageRegistry().put(org.eclipse.ocl.expressions.ExpressionsPackage.eINSTANCE.getNsURI(), org.eclipse.ocl.expressions.ExpressionsPackage.eINSTANCE);
+ resourceSet.getPackageRegistry().put(MtlPackage.eINSTANCE.getNsURI(), MtlPackage.eINSTANCE);
+ resourceSet.getPackageRegistry().put("http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore", getOCLStdLibPackage());
+ }
/**
* Returns the package containing the OCL standard library.
@@ -180,10 +175,10 @@ public class Factory {
* @generated
*/
private EPackage getOCLStdLibPackage() {
- EcoreEnvironmentFactory factory = new EcoreEnvironmentFactory();
- EcoreEnvironment environment = (EcoreEnvironment)factory.createEnvironment();
- return (EPackage)EcoreUtil.getRootContainer(environment.getOCLStandardLibrary().getBag());
- }
+ EcoreEnvironmentFactory factory = new EcoreEnvironmentFactory();
+ EcoreEnvironment environment = (EcoreEnvironment)factory.createEnvironment();
+ return (EPackage)EcoreUtil.getRootContainer(environment.getOCLStandardLibrary().getBag());
+ }
/**
* Updates the registry used for looking up resources factory in the given resource set.
@@ -193,13 +188,10 @@ public class Factory {
* @generated
*/
private void registerResourceFactories(ResourceSet resourceSet) {
- resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("ecore",
- new EcoreResourceFactoryImpl());
- resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("emtl",
- new org.eclipse.acceleo.model.mtl.resource.EMtlResourceFactoryImpl());
- resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(
- Resource.Factory.Registry.DEFAULT_EXTENSION, new XMIResourceFactoryImpl());
- }
+ resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("ecore", new EcoreResourceFactoryImpl());
+ resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("emtl", new org.eclipse.acceleo.model.mtl.resource.EMtlResourceFactoryImpl());
+ resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(Resource.Factory.Registry.DEFAULT_EXTENSION, new XMIResourceFactoryImpl());
+ }
/**
* The main method.
@@ -209,23 +201,23 @@ public class Factory {
* @generated
*/
public static void main(String[] args) {
- try {
- if (args.length < 2) {
- System.out.println("Arguments not valid : {model, folder}.");
- } else {
- URI modelURI = URI.createFileURI(args[0]);
- File folder = new File(args[1]);
- List<String> arguments = new ArrayList<String>();
- for (int i = 2; i < args.length; i++) {
- arguments.add(args[i]);
- }
- Factory generator = new Factory(modelURI, folder, arguments);
- generator.doGenerate();
- }
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
+ try {
+ if (args.length < 2) {
+ System.out.println("Arguments not valid : {model, folder}.");
+ } else {
+ URI modelURI = URI.createFileURI(args[0]);
+ File folder = new File(args[1]);
+ List<String> arguments = new ArrayList<String>();
+ for (int i = 2; i < args.length; i++) {
+ arguments.add(args[i]);
+ }
+ Factory generator = new Factory(modelURI, folder, arguments);
+ generator.doGenerate();
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
/**
* Launches the generation.
@@ -235,13 +227,13 @@ public class Factory {
* @generated
*/
public void doGenerate() throws IOException {
- if (!targetFolder.exists()) {
- targetFolder.mkdirs();
- }
- for (int i = 0; i < TEMPLATE_NAMES.length; i++) {
- AcceleoService.doGenerate(module, TEMPLATE_NAMES[i], model, arguments, targetFolder, false);
- }
- }
+ if (!targetFolder.exists()) {
+ targetFolder.mkdirs();
+ }
+ for (int i = 0; i < TEMPLATE_NAMES.length; i++) {
+ AcceleoService.doGenerate(module, TEMPLATE_NAMES[i], model, arguments, targetFolder, false);
+ }
+ }
/**
* Loads a model from an {@link org.eclipse.emf.common.util.URI URI} in a given {@link ResourceSet}.
@@ -260,16 +252,16 @@ public class Factory {
* @generated
*/
private EObject load(URI modelURI, ResourceSet resourceSet) throws IOException {
- EObject result = null;
- final Resource modelResource = createResource(modelURI, resourceSet);
- final Map<String, String> options = new HashMap<String, String>();
- options.put(XMLResource.OPTION_ENCODING, System.getProperty("file.encoding"));
- modelResource.load(options);
- if (modelResource.getContents().size() > 0) {
- result = modelResource.getContents().get(0);
- }
- return result;
- }
+ EObject result = null;
+ final Resource modelResource = createResource(modelURI, resourceSet);
+ final Map<String, String> options = new HashMap<String, String>();
+ options.put(XMLResource.OPTION_ENCODING, System.getProperty("file.encoding"));
+ modelResource.load(options);
+ if (modelResource.getContents().size() > 0) {
+ result = modelResource.getContents().get(0);
+ }
+ return result;
+ }
/**
* This will create a {@link Resource} given the model extension it is intended for and a ResourceSet.
@@ -282,20 +274,20 @@ public class Factory {
* @generated
*/
private Resource createResource(URI modelURI, ResourceSet resourceSet) {
- String fileExtension = modelURI.fileExtension();
- if (fileExtension == null || fileExtension.length() == 0) {
- fileExtension = Resource.Factory.Registry.DEFAULT_EXTENSION;
- }
- final Resource.Factory.Registry registry = Resource.Factory.Registry.INSTANCE;
- final Object resourceFactory = registry.getExtensionToFactoryMap().get(fileExtension);
- if (resourceFactory != null) {
- resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(fileExtension,
- resourceFactory);
- } else {
- resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(fileExtension,
- new XMIResourceFactoryImpl());
- }
- return resourceSet.createResource(modelURI);
- }
+ String fileExtension = modelURI.fileExtension();
+ if (fileExtension == null || fileExtension.length() == 0) {
+ fileExtension = Resource.Factory.Registry.DEFAULT_EXTENSION;
+ }
+ final Resource.Factory.Registry registry = Resource.Factory.Registry.INSTANCE;
+ final Object resourceFactory = registry.getExtensionToFactoryMap().get(fileExtension);
+ if (resourceFactory != null) {
+ resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(fileExtension,
+ resourceFactory);
+ } else {
+ resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(fileExtension,
+ new XMIResourceFactoryImpl());
+ }
+ return resourceSet.createResource(modelURI);
+ }
}
diff --git a/examples/org.eclipse.acceleo.module.example.ecore2python/src/org/eclipse/acceleo/module/ecore2python/Init.java b/examples/org.eclipse.acceleo.module.example.ecore2python/src/org/eclipse/acceleo/module/ecore2python/Init.java
index 1d1db0e..2574662 100644
--- a/examples/org.eclipse.acceleo.module.example.ecore2python/src/org/eclipse/acceleo/module/ecore2python/Init.java
+++ b/examples/org.eclipse.acceleo.module.example.ecore2python/src/org/eclipse/acceleo/module/ecore2python/Init.java
@@ -53,7 +53,7 @@ public class Init {
*
* @generated
*/
- public static final String[] TEMPLATE_NAMES = {"toModuleInit",};
+ public static final String[] TEMPLATE_NAMES = { "toModuleInit", };
/**
* The root element of the module.
@@ -89,20 +89,20 @@ public class Init {
* @generated
*/
public Init(URI modelURI, File targetFolder, List<? extends Object> arguments) throws IOException {
- ResourceSet resourceSet = new ResourceSetImpl();
- registerResourceFactories(resourceSet);
- registerPackages(resourceSet);
- URL templateURL = Init.class.getResource(MODULE_FILE_NAME + ".emtl");
- if (templateURL == null) {
- throw new IOException("'" + MODULE_FILE_NAME + ".emtl' not found");
- } else {
- URI templateURI = createTemplateURI(templateURL.getPath());
- module = (Module)load(templateURI, resourceSet);
- model = load(modelURI, resourceSet);
- this.targetFolder = targetFolder;
- this.arguments = arguments;
- }
- }
+ ResourceSet resourceSet = new ResourceSetImpl();
+ registerResourceFactories(resourceSet);
+ registerPackages(resourceSet);
+ URL templateURL = Init.class.getResource(MODULE_FILE_NAME + ".emtl");
+ if (templateURL == null) {
+ throw new IOException("'" + MODULE_FILE_NAME + ".emtl' not found");
+ } else {
+ URI templateURI = createTemplateURI(templateURL.getPath());
+ module = (Module)load(templateURI, resourceSet);
+ model = load(modelURI, resourceSet);
+ this.targetFolder = targetFolder;
+ this.arguments = arguments;
+ }
+ }
/**
* Constructor.
@@ -118,20 +118,20 @@ public class Init {
* @generated
*/
public Init(EObject model, File targetFolder, List<? extends Object> arguments) throws IOException {
- ResourceSet resourceSet = model.eResource().getResourceSet();
- registerResourceFactories(resourceSet);
- registerPackages(resourceSet);
- URL templateURL = Init.class.getResource(MODULE_FILE_NAME + ".emtl");
- if (templateURL == null) {
- throw new IOException("'" + MODULE_FILE_NAME + ".emtl' not found");
- } else {
- URI templateURI = createTemplateURI(templateURL.getPath());
- module = (Module)load(templateURI, resourceSet);
- this.model = model;
- this.targetFolder = targetFolder;
- this.arguments = arguments;
- }
- }
+ ResourceSet resourceSet = model.eResource().getResourceSet();
+ registerResourceFactories(resourceSet);
+ registerPackages(resourceSet);
+ URL templateURL = Init.class.getResource(MODULE_FILE_NAME + ".emtl");
+ if (templateURL == null) {
+ throw new IOException("'" + MODULE_FILE_NAME + ".emtl' not found");
+ } else {
+ URI templateURI = createTemplateURI(templateURL.getPath());
+ module = (Module)load(templateURI, resourceSet);
+ this.model = model;
+ this.targetFolder = targetFolder;
+ this.arguments = arguments;
+ }
+ }
/**
* Creates the template URI.
@@ -161,17 +161,12 @@ public class Init {
* @generated
*/
private void registerPackages(ResourceSet resourceSet) {
- resourceSet.getPackageRegistry().put(org.eclipse.emf.ecore.EcorePackage.eINSTANCE.getNsURI(),
- org.eclipse.emf.ecore.EcorePackage.eINSTANCE);
- resourceSet.getPackageRegistry().put(org.eclipse.ocl.ecore.EcorePackage.eINSTANCE.getNsURI(),
- org.eclipse.ocl.ecore.EcorePackage.eINSTANCE);
- resourceSet.getPackageRegistry().put(
- org.eclipse.ocl.expressions.ExpressionsPackage.eINSTANCE.getNsURI(),
- org.eclipse.ocl.expressions.ExpressionsPackage.eINSTANCE);
- resourceSet.getPackageRegistry().put(MtlPackage.eINSTANCE.getNsURI(), MtlPackage.eINSTANCE);
- resourceSet.getPackageRegistry().put("http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore",
- getOCLStdLibPackage());
- }
+ resourceSet.getPackageRegistry().put(org.eclipse.emf.ecore.EcorePackage.eINSTANCE.getNsURI(), org.eclipse.emf.ecore.EcorePackage.eINSTANCE);
+ resourceSet.getPackageRegistry().put(org.eclipse.ocl.ecore.EcorePackage.eINSTANCE.getNsURI(), org.eclipse.ocl.ecore.EcorePackage.eINSTANCE);
+ resourceSet.getPackageRegistry().put(org.eclipse.ocl.expressions.ExpressionsPackage.eINSTANCE.getNsURI(), org.eclipse.ocl.expressions.ExpressionsPackage.eINSTANCE);
+ resourceSet.getPackageRegistry().put(MtlPackage.eINSTANCE.getNsURI(), MtlPackage.eINSTANCE);
+ resourceSet.getPackageRegistry().put("http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore", getOCLStdLibPackage());
+ }
/**
* Returns the package containing the OCL standard library.
@@ -180,10 +175,10 @@ public class Init {
* @generated
*/
private EPackage getOCLStdLibPackage() {
- EcoreEnvironmentFactory factory = new EcoreEnvironmentFactory();
- EcoreEnvironment environment = (EcoreEnvironment)factory.createEnvironment();
- return (EPackage)EcoreUtil.getRootContainer(environment.getOCLStandardLibrary().getBag());
- }
+ EcoreEnvironmentFactory factory = new EcoreEnvironmentFactory();
+ EcoreEnvironment environment = (EcoreEnvironment)factory.createEnvironment();
+ return (EPackage)EcoreUtil.getRootContainer(environment.getOCLStandardLibrary().getBag());
+ }
/**
* Updates the registry used for looking up resources factory in the given resource set.
@@ -193,13 +188,10 @@ public class Init {
* @generated
*/
private void registerResourceFactories(ResourceSet resourceSet) {
- resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("ecore",
- new EcoreResourceFactoryImpl());
- resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("emtl",
- new org.eclipse.acceleo.model.mtl.resource.EMtlResourceFactoryImpl());
- resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(
- Resource.Factory.Registry.DEFAULT_EXTENSION, new XMIResourceFactoryImpl());
- }
+ resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("ecore", new EcoreResourceFactoryImpl());
+ resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("emtl", new org.eclipse.acceleo.model.mtl.resource.EMtlResourceFactoryImpl());
+ resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(Resource.Factory.Registry.DEFAULT_EXTENSION, new XMIResourceFactoryImpl());
+ }
/**
* The main method.
@@ -209,23 +201,23 @@ public class Init {
* @generated
*/
public static void main(String[] args) {
- try {
- if (args.length < 2) {
- System.out.println("Arguments not valid : {model, folder}.");
- } else {
- URI modelURI = URI.createFileURI(args[0]);
- File folder = new File(args[1]);
- List<String> arguments = new ArrayList<String>();
- for (int i = 2; i < args.length; i++) {
- arguments.add(args[i]);
- }
- Init generator = new Init(modelURI, folder, arguments);
- generator.doGenerate();
- }
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
+ try {
+ if (args.length < 2) {
+ System.out.println("Arguments not valid : {model, folder}.");
+ } else {
+ URI modelURI = URI.createFileURI(args[0]);
+ File folder = new File(args[1]);
+ List<String> arguments = new ArrayList<String>();
+ for (int i = 2; i < args.length; i++) {
+ arguments.add(args[i]);
+ }
+ Init generator = new Init(modelURI, folder, arguments);
+ generator.doGenerate();
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
/**
* Launches the generation.
@@ -235,13 +227,13 @@ public class Init {
* @generated
*/
public void doGenerate() throws IOException {
- if (!targetFolder.exists()) {
- targetFolder.mkdirs();
- }
- for (int i = 0; i < TEMPLATE_NAMES.length; i++) {
- AcceleoService.doGenerate(module, TEMPLATE_NAMES[i], model, arguments, targetFolder, false);
- }
- }
+ if (!targetFolder.exists()) {
+ targetFolder.mkdirs();
+ }
+ for (int i = 0; i < TEMPLATE_NAMES.length; i++) {
+ AcceleoService.doGenerate(module, TEMPLATE_NAMES[i], model, arguments, targetFolder, false);
+ }
+ }
/**
* Loads a model from an {@link org.eclipse.emf.common.util.URI URI} in a given {@link ResourceSet}.
@@ -260,16 +252,16 @@ public class Init {
* @generated
*/
private EObject load(URI modelURI, ResourceSet resourceSet) throws IOException {
- EObject result = null;
- final Resource modelResource = createResource(modelURI, resourceSet);
- final Map<String, String> options = new HashMap<String, String>();
- options.put(XMLResource.OPTION_ENCODING, System.getProperty("file.encoding"));
- modelResource.load(options);
- if (modelResource.getContents().size() > 0) {
- result = modelResource.getContents().get(0);
- }
- return result;
- }
+ EObject result = null;
+ final Resource modelResource = createResource(modelURI, resourceSet);
+ final Map<String, String> options = new HashMap<String, String>();
+ options.put(XMLResource.OPTION_ENCODING, System.getProperty("file.encoding"));
+ modelResource.load(options);
+ if (modelResource.getContents().size() > 0) {
+ result = modelResource.getContents().get(0);
+ }
+ return result;
+ }
/**
* This will create a {@link Resource} given the model extension it is intended for and a ResourceSet.
@@ -282,20 +274,20 @@ public class Init {
* @generated
*/
private Resource createResource(URI modelURI, ResourceSet resourceSet) {
- String fileExtension = modelURI.fileExtension();
- if (fileExtension == null || fileExtension.length() == 0) {
- fileExtension = Resource.Factory.Registry.DEFAULT_EXTENSION;
- }
- final Resource.Factory.Registry registry = Resource.Factory.Registry.INSTANCE;
- final Object resourceFactory = registry.getExtensionToFactoryMap().get(fileExtension);
- if (resourceFactory != null) {
- resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(fileExtension,
- resourceFactory);
- } else {
- resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(fileExtension,
- new XMIResourceFactoryImpl());
- }
- return resourceSet.createResource(modelURI);
- }
+ String fileExtension = modelURI.fileExtension();
+ if (fileExtension == null || fileExtension.length() == 0) {
+ fileExtension = Resource.Factory.Registry.DEFAULT_EXTENSION;
+ }
+ final Resource.Factory.Registry registry = Resource.Factory.Registry.INSTANCE;
+ final Object resourceFactory = registry.getExtensionToFactoryMap().get(fileExtension);
+ if (resourceFactory != null) {
+ resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(fileExtension,
+ resourceFactory);
+ } else {
+ resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(fileExtension,
+ new XMIResourceFactoryImpl());
+ }
+ return resourceSet.createResource(modelURI);
+ }
}
diff --git a/examples/org.eclipse.acceleo.module.example.ecore2python/src/org/eclipse/acceleo/module/ecore2python/Parser.java b/examples/org.eclipse.acceleo.module.example.ecore2python/src/org/eclipse/acceleo/module/ecore2python/Parser.java
index baf1012..b1dee6a 100644
--- a/examples/org.eclipse.acceleo.module.example.ecore2python/src/org/eclipse/acceleo/module/ecore2python/Parser.java
+++ b/examples/org.eclipse.acceleo.module.example.ecore2python/src/org/eclipse/acceleo/module/ecore2python/Parser.java
@@ -53,7 +53,7 @@ public class Parser {
*
* @generated
*/
- public static final String[] TEMPLATE_NAMES = {"generateParser",};
+ public static final String[] TEMPLATE_NAMES = { "generateParser", };
/**
* The root element of the module.
@@ -89,20 +89,20 @@ public class Parser {
* @generated
*/
public Parser(URI modelURI, File targetFolder, List<? extends Object> arguments) throws IOException {
- ResourceSet resourceSet = new ResourceSetImpl();
- registerResourceFactories(resourceSet);
- registerPackages(resourceSet);
- URL templateURL = Parser.class.getResource(MODULE_FILE_NAME + ".emtl");
- if (templateURL == null) {
- throw new IOException("'" + MODULE_FILE_NAME + ".emtl' not found");
- } else {
- URI templateURI = createTemplateURI(templateURL.getPath());
- module = (Module)load(templateURI, resourceSet);
- model = load(modelURI, resourceSet);
- this.targetFolder = targetFolder;
- this.arguments = arguments;
- }
- }
+ ResourceSet resourceSet = new ResourceSetImpl();
+ registerResourceFactories(resourceSet);
+ registerPackages(resourceSet);
+ URL templateURL = Parser.class.getResource(MODULE_FILE_NAME + ".emtl");
+ if (templateURL == null) {
+ throw new IOException("'" + MODULE_FILE_NAME + ".emtl' not found");
+ } else {
+ URI templateURI = createTemplateURI(templateURL.getPath());
+ module = (Module)load(templateURI, resourceSet);
+ model = load(modelURI, resourceSet);
+ this.targetFolder = targetFolder;
+ this.arguments = arguments;
+ }
+ }
/**
* Constructor.
@@ -118,20 +118,20 @@ public class Parser {
* @generated
*/
public Parser(EObject model, File targetFolder, List<? extends Object> arguments) throws IOException {
- ResourceSet resourceSet = model.eResource().getResourceSet();
- registerResourceFactories(resourceSet);
- registerPackages(resourceSet);
- URL templateURL = Parser.class.getResource(MODULE_FILE_NAME + ".emtl");
- if (templateURL == null) {
- throw new IOException("'" + MODULE_FILE_NAME + ".emtl' not found");
- } else {
- URI templateURI = createTemplateURI(templateURL.getPath());
- module = (Module)load(templateURI, resourceSet);
- this.model = model;
- this.targetFolder = targetFolder;
- this.arguments = arguments;
- }
- }
+ ResourceSet resourceSet = model.eResource().getResourceSet();
+ registerResourceFactories(resourceSet);
+ registerPackages(resourceSet);
+ URL templateURL = Parser.class.getResource(MODULE_FILE_NAME + ".emtl");
+ if (templateURL == null) {
+ throw new IOException("'" + MODULE_FILE_NAME + ".emtl' not found");
+ } else {
+ URI templateURI = createTemplateURI(templateURL.getPath());
+ module = (Module)load(templateURI, resourceSet);
+ this.model = model;
+ this.targetFolder = targetFolder;
+ this.arguments = arguments;
+ }
+ }
/**
* Creates the template URI.
@@ -161,17 +161,12 @@ public class Parser {
* @generated
*/
private void registerPackages(ResourceSet resourceSet) {
- resourceSet.getPackageRegistry().put(org.eclipse.emf.ecore.EcorePackage.eINSTANCE.getNsURI(),
- org.eclipse.emf.ecore.EcorePackage.eINSTANCE);
- resourceSet.getPackageRegistry().put(org.eclipse.ocl.ecore.EcorePackage.eINSTANCE.getNsURI(),
- org.eclipse.ocl.ecore.EcorePackage.eINSTANCE);
- resourceSet.getPackageRegistry().put(
- org.eclipse.ocl.expressions.ExpressionsPackage.eINSTANCE.getNsURI(),
- org.eclipse.ocl.expressions.ExpressionsPackage.eINSTANCE);
- resourceSet.getPackageRegistry().put(MtlPackage.eINSTANCE.getNsURI(), MtlPackage.eINSTANCE);
- resourceSet.getPackageRegistry().put("http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore",
- getOCLStdLibPackage());
- }
+ resourceSet.getPackageRegistry().put(org.eclipse.emf.ecore.EcorePackage.eINSTANCE.getNsURI(), org.eclipse.emf.ecore.EcorePackage.eINSTANCE);
+ resourceSet.getPackageRegistry().put(org.eclipse.ocl.ecore.EcorePackage.eINSTANCE.getNsURI(), org.eclipse.ocl.ecore.EcorePackage.eINSTANCE);
+ resourceSet.getPackageRegistry().put(org.eclipse.ocl.expressions.ExpressionsPackage.eINSTANCE.getNsURI(), org.eclipse.ocl.expressions.ExpressionsPackage.eINSTANCE);
+ resourceSet.getPackageRegistry().put(MtlPackage.eINSTANCE.getNsURI(), MtlPackage.eINSTANCE);
+ resourceSet.getPackageRegistry().put("http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore", getOCLStdLibPackage());
+ }
/**
* Returns the package containing the OCL standard library.
@@ -180,10 +175,10 @@ public class Parser {
* @generated
*/
private EPackage getOCLStdLibPackage() {
- EcoreEnvironmentFactory factory = new EcoreEnvironmentFactory();
- EcoreEnvironment environment = (EcoreEnvironment)factory.createEnvironment();
- return (EPackage)EcoreUtil.getRootContainer(environment.getOCLStandardLibrary().getBag());
- }
+ EcoreEnvironmentFactory factory = new EcoreEnvironmentFactory();
+ EcoreEnvironment environment = (EcoreEnvironment)factory.createEnvironment();
+ return (EPackage)EcoreUtil.getRootContainer(environment.getOCLStandardLibrary().getBag());
+ }
/**
* Updates the registry used for looking up resources factory in the given resource set.
@@ -193,13 +188,10 @@ public class Parser {
* @generated
*/
private void registerResourceFactories(ResourceSet resourceSet) {
- resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("ecore",
- new EcoreResourceFactoryImpl());
- resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("emtl",
- new org.eclipse.acceleo.model.mtl.resource.EMtlResourceFactoryImpl());
- resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(
- Resource.Factory.Registry.DEFAULT_EXTENSION, new XMIResourceFactoryImpl());
- }
+ resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("ecore", new EcoreResourceFactoryImpl());
+ resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("emtl", new org.eclipse.acceleo.model.mtl.resource.EMtlResourceFactoryImpl());
+ resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(Resource.Factory.Registry.DEFAULT_EXTENSION, new XMIResourceFactoryImpl());
+ }
/**
* The main method.
@@ -209,23 +201,23 @@ public class Parser {
* @generated
*/
public static void main(String[] args) {
- try {
- if (args.length < 2) {
- System.out.println("Arguments not valid : {model, folder}.");
- } else {
- URI modelURI = URI.createFileURI(args[0]);
- File folder = new File(args[1]);
- List<String> arguments = new ArrayList<String>();
- for (int i = 2; i < args.length; i++) {
- arguments.add(args[i]);
- }
- Parser generator = new Parser(modelURI, folder, arguments);
- generator.doGenerate();
- }
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
+ try {
+ if (args.length < 2) {
+ System.out.println("Arguments not valid : {model, folder}.");
+ } else {
+ URI modelURI = URI.createFileURI(args[0]);
+ File folder = new File(args[1]);
+ List<String> arguments = new ArrayList<String>();
+ for (int i = 2; i < args.length; i++) {
+ arguments.add(args[i]);
+ }
+ Parser generator = new Parser(modelURI, folder, arguments);
+ generator.doGenerate();
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
/**
* Launches the generation.
@@ -235,13 +227,13 @@ public class Parser {
* @generated
*/
public void doGenerate() throws IOException {
- if (!targetFolder.exists()) {
- targetFolder.mkdirs();
- }
- for (int i = 0; i < TEMPLATE_NAMES.length; i++) {
- AcceleoService.doGenerate(module, TEMPLATE_NAMES[i], model, arguments, targetFolder, false);
- }
- }
+ if (!targetFolder.exists()) {
+ targetFolder.mkdirs();
+ }
+ for (int i = 0; i < TEMPLATE_NAMES.length; i++) {
+ AcceleoService.doGenerate(module, TEMPLATE_NAMES[i], model, arguments, targetFolder, false);
+ }
+ }
/**
* Loads a model from an {@link org.eclipse.emf.common.util.URI URI} in a given {@link ResourceSet}.
@@ -260,16 +252,16 @@ public class Parser {
* @generated
*/
private EObject load(URI modelURI, ResourceSet resourceSet) throws IOException {
- EObject result = null;
- final Resource modelResource = createResource(modelURI, resourceSet);
- final Map<String, String> options = new HashMap<String, String>();
- options.put(XMLResource.OPTION_ENCODING, System.getProperty("file.encoding"));
- modelResource.load(options);
- if (modelResource.getContents().size() > 0) {
- result = modelResource.getContents().get(0);
- }
- return result;
- }
+ EObject result = null;
+ final Resource modelResource = createResource(modelURI, resourceSet);
+ final Map<String, String> options = new HashMap<String, String>();
+ options.put(XMLResource.OPTION_ENCODING, System.getProperty("file.encoding"));
+ modelResource.load(options);
+ if (modelResource.getContents().size() > 0) {
+ result = modelResource.getContents().get(0);
+ }
+ return result;
+ }
/**
* This will create a {@link Resource} given the model extension it is intended for and a ResourceSet.
@@ -282,20 +274,20 @@ public class Parser {
* @generated
*/
private Resource createResource(URI modelURI, ResourceSet resourceSet) {
- String fileExtension = modelURI.fileExtension();
- if (fileExtension == null || fileExtension.length() == 0) {
- fileExtension = Resource.Factory.Registry.DEFAULT_EXTENSION;
- }
- final Resource.Factory.Registry registry = Resource.Factory.Registry.INSTANCE;
- final Object resourceFactory = registry.getExtensionToFactoryMap().get(fileExtension);
- if (resourceFactory != null) {
- resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(fileExtension,
- resourceFactory);
- } else {
- resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(fileExtension,
- new XMIResourceFactoryImpl());
- }
- return resourceSet.createResource(modelURI);
- }
+ String fileExtension = modelURI.fileExtension();
+ if (fileExtension == null || fileExtension.length() == 0) {
+ fileExtension = Resource.Factory.Registry.DEFAULT_EXTENSION;
+ }
+ final Resource.Factory.Registry registry = Resource.Factory.Registry.INSTANCE;
+ final Object resourceFactory = registry.getExtensionToFactoryMap().get(fileExtension);
+ if (resourceFactory != null) {
+ resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(fileExtension,
+ resourceFactory);
+ } else {
+ resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(fileExtension,
+ new XMIResourceFactoryImpl());
+ }
+ return resourceSet.createResource(modelURI);
+ }
}
diff --git a/examples/org.eclipse.acceleo.module.example.ecore2python/tasks/commonClass.xml b/examples/org.eclipse.acceleo.module.example.ecore2python/tasks/commonClass.xml
index 83d7af8..a0d8bfb 100644
--- a/examples/org.eclipse.acceleo.module.example.ecore2python/tasks/commonClass.xml
+++ b/examples/org.eclipse.acceleo.module.example.ecore2python/tasks/commonClass.xml
@@ -20,6 +20,8 @@
<pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.ocl_1.2.0.v200806091438.jar"/>
<pathelement location="${ECLIPSE_HOME}/plugins/net.sourceforge.lpg.lpgjavaruntime_1.1.0.v200803061910.jar"/>
<pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.ocl.ecore_1.2.0.v200805130238.jar"/>
+ <pathelement location="${ECLIPSE_HOME}/workspace/org.eclipse.acceleo.model/bin"/>
+ <pathelement location="${ECLIPSE_HOME}/workspace/org.eclipse.acceleo.engine/bin"/>
</path>
<path id="org.eclipse.acceleo.module.example.ecore2python.classpath">
<path refid="org.eclipse.acceleo.module.example.ecore2python.libraryclasspath"/>
diff --git a/examples/org.eclipse.acceleo.module.example.ecore2python/tasks/factory.xml b/examples/org.eclipse.acceleo.module.example.ecore2python/tasks/factory.xml
index f61f230..5cf1f14 100644
--- a/examples/org.eclipse.acceleo.module.example.ecore2python/tasks/factory.xml
+++ b/examples/org.eclipse.acceleo.module.example.ecore2python/tasks/factory.xml
@@ -20,6 +20,8 @@
<pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.ocl_1.2.0.v200806091438.jar"/>
<pathelement location="${ECLIPSE_HOME}/plugins/net.sourceforge.lpg.lpgjavaruntime_1.1.0.v200803061910.jar"/>
<pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.ocl.ecore_1.2.0.v200805130238.jar"/>
+ <pathelement location="${ECLIPSE_HOME}/workspace/org.eclipse.acceleo.model/bin"/>
+ <pathelement location="${ECLIPSE_HOME}/workspace/org.eclipse.acceleo.engine/bin"/>
</path>
<path id="org.eclipse.acceleo.module.example.ecore2python.classpath">
<path refid="org.eclipse.acceleo.module.example.ecore2python.libraryclasspath"/>
diff --git a/examples/org.eclipse.acceleo.module.example.ecore2python/tasks/init.xml b/examples/org.eclipse.acceleo.module.example.ecore2python/tasks/init.xml
index 006e9c6..ff51f49 100644
--- a/examples/org.eclipse.acceleo.module.example.ecore2python/tasks/init.xml
+++ b/examples/org.eclipse.acceleo.module.example.ecore2python/tasks/init.xml
@@ -20,6 +20,8 @@
<pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.ocl_1.2.0.v200806091438.jar"/>
<pathelement location="${ECLIPSE_HOME}/plugins/net.sourceforge.lpg.lpgjavaruntime_1.1.0.v200803061910.jar"/>
<pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.ocl.ecore_1.2.0.v200805130238.jar"/>
+ <pathelement location="${ECLIPSE_HOME}/workspace/org.eclipse.acceleo.model/bin"/>
+ <pathelement location="${ECLIPSE_HOME}/workspace/org.eclipse.acceleo.engine/bin"/>
</path>
<path id="org.eclipse.acceleo.module.example.ecore2python.classpath">
<path refid="org.eclipse.acceleo.module.example.ecore2python.libraryclasspath"/>
diff --git a/examples/org.eclipse.acceleo.module.example.ecore2python/tasks/parser.xml b/examples/org.eclipse.acceleo.module.example.ecore2python/tasks/parser.xml
index 9025f90..a19b8b8 100644
--- a/examples/org.eclipse.acceleo.module.example.ecore2python/tasks/parser.xml
+++ b/examples/org.eclipse.acceleo.module.example.ecore2python/tasks/parser.xml
@@ -20,6 +20,8 @@
<pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.ocl_1.2.0.v200806091438.jar"/>
<pathelement location="${ECLIPSE_HOME}/plugins/net.sourceforge.lpg.lpgjavaruntime_1.1.0.v200803061910.jar"/>
<pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.ocl.ecore_1.2.0.v200805130238.jar"/>
+ <pathelement location="${ECLIPSE_HOME}/workspace/org.eclipse.acceleo.model/bin"/>
+ <pathelement location="${ECLIPSE_HOME}/workspace/org.eclipse.acceleo.engine/bin"/>
</path>
<path id="org.eclipse.acceleo.module.example.ecore2python.classpath">
<path refid="org.eclipse.acceleo.module.example.ecore2python.libraryclasspath"/>