Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "Texo/QuickStart"

(Quick Start)
(Next Steps)
Line 17: Line 17:
 
As a next step you can try the following:
 
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.  
 
* 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.
+
* 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 [[Texo/Test_Data_Generation|generating data]] for your model  
 
* try [[Texo/Test_Data_Generation|generating data]] for your model  
 
* do [[Texo/XML_and_XMI_Serialization|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).
 
* do [[Texo/XML_and_XMI_Serialization|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.
 
* 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 [[Texo/Template_Overriding|overriding templates]].
 
* try [[Texo/Template_Overriding|overriding templates]].

Revision as of 12:29, 7 March 2010

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 this file here, place this file somewhere in the java project
  • Right click on the ecore or xsd file and do 'Texo > Generate Code'. This will create a new folder (src-gen) in the project with the generated code.
  • 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 are Texo/EMF free and can be used directly in other frameworks. This in itself is fairly standard (generating entities). However, Texo supports many EMF model constructs and correctly handles default value settings and inter-package relationships. Just try it out with some more complex models.

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.

Back to the top