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)
(Quick Start)
 
(4 intermediate revisions by one other user not shown)
Line 5: Line 5:
 
* [[Texo/Download_and_Install|Download & Install]] Texo through the update manager
 
* [[Texo/Download_and_Install|Download & Install]] Texo through the update manager
 
* Create a java project (plugin or normal)
 
* 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
+
* Take an ecore or xsd file, or use one (or all) of the model files in [[Media:org.eclipse.emf.texo.models.zip|this zip file]], place the model 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.
+
* 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.
 +
 
  
 
[[Image:org.eclipse.emf.texo.generate.code.png|center|600px]]
 
[[Image:org.eclipse.emf.texo.generate.code.png|center|600px]]
 +
  
 
* 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:
 
* 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:
Line 15: Line 17:
 
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.
 
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.
+
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 ==
 
== Next Steps ==

Latest revision as of 21:22, 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 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.

Back to the top