carbidecpp20devenv/plugins/org.eclipse.emf.source_2.4.1.v200808251517/src/org.eclipse.emf.importer.java_2.4.1.v200808251517/readme.html
changeset 1 82d1d1de1a01
equal deleted inserted replaced
-1:000000000000 1:82d1d1de1a01
       
     1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
       
     2     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
       
     3 <html xmlns="http://www.w3.org/1999/xhtml">
       
     4 <head>
       
     5 <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
       
     6 <title>org.eclipse.emf.importer.java Read Me</title>
       
     7 </head>
       
     8 <body lang="EN-US">
       
     9 <h3>Introduction</h3>
       
    10 <p>This document describes how you can use scripts to generate code from Annotated Java.  The 
       
    11 script can be either a regular shell script that invokes <a href="#headlessApplication">Eclipse headless 
       
    12 applications</a> or an Ant script that invokes the <a href="#antTasks">task</a> provided by this plugin.</p>
       
    13 
       
    14 <h3><a name="overallComments">Overall Comments</a></h3>
       
    15 <ul>
       
    16 <li>If you didn't extract this plugin from CVS, the &quot;examples&quot; directory mentioned 
       
    17 in this document is available in the EMF source plugin 
       
    18 (org.eclipse.emf.source_<i>&lt;version&gt;</i>/src/org.eclipse.emf.importer.java_<i>&lt;version&gt;</i>).
       
    19 <br/><br/></li>
       
    20 <li>Before running your build scripts or the examples provided here, make sure you have the 2 
       
    21 jar files required by this plugin (&quot;importer.java.jar&quot; and 
       
    22 &quot;importer.java.tasks.jar&quot;) and also the 2 jar files required by the <tt>org.eclipse.emf.ant</tt> 
       
    23 plugin (&quot;emf.ant.jar&quot; and &quot;emf.ant.tasks.jar&quot;).  If necessary, Eclipse 
       
    24 can generate them for you.  All you need to do is to run the Ant script created by PDE when you right click on the manifest file 
       
    25 and select &quot;PDE Tools&gt;Create Ant Build File&quot;.
       
    26 <br/><br/></li>
       
    27 <li>The Annotated Java interfaces must be placed in a directory that corresponds to the source folder of an Eclipse Java Project.  In other words, 
       
    28 the project's directory must contain all Eclipse's required &quot;metadata&quot; files, such as &quot;.project&quot; and &quot;.classpath&quot;.  
       
    29 If the project doesn't already exist in the workspace, the application or task will create it.
       
    30 <br/><br/></li>
       
    31 <li>In order to preserve the original state of this plugin's &quot;examples&quot; directory, you
       
    32 should copy it to a different location and run the Ant scripts from there.
       
    33 <br/><br/></li>
       
    34 <li>Starting a new JVM process and invoking Eclipse are expensive operations.  Your build will 
       
    35 perform better if you are able to group the steps that require Eclipse in a few scripts 
       
    36 (one script would be ideal).  This is probably a reason to use Ant instead of invoking the 
       
    37 applications - you can generate code for multiple models using one single Ant script.
       
    38 <br/><br/></li>
       
    39 <li>The &quot;examples/library&quot; directory contains a set of Annotated Java interfaces, and shell and Ant scripts 
       
    40 to generate its code.
       
    41 </li>
       
    42 </ul>
       
    43 
       
    44 <h3><a name="headlessApplication">Java and Generator Applications</a></h3>
       
    45 <p>The application provided by this plugin generates the ecore and genmodel files from models defined
       
    46 using Java interfaces.</p>
       
    47 <table border="1" cellpadding="2" cellspacing="0" 
       
    48 summary="Lists the details about the Java application.">
       
    49   <tr><td colspan="2">Java application details</td></tr>
       
    50 	<tr><td>ID</td><td><tt>org.eclipse.emf.importer.ecore.Java2GenModel</tt></td></tr>
       
    51 	<tr><td>Class</td><td><tt>org.eclipse.emf.importer.ecore.JavaImporterApplication</tt></td></tr>
       
    52 </table>
       
    53 <p>To generate the actual Java code you will need to use a second application, provided by 
       
    54 the &quot;org.eclipse.emf.codegen.ecore&quot; plugin.</p>
       
    55 <table border="1" cellpadding="2" cellspacing="0" 
       
    56 summary="Lists the details about the Generator application.">
       
    57   <tr><td colspan="2">Generator application details</td></tr>
       
    58 	<tr><td>ID</td><td><tt>org.eclipse.emf.codegen.ecore.Generator</tt></td></tr>
       
    59 	<tr><td>Class</td><td><tt>org.eclipse.emf.codegen.ecore.Generator</tt></td></tr>
       
    60 </table>
       
    61 <p>In order to run these or any other Eclipse application, you need to execute the following 
       
    62 command (without the line breaks):</p>
       
    63 <p>
       
    64 eclipse
       
    65 <br/>&nbsp;&nbsp;-noSplash
       
    66 <br/>&nbsp;&nbsp;-data <i>&lt;full path to a workspace - ideally an empty directory&gt;</i>
       
    67 <br/>&nbsp;&nbsp;-application <i>&lt;application ID&gt;</i>
       
    68 <br/>&nbsp;&nbsp;<i>&lt;application arguments&gt;</i>
       
    69 </p>
       
    70 <p>In Windows you should execute <i>eclipsec</i> instead of <i>eclipse</i> in order to have
       
    71 access to the application's console output.</p> 
       
    72 <p>The directory &quot;examples/library/build&quot; has shell scripts that generate the code for
       
    73 the Java interfaces provided.  If you have any questions after reading and experimenting with it, look at the 
       
    74 applications's javadoc for more details.  Also, check the application's class  
       
    75 &quot;getUsage()&quot; method for the list of possible arguments.</p>
       
    76 
       
    77 
       
    78 <h3><a name="antTasks">Java Ant Task</a></h3>
       
    79 <p>The Java task details are:</p>
       
    80 <table border="1" cellpadding="2" cellspacing="0" 
       
    81 summary="Lists the details about the Java task.">
       
    82 	<tr><td>Name</td><td><tt>emf.Java2Java</tt></td></tr>
       
    83 	<tr><td>Class</td><td><tt>org.eclipse.emf.importer.ecore.taskdefs.JavaGeneratorTask</tt></td></tr>
       
    84 </table>
       
    85 <p>This is the usual command line to run an Ant script using a headless Eclipse instance (remove the line breaks):</p>
       
    86 <p>
       
    87 eclipse
       
    88 <br/>&nbsp;&nbsp;-noSplash 
       
    89 <br/>&nbsp;&nbsp;-data <i>&lt;full path to a workspace - ideally an empty directory&gt;</i>
       
    90 <br/>&nbsp;&nbsp;-application org.eclipse.ant.core.antRunner
       
    91 <br/>&nbsp;&nbsp;-buildfile <i>&lt;full path to your script&gt;</i>
       
    92 </p>
       
    93 <p>In Windows you should execute <i>eclipsec</i> instead of <i>eclipse</i> in order to have
       
    94 access to the Ant build script console output.</p>
       
    95 <p>You can also use the Eclipse UI to execute an Ant script containing an EMF task.  This can be 
       
    96 done by right-clicking the script and selecting 
       
    97 <i>Run As &gt; Ant Build... &gt; JRE &gt; "Run in the same JRE as the workspace&quot;</i>.</p>
       
    98 <p>The directory &quot;examples/library/build&quot; has an Ant script that generate the code for
       
    99 the model provided.  The task's javadoc has lots of information you may find useful.</p>
       
   100 
       
   101 </body>
       
   102 </html>