| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| |
| <html> |
| |
| <head> |
| <meta content="text/html; charset=ISO-8859-1" |
| http-equiv="content-type"> |
| <title>Emfatic Getting Started Guide</title> |
| </head> |
| <body> |
| <h1>Emfatic Getting Started Guide</h1> |
| by Chris Daly (cjdaly@us.ibm.com)<br> |
| Copyright IBM Corp. 2004<br> |
| <br> |
| <hr style="width: 100%; height: 2px;"><br> |
| <br> |
| Emfatic is a language designed to represent EMF Ecore models in a |
| textual form. This document shows the basic steps involved in |
| working with Emfatic.<br> |
| <br> |
| <span style="font-weight: bold;">Please see the </span><span |
| style="font-style: italic; font-weight: bold;">Emfatic Language |
| Reference</span><span style="font-weight: bold;"> for a full |
| explanation of the syntax and sematics of the Emfatic language.</span><br> |
| <br> |
| In this document, Emfatic programs are shown in boxes |
| as in the example below:<br> |
| <br> |
| <table |
| style="width: 100%; text-align: left; font-family: monospace; background-color: rgb(204, 204, 255);" |
| border="1" cellpadding="2" cellspacing="2"> |
| <tbody> |
| <tr> |
| <td style="vertical-align: top;">package test;<br> |
| class Foo { }</td> |
| </tr> |
| </tbody> |
| </table> |
| <br> |
| When compiled, the program above will produce a model with an <span |
| style="font-weight: bold;">EPackage</span> named "test" containing a |
| single <span style="font-weight: bold;">EClass</span> named "Foo".<br> |
| <br> |
| Let's go ahead and create an Emfatic file with the above source code:<br> |
| <ul> |
| <li>Create a new project or use an existing one for the next step (it |
| doesn't matter what kind of project you choose or which Eclipse |
| perspective you are in).</li> |
| <li>Create a new file called "test.emf".</li> |
| <li>Enter the two lines from the box above in test.emf.</li> |
| <li>Save test.emf.</li> |
| <li>In the Navigator view (or Package Explorer), right-click on |
| test.emf and select <span style="font-weight: bold;">Generate Ecore |
| Model</span>.<br> |
| </li> |
| </ul> |
| Now you should see a new file called "test.ecore" in the Navigator (In |
| the same folder as test.emf). Try the following:<br> |
| <ul> |
| <li>Open test.ecore (using the default EMF Ecore model editor)</li> |
| <li>Right-click on the EPackage "test" and select <span |
| style="font-weight: bold;">New Child</span> -> <span |
| style="font-weight: bold;">EClass</span>.</li> |
| <li>Select the new EClass, right-click and <span |
| style="font-weight: bold;">Show Properties View</span>.</li> |
| <li>In the Properties view, enter the name "Bar" for the EClass</li> |
| <li>In the Properties view, change the value of the property Abstract |
| to true.</li> |
| <li>Save test.ecore.</li> |
| <li>In the Navigator view, right-click on test.ecore and select <span |
| style="font-weight: bold;">Generate Emfatic Source</span>.<br> |
| </li> |
| </ul> |
| Look at test.emf again. It should now look something like this:<br> |
| <br> |
| <table |
| style="background-color: rgb(204, 204, 255); width: 100%; text-align: left; font-family: monospace;" |
| border="1" cellpadding="2" cellspacing="2"> |
| <tbody> |
| <tr> |
| <td style="vertical-align: top;">package test;<br> |
| <br> |
| class Foo {<br> |
| }<br> |
| <br> |
| abstract class Bar {<br> |
| }<br> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| <br> |
| <br> |
| You have now seen the basic steps involved in working with |
| Emfatic.<br> |
| <br> |
| Here are a few key points to stress:<br> |
| <ul> |
| <li>Emfatic source files use the extension <span |
| style="font-family: monospace;">.emf</span></li> |
| <li>Save your Emfatic and Ecore files before invoking the "Generate" |
| actions (Emfatic reads the file from disk rather than looking at the |
| contents of the editor)</li> |
| <li>Emfatic will overwrite existing files as you invoke the |
| "Generate" actions, so be careful!</li> |
| </ul> |
| <br> |
| <br> |
| </body> |
| |
| |
| </html> |