Texo/QuickStart

From Eclipsepedia

Jump to: navigation, search

Contents


Quick Start

The quick start let you generate code in a few minutes:

  • Download & Install Texo through the update manager
  • Create a java project (plugin or normal)
  • Take an ecore or xsd file, or use one (or all) of the model files in this zip file, place the model file somewhere in the java project
  • Right click on the ecore or xsd file (or all the model files) and do 'Texo > Generate Code'. This will create a new folder (src-gen) in the project with the generated code.


Org.eclipse.emf.texo.generate.code.png


  • Add this new folder as source folder to the project. You will probably get compile errors as not all dependencies are set. To get rid of these add the following plugins to the dependency:
    • org.eclipse.emf.ecore
    • org.eclipse.emf.texo

If you have a normal java project then you need to set these dependencies as jar files. The org.eclipse.emf.ecore.jar and org.eclipse.emf.texo.jar files can be found in the eclipse installation in the plugins folder.

Now check out the generated code. The ecore/texo dependencies are centralized in the two generated ModelFactory/ModelPackage classes. The entities themselves do not have Texo/EMF dependencies and can be used directly in other frameworks.

Next Steps

As a next step you can try the following:

  • make it more complex by using more complex models or generate for multiple models at the same time.
  • add the Texo nature to the project (right-click on the project and do 'Configure > Add/Remove Texo Nature') and set the target folder and templates folder (see 'Project Properties > Texo').
  • try generating data for your model
  • do XML/XMI serialization (with the generated test data). Note that for XML/XMI serialization you sometimes have to implement the String conversion methods in the generated ModelFactory class (see the UnsupportedOperationExceptions which are possibly generated there now).
  • change the implementation of some methods (change the javadoc tag @generated to @generatedNOT) and see that when you re-generate that the manual changes remain.
  • try overriding templates.