
Chapter 7 Working with Eclipse
Generating EMF implementation classes
To use the EMF code generator to generate the implementation classes:
- Start Eclipse.
- If the project already exists, you can right click the project and select Refresh. If it is a new project, you need to import the generated project: Select File→Import, select Existing project into workspace, select the generated directory name in the directory browser.
- Right-click the .genmodel file and select Open with → EMF Generator to open the file. You can see a tree view that shows the contents of the Ecore model.
- Right-click the root of the tree view and select Generate All.
The EMF code generator will create three projects: the model project, the edit project and the editor project and will compile them.
- Use the generated classes in your own application.
For more information on how to use the generated classes and the editor, see the EMF documentation.
Notes
- Once you have the generated interfaces and implementation classes, you can add more attributes and operations
- You can also implement your operations or change the generated operations
- You can change your Ecore model by changing the PowerDesigner Class Diagram and regenerate the Ecore model, then use EMF code generator to regenerate the Java code. EMF will keep the attributes and operations you have added manually
- If you change a generated operation and do not want EMF to overwrite your changes, you should remove the @model Javadoc tag to avoid losing your changes the next time you generate the code using EMF code generator
Copyright (C) 2006. Sybase Inc. All rights reserved.
|
|