org.eclipse.emf.common.util.BasicMonitor Java Examples
The following examples show how to use
org.eclipse.emf.common.util.BasicMonitor.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GenerateAll.java From eip-designer with Apache License 2.0 | 6 votes |
/** * Launches the generation. * * @param monitor * This will be used to display progress information to the user. * @throws IOException * Thrown when the output cannot be saved. * @generated */ public void doGenerate(IProgressMonitor monitor) throws IOException { if (!targetFolder.getLocation().toFile().exists()) { targetFolder.getLocation().toFile().mkdirs(); } // final URI template0 = getTemplateURI("com.github.lbroudoux.dsl.eip.gen.spring", new Path("/com/github/lbroudoux/dsl/eip/gen/spring/main/generateRoutes.emtl")); // com.github.lbroudoux.dsl.eip.gen.spring.main.GenerateRoutes gen0 = new com.github.lbroudoux.dsl.eip.gen.spring.main.GenerateRoutes(modelURI, targetFolder.getLocation().toFile(), arguments) { // protected URI createTemplateURI(String entry) { // return template0; // } //}; //gen0.doGenerate(BasicMonitor.toMonitor(monitor)); monitor.subTask("Loading..."); com.github.lbroudoux.dsl.eip.gen.spring.main.GenerateRoutes gen0 = new com.github.lbroudoux.dsl.eip.gen.spring.main.GenerateRoutes(modelURI, targetFolder.getLocation().toFile(), arguments); monitor.worked(1); String generationID = org.eclipse.acceleo.engine.utils.AcceleoLaunchingUtil.computeUIProjectID("com.github.lbroudoux.dsl.eip.gen.spring", "com.github.lbroudoux.dsl.eip.gen.spring.main.GenerateRoutes", modelURI.toString(), targetFolder.getFullPath().toString(), new ArrayList<String>()); gen0.setGenerationID(generationID); gen0.doGenerate(BasicMonitor.toMonitor(monitor)); }
Example #2
Source File: AbstractTemplatesTestSuite.java From M2Doc with Eclipse Public License 1.0 | 6 votes |
/** * Prepare the output with the given user content and generate to the given output. * * @param userContentURI * existing user content {@link URI} * @param outputURI * the output {@link URI} * @return the {@link GenerationResult} * @throws Exception * if the generation fails */ private GenerationResult prepareoutputAndGenerate(final URI userContentURI, URI outputURI) throws Exception { if (resourceSetForModels.getURIConverter().exists(userContentURI, Collections.EMPTY_MAP)) { copy(userContentURI, outputURI); } for (URI userContentLostURI : getUserContentLostURI(new File(testFolderPath))) { final URI destURI = URI.createURI( outputURI.toString() + userContentLostURI.lastSegment().substring( userContentLostURI.lastSegment().indexOf(USER_CONTENT_TAG) + USER_CONTENT_TAG.length()), false); copy(userContentLostURI, destURI); } final boolean updateFields = Boolean .valueOf(GenconfUtils.getOptions(generation).get(M2DocUtils.UPDATE_FIELDS_OPTION)); final GenerationResult generationResult = M2DocUtils.generate(documentTemplate, queryEnvironment, variables, resourceSetForModels, outputURI, updateFields, new BasicMonitor()); return generationResult; }
Example #3
Source File: GenerateAll.java From eip-designer with Apache License 2.0 | 6 votes |
/** * Launches the generation. * * @param monitor * This will be used to display progress information to the user. * @throws IOException * Thrown when the output cannot be saved. * @generated */ public void doGenerate(IProgressMonitor monitor) throws IOException { if (!targetFolder.getLocation().toFile().exists()) { targetFolder.getLocation().toFile().mkdirs(); } // final URI template0 = getTemplateURI("com.github.lbroudoux.dsl.eip.gen.switchyard", new Path("/com/github/lbroudoux/dsl/eip/gen/switchyard/main/generateSwitchyard.emtl")); // com.github.lbroudoux.dsl.eip.gen.switchyard.main.GenerateSwitchyard gen0 = new com.github.lbroudoux.dsl.eip.gen.switchyard.main.GenerateSwitchyard(modelURI, targetFolder.getLocation().toFile(), arguments) { // protected URI createTemplateURI(String entry) { // return template0; // } //}; //gen0.doGenerate(BasicMonitor.toMonitor(monitor)); monitor.subTask("Loading..."); com.github.lbroudoux.dsl.eip.gen.switchyard.main.GenerateSwitchyard gen0 = new com.github.lbroudoux.dsl.eip.gen.switchyard.main.GenerateSwitchyard(modelURI, targetFolder.getLocation().toFile(), arguments); monitor.worked(1); String generationID = org.eclipse.acceleo.engine.utils.AcceleoLaunchingUtil.computeUIProjectID("com.github.lbroudoux.dsl.eip.gen.switchyard", "com.github.lbroudoux.dsl.eip.gen.switchyard.main.GenerateSwitchyard", modelURI.toString(), targetFolder.getFullPath().toString(), new ArrayList<String>()); gen0.setGenerationID(generationID); gen0.doGenerate(BasicMonitor.toMonitor(monitor)); }
Example #4
Source File: M2DocValidatorTests.java From M2Doc with Eclipse Public License 1.0 | 6 votes |
@Test public void tableRowCellTemplate() { IQueryEnvironment queryEnvironment = Query.newEnvironmentWithDefaultServices(null); final IQueryBuilderEngine engine = QueryParsing.newBuilder(queryEnvironment); final org.obeonetwork.m2doc.template.Query query = TemplatePackage.eINSTANCE.getTemplateFactory().createQuery(); query.setQuery(engine.build("self")); final Block body = TemplatePackage.eINSTANCE.getTemplateFactory().createBlock(); final Table table = TemplatePackage.eINSTANCE.getTemplateFactory().createTable(); body.getStatements().add(table); final Row row = TemplatePackage.eINSTANCE.getTemplateFactory().createRow(); table.getRows().add(row); final Cell cell = TemplatePackage.eINSTANCE.getTemplateFactory().createCell(); row.getCells().add(cell); final Block cellBody = TemplatePackage.eINSTANCE.getTemplateFactory().createBlock(); cellBody.getStatements().add(query); cell.setBody(cellBody); @SuppressWarnings("resource") final DocumentTemplate documentTemplate = M2DocTestUtils.createDocumentTemplate(body); final M2DocValidator validator = new M2DocValidator(); validator.validate(documentTemplate, queryEnvironment, new BasicMonitor()); assertEquals(1, query.getValidationMessages().size()); assertTemplateValidationMessage(query.getValidationMessages().get(0), ValidationMessageLevel.ERROR, "Couldn't find the 'self' variable", query.getStyleRun()); }
Example #5
Source File: DataObjectGenerator.java From BIMserver with GNU Affero General Public License v3.0 | 5 votes |
public VirtualFile generate(VirtualFile basedir) throws DatabaseException { GenModel genModel = GenModelFactory.eINSTANCE.createGenModel(); genModel.setRuntimeVersion(GenRuntimeVersion.EMF25); genModel.setComplianceLevel(GenJDKLevel.JDK60_LITERAL); genModel.setFeatureDelegation(GenDelegationKind.REFLECTIVE_LITERAL); genModel.setRootExtendsClass("org.bimserver.emf.IdEObjectImpl"); genModel.setRootExtendsInterface("org.bimserver.emf.IdEObject"); genModel.setSuppressContainment(true); genModel.setCodeFormatting(true); genModel.setCopyrightText(StringUtils.readFromFile(new File("copyright.txt"))); genModel.setCanGenerate(true); genModel.setModelDirectory("test"); genModel.setModelName("model name"); genModel.setForceOverwrite(true); genModel.setSuppressNotification(false); genModel.setContainmentProxies(false); genModel.setBinaryCompatibleReflectiveMethods(false); genModel.setPublicConstructors(false); genModel.setMinimalReflectiveMethods(true); // More code, but faster genModel.setUpdateClasspath(false); genModel.initialize(schema.getEPackages()); GeneratorAdapterFactory.Descriptor.Registry.INSTANCE.addDescriptor(GenModelPackage.eNS_URI, GenModelGeneratorAdapterFactory.DESCRIPTOR); Generator generator = new Generator(); generator.setInput(genModel); generator.generate(genModel, GenBaseGeneratorAdapter.MODEL_PROJECT_TYPE, new BasicMonitor.Printing(System.out)); // List<GenPackage> genPackages = createGenPackages(genModel, basedir); // generatePackages(genModel, genPackages, basedir); return basedir; }
Example #6
Source File: AbstractTemplatesTestSuite.java From M2Doc with Eclipse Public License 1.0 | 5 votes |
/** * Tests the parsing by comparing the validated template. * * @throws IOException * if the validation template can't be generated * @throws DocumentGenerationException * if the validation template can't be generated */ @Test public void validation() throws IOException, DocumentGenerationException { final ValidationMessageLevel validationLevel = M2DocUtils.validate(documentTemplate, queryEnvironment, new BasicMonitor()); final URI expectedValidationURI = getExpectedValidatedURI(new File(testFolderPath)); final URI outputURI; if (resourceSetForModels.getURIConverter().exists(expectedValidationURI, Collections.EMPTY_MAP)) { outputURI = getValidationOutputURI(testFolderPath); if (validationLevel != ValidationMessageLevel.OK) { M2DocUtils.serializeValidatedDocumentTemplate(resourceSetForModels.getURIConverter(), documentTemplate, outputURI); } } else { outputURI = getActualValidatedURI(new File(testFolderPath)); if (validationLevel != ValidationMessageLevel.OK) { M2DocUtils.serializeValidatedDocumentTemplate(resourceSetForModels.getURIConverter(), documentTemplate, outputURI); } else { touch(outputURI); } fail(expectedValidationURI + DOESN_T_EXIST); } if (!isEmpty(outputURI)) { M2DocTestUtils.assertDocx(resourceSetForModels.getURIConverter(), expectedValidationURI, outputURI); } else { assertEquals(ValidationMessageLevel.OK, validationLevel); assertTrue(resourceSetForModels.getURIConverter().exists(expectedValidationURI, Collections.EMPTY_MAP)); assertTrue(isEmpty(expectedValidationURI)); } resourceSetForModels.getURIConverter().delete(outputURI, Collections.EMPTY_MAP); }
Example #7
Source File: AbstractTemplatesTestSuite.java From M2Doc with Eclipse Public License 1.0 | 5 votes |
/** * Constructor. * * @param testFolder * the test folder path * @throws IOException * if the tested template can't be read * @throws DocumentParserException * if the tested template can't be parsed */ public AbstractTemplatesTestSuite(String testFolder) throws IOException, DocumentParserException { MyDslPackage.eINSTANCE.getName();// make sure MyDsl is loaded (XText) UMLPackage.eINSTANCE.getName(); // make sure UML2 is loaded this.testFolderPath = testFolder.replaceAll("\\\\", "/"); final URI genconfURI = getGenconfURI(new File(testFolderPath)); if (URIConverter.INSTANCE.exists(genconfURI, Collections.EMPTY_MAP)) { final ResourceSet rs = getResourceSetForGenconf(); generation = getGeneration(genconfURI, rs); } else { generation = GenconfFactory.eINSTANCE.createGeneration(); Resource r = new XMIResourceImpl(genconfURI); r.getContents().add(generation); } final URI templateURI = getTemplateURI(new File(testFolderPath)); setTemplateFileName(generation, URI.decode(templateURI.deresolve(genconfURI).toString())); final List<Exception> exceptions = new ArrayList<>(); resourceSetForModels = getResourceSetForModel(exceptions); queryEnvironment = GenconfUtils.getQueryEnvironment(resourceSetForModels, generation); new MyDslStandaloneSetup().createInjectorAndDoEMFRegistration(); documentTemplate = M2DocUtils.parse(resourceSetForModels.getURIConverter(), templateURI, queryEnvironment, new ClassProvider(this.getClass().getClassLoader()), new BasicMonitor()); for (Exception e : exceptions) { final XWPFRun run = M2DocUtils.getOrCreateFirstRun(documentTemplate.getDocument()); documentTemplate.getBody().getValidationMessages() .add(new TemplateValidationMessage(ValidationMessageLevel.ERROR, e.getMessage(), run)); } variables = GenconfUtils.getVariables(generation, resourceSetForModels); }
Example #8
Source File: TemplateValidationGeneratorTests.java From M2Doc with Eclipse Public License 1.0 | 5 votes |
/** * Ensure that the validation generation produces a document with an error. * * @throws InvalidFormatException * @throws IOException * @throws DocumentParserException * @throws DocumentGenerationException */ @Test public void testErrorGeneration() throws InvalidFormatException, IOException, DocumentParserException, DocumentGenerationException { IQueryEnvironment queryEnvironment = org.eclipse.acceleo.query.runtime.Query .newEnvironmentWithDefaultServices(null); final File tempFile = File.createTempFile("testParsingErrorSimpleTag", ".docx"); try (DocumentTemplate documentTemplate = M2DocUtils.parse(URIConverter.INSTANCE, URI.createFileURI("resources/document/notEmpty/notEmpty-template.docx"), queryEnvironment, new ClassProvider(this.getClass().getClassLoader()), new BasicMonitor())) { final XWPFRun location = ((XWPFParagraph) documentTemplate.getDocument().getBodyElements().get(0)).getRuns() .get(0); documentTemplate.getBody().getValidationMessages().add( new TemplateValidationMessage(ValidationMessageLevel.ERROR, "XXXXXXXXXXXXXXXXXXXXXXXX", location)); M2DocUtils.serializeValidatedDocumentTemplate(URIConverter.INSTANCE, documentTemplate, URI.createFileURI(tempFile.getAbsolutePath())); } assertTrue(new File(tempFile.getAbsolutePath()).exists()); try (FileInputStream resIs = new FileInputStream(tempFile.getAbsolutePath()); OPCPackage resOPackage = OPCPackage.open(resIs); XWPFDocument resDocument = new XWPFDocument(resOPackage);) { final XWPFRun messageRun = M2DocTestUtils.getRunContaining(resDocument, "XXXXXXXXXXXXXXXXXXXXXXXX"); assertNotNull(messageRun); assertEquals("XXXXXXXXXXXXXXXXXXXXXXXX", messageRun.text()); assertEquals("FF0000", messageRun.getColor()); } tempFile.delete(); }
Example #9
Source File: TemplateValidationGeneratorTests.java From M2Doc with Eclipse Public License 1.0 | 5 votes |
/** * Ensure that the validation generation produces a document with an warning. * * @throws InvalidFormatException * @throws IOException * @throws DocumentParserException * @throws DocumentGenerationException */ @Test public void testWarningGeneration() throws InvalidFormatException, IOException, DocumentParserException, DocumentGenerationException { IQueryEnvironment queryEnvironment = org.eclipse.acceleo.query.runtime.Query .newEnvironmentWithDefaultServices(null); final File tempFile = File.createTempFile("testParsingErrorSimpleTag", ".docx"); try (DocumentTemplate documentTemplate = M2DocUtils.parse(URIConverter.INSTANCE, URI.createFileURI("resources/document/notEmpty/notEmpty-template.docx"), queryEnvironment, new ClassProvider(this.getClass().getClassLoader()), new BasicMonitor())) { final XWPFRun location = ((XWPFParagraph) documentTemplate.getDocument().getBodyElements().get(0)).getRuns() .get(0); documentTemplate.getBody().getValidationMessages().add(new TemplateValidationMessage( ValidationMessageLevel.WARNING, "XXXXXXXXXXXXXXXXXXXXXXXX", location)); M2DocUtils.serializeValidatedDocumentTemplate(URIConverter.INSTANCE, documentTemplate, URI.createFileURI(tempFile.getAbsolutePath())); } assertTrue(new File(tempFile.getAbsolutePath()).exists()); try (FileInputStream resIs = new FileInputStream(tempFile.getAbsolutePath()); OPCPackage resOPackage = OPCPackage.open(resIs); XWPFDocument resDocument = new XWPFDocument(resOPackage);) { final XWPFRun messageRun = M2DocTestUtils.getRunContaining(resDocument, "XXXXXXXXXXXXXXXXXXXXXXXX"); assertNotNull(messageRun); assertEquals("XXXXXXXXXXXXXXXXXXXXXXXX", messageRun.text()); assertEquals("FFA500", messageRun.getColor()); } tempFile.delete(); }
Example #10
Source File: TemplateValidationGeneratorTests.java From M2Doc with Eclipse Public License 1.0 | 5 votes |
/** * Ensure that the validation generation produces a document with an info. * * @throws InvalidFormatException * @throws IOException * @throws DocumentParserException * @throws DocumentGenerationException */ @Test public void testInfoGeneration() throws InvalidFormatException, IOException, DocumentParserException, DocumentGenerationException { IQueryEnvironment queryEnvironment = org.eclipse.acceleo.query.runtime.Query .newEnvironmentWithDefaultServices(null); final File tempFile = File.createTempFile("testParsingErrorSimpleTag", ".docx"); try (DocumentTemplate documentTemplate = M2DocUtils.parse(URIConverter.INSTANCE, URI.createFileURI("resources/document/notEmpty/notEmpty-template.docx"), queryEnvironment, new ClassProvider(this.getClass().getClassLoader()), new BasicMonitor())) { final XWPFRun location = ((XWPFParagraph) documentTemplate.getDocument().getBodyElements().get(0)).getRuns() .get(0); documentTemplate.getBody().getValidationMessages().add( new TemplateValidationMessage(ValidationMessageLevel.INFO, "XXXXXXXXXXXXXXXXXXXXXXXX", location)); M2DocUtils.serializeValidatedDocumentTemplate(URIConverter.INSTANCE, documentTemplate, URI.createFileURI(tempFile.getAbsolutePath())); } assertTrue(new File(tempFile.getAbsolutePath()).exists()); try (FileInputStream resIs = new FileInputStream(tempFile.getAbsolutePath()); OPCPackage resOPackage = OPCPackage.open(resIs); XWPFDocument resDocument = new XWPFDocument(resOPackage);) { final XWPFRun messageRun = M2DocTestUtils.getRunContaining(resDocument, "XXXXXXXXXXXXXXXXXXXXXXXX"); assertNotNull(messageRun); assertEquals("XXXXXXXXXXXXXXXXXXXXXXXX", messageRun.text()); assertEquals("0000FF", messageRun.getColor()); } tempFile.delete(); }
Example #11
Source File: M2DocValidatorTests.java From M2Doc with Eclipse Public License 1.0 | 5 votes |
public void conditionalInferedTypeInElse() throws IOException { IQueryEnvironment queryEnvironment = Query.newEnvironmentWithDefaultServices(null); final IQueryBuilderEngine engine = QueryParsing.newBuilder(queryEnvironment); final Conditional conditional = TemplatePackage.eINSTANCE.getTemplateFactory().createConditional(); conditional.setCondition(engine.build("self.oclIsKindOf(ecore::EClassifier)")); final Block thenCompound = TemplatePackage.eINSTANCE.getTemplateFactory().createBlock(); conditional.setThen(thenCompound); final Conditional alternative = TemplatePackage.eINSTANCE.getTemplateFactory().createConditional(); alternative.setCondition(engine.build("self.oclIsKindOf(ecore::EPackage)")); final Block alternativeThenCompound = TemplatePackage.eINSTANCE.getTemplateFactory().createBlock(); alternative.setThen(alternativeThenCompound); final Block elseCompound = TemplatePackage.eINSTANCE.getTemplateFactory().createBlock(); elseCompound.getStatements().add(alternative); conditional.setElse(elseCompound); final Block body = TemplatePackage.eINSTANCE.getTemplateFactory().createBlock(); body.getStatements().add(conditional); try (final DocumentTemplate documentTemplate = M2DocTestUtils.createDocumentTemplate(body);) { final M2DocValidator validator = new M2DocValidator(); final Map<String, Set<IType>> types = new HashMap<>(); final Set<IType> selfTypes = new LinkedHashSet<>(); types.put("self", selfTypes); selfTypes.add(new EClassifierType(queryEnvironment, EcorePackage.eINSTANCE.getEClassifier())); selfTypes.add(new EClassifierType(queryEnvironment, EcorePackage.eINSTANCE.getEPackage())); validator.validate(documentTemplate, queryEnvironment, new BasicMonitor()); assertEquals(0, conditional.getValidationMessages().size()); assertEquals(1, alternative.getValidationMessages().size()); assertTemplateValidationMessage(alternative.getValidationMessages().get(0), ValidationMessageLevel.INFO, "Always true:\nNothing inferred when self (EClassifier=EPackage) is not kind of EClassifierLiteral=EPackage", alternative.getRuns().get(1)); } }
Example #12
Source File: GenerateAll.java From neoscada with Eclipse Public License 1.0 | 5 votes |
/** * Launches the generation. * * @param monitor * This will be used to display progress information to the user. * @generated NOT */ @SuppressWarnings ( "unchecked" ) public void doGenerate ( final IProgressMonitor monitor ) throws Exception { if ( !this.targetFolder.getLocation ().toFile ().exists () ) { this.targetFolder.getLocation ().toFile ().mkdirs (); } // final URI template0 = getTemplateURI("org.eclipse.scada.protocol.ngp.generator", new Path("/org/eclipse/scada/protocol/ngp/generator/main/generate.emtl")); // org.eclipse.scada.protocol.ngp.generator.main.Generate gen0 = new org.eclipse.scada.protocol.ngp.generator.main.Generate(modelURI, targetFolder.getLocation().toFile(), arguments) { // protected URI createTemplateURI(String entry) { // return template0; // } //}; //gen0.doGenerate(BasicMonitor.toMonitor(monitor)); monitor.subTask ( "Loading..." ); final Class<? extends AbstractAcceleoGenerator> clazz = (Class<? extends AbstractAcceleoGenerator>)Activator.getDefault ().getBundle ().loadClass ( this.main ); final Constructor<? extends AbstractAcceleoGenerator> ctor = clazz.getConstructor ( URI.class, File.class, List.class ); final AbstractAcceleoGenerator gen0 = ctor.newInstance ( this.modelURI, this.targetFolder.getLocation ().toFile (), this.arguments ); // final AbstractAcceleoGenerator gen0 = new org.eclipse.scada.protocol.ngp.generator.main.Generate ( this.modelURI, this.targetFolder.getLocation ().toFile (), this.arguments ); monitor.worked ( 1 ); final String generationID = org.eclipse.acceleo.engine.utils.AcceleoLaunchingUtil.computeUIProjectID ( "org.eclipse.scada.protocol.ngp.generator", this.main, this.modelURI.toString (), this.targetFolder.getFullPath ().toString (), new ArrayList<String> () ); gen0.setGenerationID ( generationID ); gen0.doGenerate ( BasicMonitor.toMonitor ( monitor ) ); }
Example #13
Source File: GenerateXml.java From eip-designer with Apache License 2.0 | 4 votes |
/** * Launches the generation. * * @param monitor * This will be used to display progress information to the user. * @throws IOException * Thrown when the output cannot be saved. * @generated */ public void doGenerate(IProgressMonitor monitor) throws IOException { if (!targetFolder.getLocation().toFile().exists()) { targetFolder.getLocation().toFile().mkdirs(); } // final URI template0 = getTemplateURI("com.github.lbroudoux.dsl.eip.gen.camel", new Path("/com/github/lbroudoux/dsl/eip/gen/camel/main/generateJavaRoutes.emtl")); // com.github.lbroudoux.dsl.eip.gen.camel.main.GenerateJavaRoutes gen0 = new com.github.lbroudoux.dsl.eip.gen.camel.main.GenerateJavaRoutes(modelURI, targetFolder.getLocation().toFile(), arguments) { // protected URI createTemplateURI(String entry) { // return template0; // } //}; //gen0.doGenerate(BasicMonitor.toMonitor(monitor)); monitor.subTask("Loading..."); com.github.lbroudoux.dsl.eip.gen.camel.main.GenerateXmlRoutes gen0 = new com.github.lbroudoux.dsl.eip.gen.camel.main.GenerateXmlRoutes(modelURI, targetFolder.getLocation().toFile(), arguments); monitor.worked(1); String generationID = org.eclipse.acceleo.engine.utils.AcceleoLaunchingUtil.computeUIProjectID("com.github.lbroudoux.dsl.eip.gen.camel", "com.github.lbroudoux.dsl.eip.gen.camel.main.GenerateJavaRoutes", modelURI.toString(), targetFolder.getFullPath().toString(), new ArrayList<String>()); gen0.setGenerationID(generationID); gen0.doGenerate(BasicMonitor.toMonitor(monitor)); // EObject model = gen0.getModel(); // if (model != null) { //final URI template1 = getTemplateURI("com.github.lbroudoux.dsl.eip.gen.camel", new Path("/com/github/lbroudoux/dsl/eip/gen/camel/main/generateXmlRoutes.emtl")); //com.github.lbroudoux.dsl.eip.gen.camel.main.GenerateXmlRoutes gen1 = new com.github.lbroudoux.dsl.eip.gen.camel.main.GenerateXmlRoutes(model, targetFolder.getLocation().toFile(), arguments) { // protected URI createTemplateURI(String entry) { // return template1; // } //}; //gen1.doGenerate(BasicMonitor.toMonitor(monitor)); // monitor.subTask("Loading..."); // com.github.lbroudoux.dsl.eip.gen.camel.main.GenerateXmlRoutes gen1 = new com.github.lbroudoux.dsl.eip.gen.camel.main.GenerateXmlRoutes(model, targetFolder.getLocation().toFile(), arguments); // monitor.worked(1); // generationID = org.eclipse.acceleo.engine.utils.AcceleoLaunchingUtil.computeUIProjectID("com.github.lbroudoux.dsl.eip.gen.camel", "com.github.lbroudoux.dsl.eip.gen.camel.main.GenerateXmlRoutes", modelURI.toString(), targetFolder.getFullPath().toString(), new ArrayList<String>()); // gen1.setGenerationID(generationID); // gen1.doGenerate(BasicMonitor.toMonitor(monitor)); // } }
Example #14
Source File: GenerateSwitchyard.java From eip-designer with Apache License 2.0 | 4 votes |
/** * This can be used to launch the generation from a standalone application. * * @param args * Arguments of the generation. * @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>(); /* * If you want to change the content of this method, do NOT forget to change the "@generated" * tag in the Javadoc of this method to "@generated NOT". Without this new tag, any compilation * of the Acceleo module with the main template that has caused the creation of this class will * revert your modifications. */ /* * Add in this list all the arguments used by the starting point of the generation * If your main template is called on an element of your model and a String, you can * add in "arguments" this "String" attribute. */ GenerateSwitchyard generator = new GenerateSwitchyard(modelURI, folder, arguments); /* * Add the properties from the launch arguments. * If you want to programmatically add new properties, add them in "propertiesFiles" * You can add the absolute path of a properties files, or even a project relative path. * If you want to add another "protocol" for your properties files, please override * "getPropertiesLoaderService(AcceleoService)" in order to return a new property loader. * The behavior of the properties loader service is explained in the Acceleo documentation * (Help -> Help Contents). */ for (int i = 2; i < args.length; i++) { generator.addPropertiesFile(args[i]); } generator.doGenerate(new BasicMonitor()); } } catch (IOException e) { e.printStackTrace(); } }
Example #15
Source File: GenerateRoutes.java From eip-designer with Apache License 2.0 | 4 votes |
/** * This can be used to launch the generation from a standalone application. * * @param args * Arguments of the generation. * @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>(); /* * If you want to change the content of this method, do NOT forget to change the "@generated" * tag in the Javadoc of this method to "@generated NOT". Without this new tag, any compilation * of the Acceleo module with the main template that has caused the creation of this class will * revert your modifications. */ /* * Add in this list all the arguments used by the starting point of the generation * If your main template is called on an element of your model and a String, you can * add in "arguments" this "String" attribute. */ GenerateRoutes generator = new GenerateRoutes(modelURI, folder, arguments); /* * Add the properties from the launch arguments. * If you want to programmatically add new properties, add them in "propertiesFiles" * You can add the absolute path of a properties files, or even a project relative path. * If you want to add another "protocol" for your properties files, please override * "getPropertiesLoaderService(AcceleoService)" in order to return a new property loader. * The behavior of the properties loader service is explained in the Acceleo documentation * (Help -> Help Contents). */ for (int i = 2; i < args.length; i++) { generator.addPropertiesFile(args[i]); } generator.doGenerate(new BasicMonitor()); } } catch (IOException e) { e.printStackTrace(); } }
Example #16
Source File: GenerateJava.java From eip-designer with Apache License 2.0 | 4 votes |
/** * Launches the generation. * * @param monitor * This will be used to display progress information to the user. * @throws IOException * Thrown when the output cannot be saved. * @generated */ public void doGenerate(IProgressMonitor monitor) throws IOException { if (!targetFolder.getLocation().toFile().exists()) { targetFolder.getLocation().toFile().mkdirs(); } // final URI template0 = getTemplateURI("com.github.lbroudoux.dsl.eip.gen.camel", new Path("/com/github/lbroudoux/dsl/eip/gen/camel/main/generateJavaRoutes.emtl")); // com.github.lbroudoux.dsl.eip.gen.camel.main.GenerateJavaRoutes gen0 = new com.github.lbroudoux.dsl.eip.gen.camel.main.GenerateJavaRoutes(modelURI, targetFolder.getLocation().toFile(), arguments) { // protected URI createTemplateURI(String entry) { // return template0; // } //}; //gen0.doGenerate(BasicMonitor.toMonitor(monitor)); monitor.subTask("Loading..."); com.github.lbroudoux.dsl.eip.gen.camel.main.GenerateJavaRoutes gen0 = new com.github.lbroudoux.dsl.eip.gen.camel.main.GenerateJavaRoutes(modelURI, targetFolder.getLocation().toFile(), arguments); monitor.worked(1); String generationID = org.eclipse.acceleo.engine.utils.AcceleoLaunchingUtil.computeUIProjectID("com.github.lbroudoux.dsl.eip.gen.camel", "com.github.lbroudoux.dsl.eip.gen.camel.main.GenerateJavaRoutes", modelURI.toString(), targetFolder.getFullPath().toString(), new ArrayList<String>()); gen0.setGenerationID(generationID); gen0.doGenerate(BasicMonitor.toMonitor(monitor)); // EObject model = gen0.getModel(); // if (model != null) { //final URI template1 = getTemplateURI("com.github.lbroudoux.dsl.eip.gen.camel", new Path("/com/github/lbroudoux/dsl/eip/gen/camel/main/generateXmlRoutes.emtl")); //com.github.lbroudoux.dsl.eip.gen.camel.main.GenerateXmlRoutes gen1 = new com.github.lbroudoux.dsl.eip.gen.camel.main.GenerateXmlRoutes(model, targetFolder.getLocation().toFile(), arguments) { // protected URI createTemplateURI(String entry) { // return template1; // } //}; //gen1.doGenerate(BasicMonitor.toMonitor(monitor)); // monitor.subTask("Loading..."); // com.github.lbroudoux.dsl.eip.gen.camel.main.GenerateXmlRoutes gen1 = new com.github.lbroudoux.dsl.eip.gen.camel.main.GenerateXmlRoutes(model, targetFolder.getLocation().toFile(), arguments); // monitor.worked(1); // generationID = org.eclipse.acceleo.engine.utils.AcceleoLaunchingUtil.computeUIProjectID("com.github.lbroudoux.dsl.eip.gen.camel", "com.github.lbroudoux.dsl.eip.gen.camel.main.GenerateXmlRoutes", modelURI.toString(), targetFolder.getFullPath().toString(), new ArrayList<String>()); // gen1.setGenerationID(generationID); // gen1.doGenerate(BasicMonitor.toMonitor(monitor)); // } }
Example #17
Source File: GenerateJavaRoutes.java From eip-designer with Apache License 2.0 | 4 votes |
/** * This can be used to launch the generation from a standalone application. * * @param args * Arguments of the generation. * @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>(); /* * If you want to change the content of this method, do NOT forget to change the "@generated" * tag in the Javadoc of this method to "@generated NOT". Without this new tag, any compilation * of the Acceleo module with the main template that has caused the creation of this class will * revert your modifications. */ /* * Add in this list all the arguments used by the starting point of the generation * If your main template is called on an element of your model and a String, you can * add in "arguments" this "String" attribute. */ GenerateJavaRoutes generator = new GenerateJavaRoutes(modelURI, folder, arguments); /* * Add the properties from the launch arguments. * If you want to programmatically add new properties, add them in "propertiesFiles" * You can add the absolute path of a properties files, or even a project relative path. * If you want to add another "protocol" for your properties files, please override * "getPropertiesLoaderService(AcceleoService)" in order to return a new property loader. * The behavior of the properties loader service is explained in the Acceleo documentation * (Help -> Help Contents). */ for (int i = 2; i < args.length; i++) { generator.addPropertiesFile(args[i]); } generator.doGenerate(new BasicMonitor()); } } catch (IOException e) { e.printStackTrace(); } }
Example #18
Source File: GenerateXmlRoutes.java From eip-designer with Apache License 2.0 | 4 votes |
/** * This can be used to launch the generation from a standalone application. * * @param args * Arguments of the generation. * @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>(); /* * If you want to change the content of this method, do NOT forget to change the "@generated" * tag in the Javadoc of this method to "@generated NOT". Without this new tag, any compilation * of the Acceleo module with the main template that has caused the creation of this class will * revert your modifications. */ /* * Add in this list all the arguments used by the starting point of the generation * If your main template is called on an element of your model and a String, you can * add in "arguments" this "String" attribute. */ GenerateXmlRoutes generator = new GenerateXmlRoutes(modelURI, folder, arguments); /* * Add the properties from the launch arguments. * If you want to programmatically add new properties, add them in "propertiesFiles" * You can add the absolute path of a properties files, or even a project relative path. * If you want to add another "protocol" for your properties files, please override * "getPropertiesLoaderService(AcceleoService)" in order to return a new property loader. * The behavior of the properties loader service is explained in the Acceleo documentation * (Help -> Help Contents). */ for (int i = 2; i < args.length; i++) { generator.addPropertiesFile(args[i]); } generator.doGenerate(new BasicMonitor()); } } catch (IOException e) { e.printStackTrace(); } }
Example #19
Source File: GenerateMixConfig.java From uml2solidity with Eclipse Public License 1.0 | 4 votes |
/** * This can be used to launch the generation from a standalone application. * * @param args * Arguments of the generation. * @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>(); /* * If you want to change the content of this method, do NOT forget to change the "@generated" * tag in the Javadoc of this method to "@generated NOT". Without this new tag, any compilation * of the Acceleo module with the main template that has caused the creation of this class will * revert your modifications. */ /* * Add in this list all the arguments used by the starting point of the generation * If your main template is called on an element of your model and a String, you can * add in "arguments" this "String" attribute. */ GenerateMixConfig generator = new GenerateMixConfig(modelURI, folder, arguments); /* * Add the properties from the launch arguments. * If you want to programmatically add new properties, add them in "propertiesFiles" * You can add the absolute path of a properties files, or even a project relative path. * If you want to add another "protocol" for your properties files, please override * "getPropertiesLoaderService(AcceleoService)" in order to return a new property loader. * The behavior of the properties loader service is explained in the Acceleo documentation * (Help -> Help Contents). */ for (int i = 2; i < args.length; i++) { generator.addPropertiesFile(args[i]); } generator.doGenerate(new BasicMonitor()); } } catch (IOException e) { e.printStackTrace(); } }
Example #20
Source File: CustomClassEcoreGeneratorFragment.java From dsl-devkit with Eclipse Public License 1.0 | 4 votes |
@Override protected void doGenerate(final GenModel genModel) { if (LOGGER.isInfoEnabled()) { LOGGER.info("generating EMF code for " + genModel.eResource().getURI()); //$NON-NLS-1$ } Generator generator = new Generator() { @Override public JControlModel getJControlModel() { return new JControlModel() { @Override public boolean canMerge() { return false; } }; } }; genModel.setNonNLSMarkers(generateNonNLSMarkers); generator.getAdapterFactoryDescriptorRegistry().addDescriptor(GenModelPackage.eNS_URI, new GeneratorAdapterDescriptor(loggedTypeMappings, getTypeMapper())); generator.setInput(genModel); Diagnostic diagnostic = generator.generate(genModel, GenBaseGeneratorAdapter.MODEL_PROJECT_TYPE, new BasicMonitor()); if (diagnostic.getSeverity() != Diagnostic.OK) { LOGGER.info(diagnostic); } if (isGenerateEdit()) { Diagnostic editDiag = generator.generate(genModel, GenBaseGeneratorAdapter.EDIT_PROJECT_TYPE, new BasicMonitor()); if (editDiag.getSeverity() != Diagnostic.OK) { LOGGER.info(editDiag); } } if (isGenerateEditor()) { Diagnostic editorDiag = generator.generate(genModel, GenBaseGeneratorAdapter.EDITOR_PROJECT_TYPE, new BasicMonitor()); if (editorDiag.getSeverity() != Diagnostic.OK) { LOGGER.info(editorDiag); } } }
Example #21
Source File: EMFGeneratorFragment2.java From xtext-core with Eclipse Public License 2.0 | 4 votes |
protected void doGenerate(final GenModel genModel) { final Generator generator = new Generator() { @Override public JControlModel getJControlModel() { if ((this.jControlModel == null)) { JControlModel _jControlModel = new JControlModel(); this.jControlModel = _jControlModel; this.jControlModel.initialize(null, this.options.mergeRulesURI); } return this.jControlModel; } }; GeneratorAdapterFactory.Descriptor.Registry _adapterFactoryDescriptorRegistry = generator.getAdapterFactoryDescriptorRegistry(); String _lineDelimiter = this.codeConfig.getLineDelimiter(); CvsIdFilteringGeneratorAdapterFactoryDescriptor _cvsIdFilteringGeneratorAdapterFactoryDescriptor = new CvsIdFilteringGeneratorAdapterFactoryDescriptor(_lineDelimiter); _adapterFactoryDescriptorRegistry.addDescriptor(GenModelPackage.eNS_URI, _cvsIdFilteringGeneratorAdapterFactoryDescriptor); genModel.setCanGenerate(true); generator.setInput(genModel); BasicMonitor _basicMonitor = new BasicMonitor(); final Diagnostic diagnostic = generator.generate(genModel, GenBaseGeneratorAdapter.MODEL_PROJECT_TYPE, _basicMonitor); int _severity = diagnostic.getSeverity(); boolean _notEquals = (_severity != Diagnostic.OK); if (_notEquals) { EMFGeneratorFragment2.LOG.warn(diagnostic); } if (this.generateEdit) { BasicMonitor _basicMonitor_1 = new BasicMonitor(); final Diagnostic editDiag = generator.generate(genModel, GenBaseGeneratorAdapter.EDIT_PROJECT_TYPE, _basicMonitor_1); int _severity_1 = editDiag.getSeverity(); boolean _notEquals_1 = (_severity_1 != Diagnostic.OK); if (_notEquals_1) { EMFGeneratorFragment2.LOG.warn(editDiag); } } if (this.generateEditor) { BasicMonitor _basicMonitor_2 = new BasicMonitor(); final Diagnostic editorDiag = generator.generate(genModel, GenBaseGeneratorAdapter.EDITOR_PROJECT_TYPE, _basicMonitor_2); int _severity_2 = editorDiag.getSeverity(); boolean _notEquals_2 = (_severity_2 != Diagnostic.OK); if (_notEquals_2) { EMFGeneratorFragment2.LOG.warn(editorDiag); } } }
Example #22
Source File: GenerateContractBeans.java From uml2solidity with Eclipse Public License 1.0 | 4 votes |
/** * This can be used to launch the generation from a standalone application. * * @param args * Arguments of the generation. * @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>(); /* * If you want to change the content of this method, do NOT forget to change the "@generated" * tag in the Javadoc of this method to "@generated NOT". Without this new tag, any compilation * of the Acceleo module with the main template that has caused the creation of this class will * revert your modifications. */ /* * Add in this list all the arguments used by the starting point of the generation * If your main template is called on an element of your model and a String, you can * add in "arguments" this "String" attribute. */ GenerateContractBeans generator = new GenerateContractBeans(modelURI, folder, arguments); /* * Add the properties from the launch arguments. * If you want to programmatically add new properties, add them in "propertiesFiles" * You can add the absolute path of a properties files, or even a project relative path. * If you want to add another "protocol" for your properties files, please override * "getPropertiesLoaderService(AcceleoService)" in order to return a new property loader. * The behavior of the properties loader service is explained in the Acceleo documentation * (Help -> Help Contents). */ for (int i = 2; i < args.length; i++) { generator.addPropertiesFile(args[i]); } generator.doGenerate(new BasicMonitor()); } } catch (IOException e) { e.printStackTrace(); } }
Example #23
Source File: GenerateTaglibs.java From uml2solidity with Eclipse Public License 1.0 | 4 votes |
/** * This can be used to launch the generation from a standalone application. * * @param args * Arguments of the generation. * @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>(); /* * If you want to change the content of this method, do NOT forget to change the "@generated" * tag in the Javadoc of this method to "@generated NOT". Without this new tag, any compilation * of the Acceleo module with the main template that has caused the creation of this class will * revert your modifications. */ /* * Add in this list all the arguments used by the starting point of the generation * If your main template is called on an element of your model and a String, you can * add in "arguments" this "String" attribute. */ GenerateTaglibs generator = new GenerateTaglibs(modelURI, folder, arguments); /* * Add the properties from the launch arguments. * If you want to programmatically add new properties, add them in "propertiesFiles" * You can add the absolute path of a properties files, or even a project relative path. * If you want to add another "protocol" for your properties files, please override * "getPropertiesLoaderService(AcceleoService)" in order to return a new property loader. * The behavior of the properties loader service is explained in the Acceleo documentation * (Help -> Help Contents). */ for (int i = 2; i < args.length; i++) { generator.addPropertiesFile(args[i]); } generator.doGenerate(new BasicMonitor()); } } catch (IOException e) { e.printStackTrace(); } }
Example #24
Source File: GenerateApplicationFiles.java From uml2solidity with Eclipse Public License 1.0 | 4 votes |
/** * This can be used to launch the generation from a standalone application. * * @param args * Arguments of the generation. * @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>(); /* * If you want to change the content of this method, do NOT forget to change the "@generated" * tag in the Javadoc of this method to "@generated NOT". Without this new tag, any compilation * of the Acceleo module with the main template that has caused the creation of this class will * revert your modifications. */ /* * Add in this list all the arguments used by the starting point of the generation * If your main template is called on an element of your model and a String, you can * add in "arguments" this "String" attribute. */ GenerateApplicationFiles generator = new GenerateApplicationFiles(modelURI, folder, arguments); /* * Add the properties from the launch arguments. * If you want to programmatically add new properties, add them in "propertiesFiles" * You can add the absolute path of a properties files, or even a project relative path. * If you want to add another "protocol" for your properties files, please override * "getPropertiesLoaderService(AcceleoService)" in order to return a new property loader. * The behavior of the properties loader service is explained in the Acceleo documentation * (Help -> Help Contents). */ for (int i = 2; i < args.length; i++) { generator.addPropertiesFile(args[i]); } generator.doGenerate(new BasicMonitor()); } } catch (IOException e) { e.printStackTrace(); } }
Example #25
Source File: GenerateHtml.java From uml2solidity with Eclipse Public License 1.0 | 4 votes |
/** * This can be used to launch the generation from a standalone application. * * @param args * Arguments of the generation. * @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>(); /* * If you want to change the content of this method, do NOT forget to change the "@generated" * tag in the Javadoc of this method to "@generated NOT". Without this new tag, any compilation * of the Acceleo module with the main template that has caused the creation of this class will * revert your modifications. */ /* * Add in this list all the arguments used by the starting point of the generation * If your main template is called on an element of your model and a String, you can * add in "arguments" this "String" attribute. */ GenerateHtml generator = new GenerateHtml(modelURI, folder, arguments); /* * Add the properties from the launch arguments. * If you want to programmatically add new properties, add them in "propertiesFiles" * You can add the absolute path of a properties files, or even a project relative path. * If you want to add another "protocol" for your properties files, please override * "getPropertiesLoaderService(AcceleoService)" in order to return a new property loader. * The behavior of the properties loader service is explained in the Acceleo documentation * (Help -> Help Contents). */ for (int i = 2; i < args.length; i++) { generator.addPropertiesFile(args[i]); } generator.doGenerate(new BasicMonitor()); } } catch (IOException e) { e.printStackTrace(); } }
Example #26
Source File: GenerateJavaTestCode.java From uml2solidity with Eclipse Public License 1.0 | 4 votes |
/** * This can be used to launch the generation from a standalone application. * * @param args * Arguments of the generation. * @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>(); /* * If you want to change the content of this method, do NOT forget to change the "@generated" * tag in the Javadoc of this method to "@generated NOT". Without this new tag, any compilation * of the Acceleo module with the main template that has caused the creation of this class will * revert your modifications. */ /* * Add in this list all the arguments used by the starting point of the generation * If your main template is called on an element of your model and a String, you can * add in "arguments" this "String" attribute. */ GenerateJavaTestCode generator = new GenerateJavaTestCode(modelURI, folder, arguments); /* * Add the properties from the launch arguments. * If you want to programmatically add new properties, add them in "propertiesFiles" * You can add the absolute path of a properties files, or even a project relative path. * If you want to add another "protocol" for your properties files, please override * "getPropertiesLoaderService(AcceleoService)" in order to return a new property loader. * The behavior of the properties loader service is explained in the Acceleo documentation * (Help -> Help Contents). */ for (int i = 2; i < args.length; i++) { generator.addPropertiesFile(args[i]); } generator.doGenerate(new BasicMonitor()); } } catch (IOException e) { e.printStackTrace(); } }
Example #27
Source File: GenerateContracts.java From uml2solidity with Eclipse Public License 1.0 | 4 votes |
/** * This can be used to launch the generation from a standalone application. * * @param args * Arguments of the generation. * @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>(); /* * If you want to change the content of this method, do NOT forget to change the "@generated" * tag in the Javadoc of this method to "@generated NOT". Without this new tag, any compilation * of the Acceleo module with the main template that has caused the creation of this class will * revert your modifications. */ /* * Add in this list all the arguments used by the starting point of the generation * If your main template is called on an element of your model and a String, you can * add in "arguments" this "String" attribute. */ GenerateContracts generator = new GenerateContracts(modelURI, folder, arguments); /* * Add the properties from the launch arguments. * If you want to programmatically add new properties, add them in "propertiesFiles" * You can add the absolute path of a properties files, or even a project relative path. * If you want to add another "protocol" for your properties files, please override * "getPropertiesLoaderService(AcceleoService)" in order to return a new property loader. * The behavior of the properties loader service is explained in the Acceleo documentation * (Help -> Help Contents). */ for (int i = 2; i < args.length; i++) { generator.addPropertiesFile(args[i]); } generator.doGenerate(new BasicMonitor()); } } catch (IOException e) { e.printStackTrace(); } }
Example #28
Source File: GenerateWeb3Contract.java From uml2solidity with Eclipse Public License 1.0 | 4 votes |
/** * This can be used to launch the generation from a standalone application. * * @param args * Arguments of the generation. * @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>(); /* * If you want to change the content of this method, do NOT forget to change the "@generated" * tag in the Javadoc of this method to "@generated NOT". Without this new tag, any compilation * of the Acceleo module with the main template that has caused the creation of this class will * revert your modifications. */ /* * Add in this list all the arguments used by the starting point of the generation * If your main template is called on an element of your model and a String, you can * add in "arguments" this "String" attribute. */ GenerateWeb3Contract generator = new GenerateWeb3Contract(modelURI, folder, arguments); /* * Add the properties from the launch arguments. * If you want to programmatically add new properties, add them in "propertiesFiles" * You can add the absolute path of a properties files, or even a project relative path. * If you want to add another "protocol" for your properties files, please override * "getPropertiesLoaderService(AcceleoService)" in order to return a new property loader. * The behavior of the properties loader service is explained in the Acceleo documentation * (Help -> Help Contents). */ for (int i = 2; i < args.length; i++) { generator.addPropertiesFile(args[i]); } generator.doGenerate(new BasicMonitor()); } } catch (IOException e) { e.printStackTrace(); } }
Example #29
Source File: GenerateJsTestCode.java From uml2solidity with Eclipse Public License 1.0 | 4 votes |
/** * This can be used to launch the generation from a standalone application. * * @param args * Arguments of the generation. * @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>(); /* * If you want to change the content of this method, do NOT forget to change the "@generated" * tag in the Javadoc of this method to "@generated NOT". Without this new tag, any compilation * of the Acceleo module with the main template that has caused the creation of this class will * revert your modifications. */ /* * Add in this list all the arguments used by the starting point of the generation * If your main template is called on an element of your model and a String, you can * add in "arguments" this "String" attribute. */ GenerateJsTestCode generator = new GenerateJsTestCode(modelURI, folder, arguments); /* * Add the properties from the launch arguments. * If you want to programmatically add new properties, add them in "propertiesFiles" * You can add the absolute path of a properties files, or even a project relative path. * If you want to add another "protocol" for your properties files, please override * "getPropertiesLoaderService(AcceleoService)" in order to return a new property loader. * The behavior of the properties loader service is explained in the Acceleo documentation * (Help -> Help Contents). */ for (int i = 2; i < args.length; i++) { generator.addPropertiesFile(args[i]); } generator.doGenerate(new BasicMonitor()); } } catch (IOException e) { e.printStackTrace(); } }
Example #30
Source File: GenerateJavaCode.java From uml2solidity with Eclipse Public License 1.0 | 4 votes |
/** * This can be used to launch the generation from a standalone application. * * @param args * Arguments of the generation. * @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>(); /* * If you want to change the content of this method, do NOT forget to change the "@generated" * tag in the Javadoc of this method to "@generated NOT". Without this new tag, any compilation * of the Acceleo module with the main template that has caused the creation of this class will * revert your modifications. */ /* * Add in this list all the arguments used by the starting point of the generation * If your main template is called on an element of your model and a String, you can * add in "arguments" this "String" attribute. */ GenerateJavaCode generator = new GenerateJavaCode(modelURI, folder, arguments); /* * Add the properties from the launch arguments. * If you want to programmatically add new properties, add them in "propertiesFiles" * You can add the absolute path of a properties files, or even a project relative path. * If you want to add another "protocol" for your properties files, please override * "getPropertiesLoaderService(AcceleoService)" in order to return a new property loader. * The behavior of the properties loader service is explained in the Acceleo documentation * (Help -> Help Contents). */ for (int i = 2; i < args.length; i++) { generator.addPropertiesFile(args[i]); } generator.doGenerate(new BasicMonitor()); } } catch (IOException e) { e.printStackTrace(); } }