<?xml version="1.0" encoding="UTF-8" ?>
<cheatsheet title="Generating an Extended EMF Model">

  <intro href="/org.eclipse.emf.doc/tutorials/slibmod/slibmod.html">
    <description>
      This cheat sheet is a step-by-step description of how to generate an extended EMF
      model and editor from a Rose class diagram.
      <br /><br />
      This cheat sheet continues on from either the &quot;Generating an EMF Model from Rose&quot;
      or &quot;Generating an EMF Model from Annotated Java&quot; cheat sheet. Ensure that you have
      completed at least one of them before contining.
    </description>
  </intro>

  <item title="Set up the environment">
    <description>
  	  Your environment must be set up before you can perform the steps in this cheat sheet.
    </description>

    <subitem
      label="Create an &quot;EMF Cheatsheet Data&quot; project in your workspace with the example &quot;schoollibrary.mdl&quot; file."
      skip="true" >
      <action
        pluginId="org.eclipse.emf.cheatsheets"
        class="org.eclipse.emf.cheatsheets.actions.CopyFileFromPluginAction"
        param1="EMF Cheatsheet Data"
        param2=""
        param3="org.eclipse.emf.cheatsheets/archive/extended/schoollibrary.mdl" 
        translate="" />
    </subitem>

    <subitem
      when="true" 
      label="Ensure that either &quot;library.rose&quot;, &quot;library.rose.edit&quot;, and &quot;library.rose.editor&quot; or &quot;library.java&quot;, &quot;library.java.edit&quot;, and &quot;library.java.editor&quot; exist in your workspace. Otherwise, you will need to complete either the &quot;Generating an EMF Model from Rose&quot; or the &quot;Generating an EMF Model from Annotated Java&quot; cheat sheet before continuing."
      skip="false" />

    <subitem
      when="true" 
      label="Delete or rename the following projects if they exist in your workspace: &quot;schoollibrary.rose&quot;,&quot;schoollibrary.rose.edit&quot;,&quot;schoollibrary.rose.editor&quot;"
      skip="true" />
  </item>

  <item
    title="Import the model from Rose"
    href="/org.eclipse.emf.doc/tutorials/slibmod/slibmod.html#step1a"
    dialog="true"
    skip="true">
    <description>
      First, you must create a new &quot;schoollibrary.rose&quot; EMF project in your workspace, importing
      the Rose model to create the EMF model.
    </description>

    <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">
      	<action
          pluginId="org.eclipse.emf.cheatsheets"
          class="org.eclipse.emf.cheatsheets.actions.OpenEMFProjectWizardAction"
          param1="schoollibrary.rose"
          param2="org.eclipse.emf.importer.rose" 
          translate="" />
    </subitem>
    <subitem label="Enter &quot;schoollibrary.rose&quot; as the project name, then click &quot;Next&quot;." skip="false" />
    <subitem label="Select &quot;Rose class model&quot;, then click &quot;Next&quot;." skip="false" />
    <subitem label="Click &quot;Browse Workspace...&quot;, and expand &quot;EMF Cheatsheet Data&quot; to select &quot;schoollibrary.mdl&quot;. Then click &quot;Next&quot;." skip="false" />
    <subitem label="In the &quot;Root packages&quot; table, select the package &quot;org.eclipse.example.schoollibrary&quot;, which will be generated." skip="false" />
    <subitem label="Click &quot;Browse...&quot; to locate the file containing the library model that will be extended." skip="false" />
    <subitem label="Expand either the &quot;library.rose&quot; or library.java&quot; project to select the &quot;model/library.genmodel&quot; file within it. Click &quot;OK&quot;." skip="false" />
    <subitem label="Under &quot;Referenced generator models&quot;, select the &quot;org.eclipse.example.library&quot; package, and click &quot;Finish&quot;." skip="false" />
  </item>

  <item
    title="Generate the code"
    href="/org.eclipse.emf.doc/tutorials/slibmod/slibmod.html#step2"
    dialog="true"
    skip="true">
    <description>
      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.
    </description>

    <subitem label="In the generator, right click on &quot;Schoollibrary&quot; and select &quot;Generate All&quot;." />
    <subitem label="If automatic building has been disabled, select &quot;Project &gt; Build All&quot; to compile the generated code." skip="true">
      <action
        pluginId="org.eclipse.emf.cheatsheets"
        class="org.eclipse.emf.cheatsheets.actions.BuildAllProjectsAction" />
    </subitem>
  </item>

  <item
    title="Run the generated editor"
    href="/org.eclipse.emf.doc/tutorials/slibmod/slibmod.html#step3"
    dialog="true"
    skip="true">
    <description>
      Now, you are set to run the generated editor and create a new school library instance.
    </description>
    <onCompletion>
      Congratulations! You have succesfully extended an EMF model, generated the code, and created an instance of the extended model.
    </onCompletion> 

    <subitem label="Select the &quot;schoollibrary.rose&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." />
    <subitem label="In the runtime instance, create a new general project called &quot;schoollibrarytest&quot;." />
    <subitem label="Right click &quot;schooollibrarytest&quot; and select &quot;New &gt; Other...&quot;." />
    <subitem label="Expand &quot;Example EMF Model Creation Wizards&quot; and select &quot;Schoollibrary Model&quot;. Then, click &quot;Next&quot;." />
    <subitem label="Enter &quot;My.schoollibrary&quot; as the file name, then click &quot;Next&quot;." />
    <subitem label="Select &quot;School Library&quot;; as the model object, then click &quot;Finish&quot;." />
    <subitem label="The generated school library editor is opened. Expand &quot;platform:/resource/schoollibrarytest/My.schoollibrary&quot;. Right click &quot;School Library&quot; and select &quot;New Child &gt; School Book&quot; to create a school book object in the library." />
    <subitem label="Create additional books and writers in the library, and edit the objects' properties in the properties view." />
    <subitem label="Select &quot;File > Save&quot; to save the instance." />
  </item>
</cheatsheet>
