carbidecpp20devenv/plugins/org.eclipse.xsd.cheatsheets_2.3.0.v200808251517/cheatsheets/GenerateEMFFromXSD.xml
changeset 1 82d1d1de1a01
equal deleted inserted replaced
-1:000000000000 1:82d1d1de1a01
       
     1 <?xml version="1.0" encoding="UTF-8" ?>
       
     2 <cheatsheet title="Generating an EMF Model from XML Schema">
       
     3 
       
     4   <intro href="/org.eclipse.emf.doc/tutorials/xlibmod/xlibmod.html">
       
     5     <description>
       
     6       This cheat sheet is a step-by-step description of how to generate an EMF
       
     7       model and editor from an XML Schema.
       
     8     </description>
       
     9   </intro>
       
    10 
       
    11   <item title="Set up the environment">
       
    12   	<description>
       
    13   	  Your environment must be set up before you can perform the steps in this cheat sheet.
       
    14   	</description>
       
    15 
       
    16     <subitem
       
    17       label="Create an &quot;EMF Cheatsheet Data&quot; project in your workspace with the example &quot;library.xsd&quot; file."
       
    18       skip="true">
       
    19       <action
       
    20         pluginId="org.eclipse.emf.cheatsheets"
       
    21         class="org.eclipse.emf.cheatsheets.actions.CopyFileFromPluginAction"
       
    22         param1="EMF Cheatsheet Data"
       
    23         param2=""
       
    24         param3="org.eclipse.xsd.cheatsheets/archive/xsd/library.xsd" 
       
    25         translate="" />
       
    26     </subitem>
       
    27 
       
    28     <subitem
       
    29       when="true" 
       
    30       label="Delete or rename the following projects if they exist in your workspace: &quot;library.xsd&quot;, &quot;library.xsd.edit&quot;, &quot;library.xsd.editor&quot;."
       
    31       skip="true" />
       
    32   </item>
       
    33 
       
    34   <item
       
    35     title="Import the model from XML Schema"
       
    36     href="/org.eclipse.emf.doc/tutorials/xlibmod/xlibmod.html#step1"
       
    37     dialog="true"
       
    38     skip="true">
       
    39     <description>
       
    40       First, you must create a new &quot;library.xsd&quot; EMF project in your workspace, importing
       
    41       the schema to create the EMF model.
       
    42     </description>
       
    43 
       
    44     <subitem label="Select &quot;File &gt; New &gt; Project...&quot;. Expand &quot;Eclipse Modeling Framework&quot; and select &quot;EMF Project&quot;. Then, click &quot;Next&quot;." skip="true">
       
    45       	<action
       
    46           pluginId="org.eclipse.emf.cheatsheets"
       
    47           class="org.eclipse.emf.cheatsheets.actions.OpenEMFProjectWizardAction"
       
    48           param1="library.xsd"
       
    49           param2="org.eclipse.xsd.ecore.importer" 
       
    50           translate="" />
       
    51     </subitem>
       
    52     <subitem label="Enter &quot;library.xsd&quot; as the project name, then click &quot;Next&quot;." skip="false" />
       
    53     <subitem label="Select &quot;XML Schema&quot;, then click &quot;Next&quot;." skip="false" />
       
    54     <subitem label="Click &quot;Browse Workspace...&quot;, and expand &quot;EMF Cheatsheet Data&quot; to select &quot;library.xsd&quot;. Then click &quot;Next&quot;." skip="false" />
       
    55     <subitem label="Select the package &quot;org.eclipse.example.library&quot;, then click &quot;Finish&quot;." skip="false" />
       
    56   </item>
       
    57 
       
    58   <item
       
    59     title="Generate the code"
       
    60     href="/org.eclipse.emf.doc/tutorials/xlibmod/xlibmod.html#step2"
       
    61     dialog="true"
       
    62     skip="true">
       
    63     <description>
       
    64       Generate the code to implement the model and an editor for it. The generator is automatically opened on completion of the wizard in the previous step.
       
    65     </description>
       
    66 
       
    67     <repeated-subitem values="Model,Edit,Editor">
       
    68       <subitem label="In the generator, right click on &quot;Library&quot; and select &quot;Generate ${this} Code&quot;." />
       
    69     </repeated-subitem>
       
    70     <subitem label="If automatic building has been disabled, select &quot;Project &gt; Build All&quot; to compile the generated code." skip="true">
       
    71       <action
       
    72         pluginId="org.eclipse.emf.cheatsheets"
       
    73         class="org.eclipse.emf.cheatsheets.actions.BuildAllProjectsAction" />
       
    74     </subitem>
       
    75   </item>
       
    76 
       
    77   <item
       
    78     title="Run the generated editor"
       
    79     href="/org.eclipse.emf.doc/tutorials/xlibmod/xlibmod.html#step4"
       
    80     dialog="true"
       
    81     skip="true">
       
    82     <description>
       
    83       Now, you are set to run the generated editor and create a new library instance.
       
    84     </description>
       
    85     <onCompletion>
       
    86       Congratulations! You have succesfully created an EMF model from an XML Schema, generated the code, and created an instance of the model.
       
    87     </onCompletion> 
       
    88 
       
    89     <subitem label="Select the &quot;library.xsd&quot; project in the package explorer and invoke the &quot;Run &gt; Run As &gt; Eclipse Application&quot; menu item. This starts a runtime instance of Eclipse with the newly generated plug-ins available." />
       
    90     <subitem label="In the runtime instance, create a new general project called &quot;librarytest&quot;." />
       
    91     <subitem label="Right click &quot;librarytest&quot; and select &quot;New &gt; Other...&quot;." />
       
    92     <subitem label="Expand &quot;Example EMF Model Creation Wizards&quot; and select &quot;Library Model&quot;. Then, click &quot;Next&quot;." />
       
    93     <subitem label="Enter &quot;My.library&quot; as the file name, then click &quot;Next&quot;." />
       
    94     <subitem label="Select &quot;Library&quot;; as the model object, then click &quot;Finish&quot;." />
       
    95     <subitem label="The generated library editor is opened. Expand &quot;platform:/resource/librarytest/My.library&quot;. Right click &quot;Library&quot; and select &quot;New Child &gt; Writer&quot; to create a writer object in the library." />
       
    96     <subitem label="Create additional writers and books in the library, and edit the objects' properties in the properties view." />
       
    97     <subitem label="Select &quot;File > Save&quot; to save the instance." />
       
    98   </item>
       
    99 </cheatsheet>