blob: 1e7745ed2c6163006bf16765808717b8268d0282 [file] [log] [blame]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<link rel="stylesheet" href="images/../../../css/book.css" type="text/css"/>
<link rel="stylesheet" href="images/../../../css/emf-book.css" type="text/css"/>
<title>Generating an Extended EMF Model</title>
</head>
<body lang="EN-US" xml:lang="EN-US">
<h1>Generating an Extended EMF Model</h1>
<p>Last updated: June 29, 2004</p>
<p>This tutorial is a follow-on to
<a href="../../tutorials/clibmod/clibmod.html">Generating an EMF Model</a>,
in which a simple library model is generated. In that tutorial, we showed how an
EMF model can be generated very easily from a Rose model or a set of Java
interface files. In this tutorial, we will show you how to generate an EMF model
that extends an existing model.</p>
<p>First of all, let us look back at the library model:</p>
<img src="images/../../clibmod/images/model.gif" alt="Library UML model"/>
<p>We are now going to extend this library model by creating a new package,
schoollibrary. This package contains three classes, two of which extend classes
in the library model:</p>
<img src="images/model.gif" alt="Schoollibrary UML model"/>
<p>This tutorial will show you step-by-step how to generate an EMF model of this
schoollibrary package, using the library model that you've already created.
As in the previous tutorial, we will demonstrate creating this new model from a
Rose model and from a set of Java interfaces.</p>
<p>The screenshots are based on version 3.0 of the Eclipse SDK and version 2.0
of EMF.</p>
<hr/>
<h2>Contents</h2>
<table border="0" cellspacing="2" cellpadding="2" width="100%">
<tr>
<td valign="top">Step 1:</td>
<td valign="top"><a href="#step1a">Import the Model from Rose</a> or
<a href="#step1b">Define the Model Using Annotated Java</a>
</td>
</tr>
<tr>
<td valign="top">Step 2:</td>
<td valign="top"><a href="#step2">Generate the EMF Model and Editor Code</a>
</td>
</tr>
<tr>
<td valign="top">Step 3:</td>
<td valign="top"><a href="#step3">Run the Generated Editor</a> </td>
</tr>
<tr>
<td valign="top">Step 4:</td>
<td valign="top"><a href="#step4">Modify the Editor</a>
</td>
</tr>
<tr>
<td valign="top">Appendix:</td>
<td valign="top"><a href="#appendix">An Alternative Way to Generate the Model</a>
</td>
</tr>
</table>
<br/>
<hr/>
<p style="text-align: right"><a id="step0" name="step0">&nbsp;</a><a href="#top">contents</a></p>
<h2>Step 0: Prerequisites</h2>
<p>The library model and editor were generated in the previous tutorial,
<a href="../../tutorials/clibmod/clibmod.html">Generating an EMF Model</a>.</p>
<ul>
<li>Launch Eclipse and verify that these three projects are shown in the
Navigator view in the Resource perspective: "library", library.edit", and
"library.editor".<br/>
<img src="images/img001.gif" alt="Existing library projects"/><br/>
&nbsp;</li>
</ul>
<p>If these packages are not listed, you will need to work through the previous
tutorial, or see the <a href="#appendix">Appendix</a> for how to create both
models at once.</p>
<hr/>
<p style="text-align: right"><a id="step1a" name="step1a">&nbsp;</a><a href="#top">contents</a></p>
<h2>Step 1a: Import the Model from Rose</h2>
<p>Save the Rose model file
<a target="_code" href="images/../schoollibrary.mdl">schoollibrary.mdl</a>
somewhere on your workstation. It contains both the library and schoollibrary
packages.</p>
<p>When sharing packages among various models, we really should place each
package in its own .cat file, and just reference them in an .mdl file. However,
for the purposes of this tutorial, we have simply duplicated and extended the
library package in a single model file. The generator behaves exactly the same,
whether packages are contained inside a single .mdl file or referenced in
external .cat files.<br/>
</p>
<p>Create a new EMF project in the workspace:</p>
<ul>
<li>Bring up the "File/New/Project..." dialog.<br/>
<img src="images/../../clibmod/images/img101.gif" alt="File/New/Project..."/><br/>
&nbsp;</li>
<li>Expand "Eclipse Modeling Framework" and select "EMF Project". Click the
"Next" button.<br/>
<img src="images/../../clibmod/images/img102.gif" alt="EMF Project"/><br/>
&nbsp;</li>
<li>Give the project a name, says, "schoollibrary", and then click the
"Next" button.<br/>
<img src="images/img101.gif" alt="Name the project"/><br/>
&nbsp;</li>
<li>Select "Load from a Rose class model" and click the "Next" button.<br/>
<img src="images/../../clibmod/images/img104.gif" alt="Load from a Rose class model"/><br/>
&nbsp;</li>
<li>Click on the "Browse" button and use the file dialog to locate the Rose
model file. The file will be examined, and a default generator model name will
be suggested. You can change the name in the entry box if you wish. Then, click
the "Next" button.<br/>
<img src="images/img102.gif" alt="Browse for Rose file and name generator model"/><br/>
&nbsp;</li>
<li>The Rose model contains two packages, library and schoollibrary. We select
only the package that we wish to generate, "schoollibrary". However, because
schoollibrary contains references to classes in library, we need to specify
where to find that model, so that it can be reused. Click the "Browse"
button.<br/>
<img src="images/img103.gif" alt="Select package"/><br/>
&nbsp;</li>
<li>In the resource selection dialog, select the folder that contains the
library model, and check the generator model, "library.genmodel". Click the
"OK" button.<br/>
<img src="images/img104.gif" alt="Select referenced model"/><br/>
&nbsp;</li>
<li>Expand the "Library" model, and select the "Library" package. Note that the
error message disappears. Click the "Finish" button.<br/>
<img src="images/img105.gif" alt="Select referenced package"/><br/>
&nbsp;</li>
<li>A core model (schoollibrary.ecore) and a generator model
(schoollibrary.genmodel) will be created. The latter is opened in the main
view.<br/>
<img src="images/img106.gif" alt="Opened generator"/><br/>
&nbsp;</li>
</ul>
<hr/>
<p style="text-align: right"><a id="step1b" name="step1b">&nbsp;</a><a href="#top">contents</a></p>
<h2>Step 1b: Define the Model Using Annotated Java</h2>
<p>Here are the annotated Java interfaces for the schoollibrary package. We
can generate the generator model from these interface file, instead of a Rose
model.</p>
<blockquote>
<b><a target="_code" href="images/../SchoolLibrary.java">SchoolLibrary.java</a></b><a name="schoollibrarysrc">&nbsp;</a><br/>
<table border="1" frame="box"><tr><td>
<pre>package org.eclipse.example.schoollibrary;
import org.eclipse.example.library.Library;
/**
* @model
*/
public interface SchoolLibrary extends Library
{
/**
* @model
*/
String getLocation();
}</pre>
</td></tr></table>
</blockquote>
<blockquote>
<b><a target="_code" href="images/../Asset.java">Asset.java</a></b><a name="assetsrc">&nbsp;</a><br/>
<table border="1" frame="box"><tr><td>
<pre>package org.eclipse.example.schoollibrary;
/**
* @model
*/
public interface Asset
{
/**
* @model
*/
float getValue();
}</pre>
</td></tr></table>
</blockquote>
<blockquote>
<b><a target="_code" href="images/../SchoolBook.java">SchoolBook.java</a></b><a name="schoolbooksrc.java">&nbsp;</a><br/>
<table border="1" frame="box"><tr><td>
<pre>package org.eclipse.example.schoollibrary;
import org.eclipse.example.library.Book;
/**
* @model
*/
public interface SchoolBook extends Book, Asset
{
}</pre>
</td></tr></table>
</blockquote>
<p>Create a new Java project in the workspace:</p>
<ul>
<li>Bring up the "File/New/Project..." dialog.<br/>
<img src="images/../../clibmod/images/img101.gif" alt="File/New/Project..."/><br/>
&nbsp;</li>
<li>Expand "Java" and select "Java Project". Click the "Next" button.<br/>
<img src="images/../../clibmod/images/img121.gif" alt="Java Project"/><br/>
&nbsp;</li>
<li>Give the project a name, say, "schoollibrary", and ensure that
"Create separate source and output folders" is selected. Then, click the "Next"
button.<br/>
<img src="images/img121.gif" alt="Name the project"/><br/>
&nbsp;</li>
<li>Change the default output folder to "library/runtime" and switch to the
"Projects" tab.<br/>
<img src="images/img122.gif" alt="Specify default output folder"/><br/>
&nbsp;</li>
<li>Select "library" as a required project on the build path and click the
"Finish" button.<br/>
<img src="images/img123.gif" alt="Select dependent project"/><br/>
&nbsp;</li>
<li>The newly created Java project can be seen in the Package Explorer.<br/>
<img src="images/img124.gif" alt="Schoollibrary Java project"/><br/>
&nbsp;</li>
</ul>
<p>You could create and type in the interfaces as in the previous tutorial, but
instead, we will show here how to import them from the zip file
<a href="images/../schoollibrary.zip">schoollibrary.zip</a>. Save this file
somewhere on your workstation.</p>
<ul>
<li>Right-click the "src" folder and select "Import..." from the pop-up
menu.<br/>
<img src="images/img125.gif" alt="Import..."/><br/>
&nbsp;</li>
<li>Select "Zip file" as the import source and click the "Next" button.<br/>
<img src="images/img126.gif" alt="Select an import source"/><br/>
&nbsp;</li>
<li>Click the "Browse" button and locate the zip file. Ensure that all of the
zip file's contents are selected. You can expand the folder tree and click
"schoollibrary" to see the files it contains. Ensure that they will be imported
into "schoollibrary/src". Click the "Finish" button.<br/>
<img src="images/img127.gif" alt="Select a zip file"/><br/>
&nbsp;</li>
<li>Expand the "src" folder and observe that the interfaces were imported.<br/>
<img src="images/img128.gif" alt="Imported interfaces"/><br/>
&nbsp;</li>
</ul>
<p>Create the EMF models:</p>
<ul>
<li>Right-click the "src" folder and select "New/Other..." from the pop-up
menu.<br/>
<img src="images/img129.gif" alt="New/Other..."/><br/>
&nbsp;</li>
<li>Expand "Eclipse Modeling Framework" and select "EMF Models". Click the
"Next" button.<br/>
<img src="images/../../clibmod/images/img131.gif" alt="EMF Models"/><br/>
&nbsp;</li>
<li>Change the folder to "schoollibrary/src/model" and the file name to
"schoollibrary.genmodel". Click the "Next" button.<br/>
<img src="images/img130.gif" alt="Enter the folder and filename"/><br/>
&nbsp;</li>
<li>Select "Load from annotated Java" and click the "Next" button.<br/>
<img src="images/../../clibmod/images/img134.gif" alt="Load from annotated Java"/><br/>
&nbsp;</li>
<li>Select the "schoollibrary" package and click the "Finish" button.<br/>
<img src="images/img131.gif" alt="Check schoollibrary"/><br/>
&nbsp;</li>
<li>A core model (schoollibrary.ecore) and a generator model
(schoollibrary.genmodel) will be created. The latter is opened in the main
view.<br/>
<img src="images/img132.gif" alt="Opened generator"/><br/>
&nbsp;</li>
</ul>
<hr/>
<p style="text-align: right"><a id="step2" name="step2">&nbsp;</a><a href="#top">contents</a></p>
<h2>Step 2: Generate the EMF Model and Editor Code</h2>
<p>The generator model shows a root object, representing the whole model. This
model object's children represent the packages in the model.</p>
<ul>
<li>Expand the model to see its various elements. Notice that the icon for the
"Library" package has a overlayed arrow, indicating that it is a reference to
the package defined in the existing library project.<br/>
<img src="images/img201.gif" alt="Expanded generator model"/><br/>
&nbsp;</li>
<li>You can generate the model code and the editors for all the packages in the
model in a single step by right-clicking on the root element and selecting
"Generate All" from the pop-up menu.<br/>
<img src="images/img202.gif" alt="Generate All"/><br/>
&nbsp;</li>
<li>Code is generated into the schoollibrary, schoollibrary.edit, and
schoollibrary.editor projects. No code for the referenced model, library, will
be generated.<br/>
<img src="images/img203.gif" alt="Gereated files"/><br/>
&nbsp;</li>
</ul>
<p>The code should be compiled automatically as it is generated, and should
recompile whenever it is changed. If you have disabled automatic building in the
workbench preferences, do not forget to rebuild the code whenever it
changes.</p>
<hr/>
<p style="text-align: right"><a id="step3" name="step3">&nbsp;</a><a href="#top">contents</a></p>
<h2>Step 3: Run the Generated Editor</h2>
<p>In order to test the new plug-ins, a second instance of Eclipse, called a
run-time workbench must be launched. The plug-ins will run in this
workbench.</p>
<ul>
<li>Select "Run As/Run-time Workbench" from the "Run" toolbar drop-down.<br/>
<img src="images/../../clibmod/images/img401.gif" alt="Run As/Run-time Workbench"/><br/>
&nbsp;</li>
<li>Wait for a second instance of the Eclipse platform to come up. Bring up the
"Help/About Eclipse Platform" dialog, click on the "Plug-in Details" button, and
verify that the generated plug-ins are there.<br/>
<img src="images/img301.gif" alt="Plug-in Details"/><br/>
&nbsp;</li>
</ul>
<p>The Schoollibrary Model wizard can now be used to create a new instance of
the model.</p>
<ul>
<li>Bring up the "File/New/Project..." dialog. Expand "Simple", select
"Project", and click the "Next" button. Give the project a name and click the
"Finish" button.<br/>
<img src="images/img302.gif" alt="Name the project"/><br/>
&nbsp;</li>
<li>Right-click the project and select "New/Other..." from the pop-up menu.<br/>
<img src="images/img303.gif" alt="New/Other..."/><br/>
&nbsp;</li>
<li>Expand "Example EMF Model Creation Wizards" and select "Schoollibrary
Model". Click the "Next" button.<br/>
<img src="images/img304.gif" alt="Schoollibrary Model"/><br/>
&nbsp;</li>
<li>Enter a file name for the schoollibrary model. Make sure it ends with
a ".schoollibrary" extension. Then, click the "Next" button.<br/>
<img src="images/img305.gif" alt="Name the schoollibrary model file"/><br/>
&nbsp;</li>
<li>Select "SchoolLibrary" as the model object and click the "Finish"
button.<br/>
<img src="images/img306.gif" alt="Select the model object"/><br/>
&nbsp;</li>
<li>The newly created model is opened in the main view.<br/>
<img src="images/img307.gif" alt="New schoollibrary model"/><br/>
&nbsp;</li>
</ul>
<p>The root object in this editor corresponds to the My.schoollibrary resource.
Note that the object beneath it is indeed a school library.</p>
<ul>
<li>Expand the "platform:/resource/librarytest/My.schoollibrary" resource to see
the "School Library" object. Select it.<br/>
<img src="images/img308.gif" alt="Expanded resource"/><br/>
&nbsp;</li>
<li>If the Properties view isn't already showing, right-click the "School
Library" object and select "Show Properties View" from the pop-up menu. Enter
some values for the "Location" and "Name" attributes.<br/>
<img src="images/img309.gif" alt="School library properties"/><br/>
&nbsp;</li>
<li>Right-click the school library and select "New Child" from the pop-up menu.
Notice that three kinds of objects can be created under a school library:
"Writer", "Book", and "School Book". Writer and Book are defined in the library
package, while SchoolBook is defined in the schoollibrary package.<br/>
<img src="images/img310.gif" alt="New Child"/><br/>
&nbsp;</li>
<li>Create a couple writers, a book, and a school book. Notice that SchoolBook
inherits all the attributes of Book and adds an extra attribute (value), as we
intended.<br/>
<img src="images/img311.gif" alt="School book properties"/><br/>
&nbsp;</li>
<li>Save the model.<br/>
<img src="images/img312.gif" alt="File/Save"/><br/>
&nbsp;</li>
</ul>
<p>Quit the run-time workbench, returning to original, development
workbench.</p>
<hr/>
<p style="text-align: right"><a id="step4" name="step4">&nbsp;</a><a href="#top">contents</a></p>
<h2>Step 4: Modify the Editor</h2>
<p>This part of the tutorial will show how to modify the code that gets
generated. We'll just change a label in the generated editor, but we'll do it in
a few different, illustrative ways.</p>
<p>First, we'll make a change in the generator model, which will affect the
code that gets generated.</p>
<ul>
<li>In the school library generator model, select the "SchoolLibrary" class.
In the Properties view, change the "Label Feature" to the "location : EString"
attribute. This determines which feature will be used in the label for
SchoolLibrary objects.<br/>
<img src="images/img401.gif" alt="Change the Label Feature"/><br/>
&nbsp;</li>
<li>To have this change take effect, we don't have to regenerate all the code.
We just need to regenerate the item provider class for SchoolLibrary. Save
your changes, then right-click "SchoolLibrary" and select "Generate Edit Code"
from the pop-up menu. There is also no harm in regenerating all the code -- it
just takes longer.<br/>
<img src="images/img402.gif" alt="Generate Edit Code"/><br/>
&nbsp;</li>
</ul>
<p>You can examine the timestamps on the generated files to satisfy yourself
that, indeed, only SchoolLibraryItemProvider.java was regenerated.</p>
<p>The following table summarizes the files that are generated by the "Generate
Model Code", "Generate Edit Code" and "Generate Editor Code" menu items in the
context-sensitive menus of different objects. The "Generate All" menu item
is equivalent to selecting all three menu items.</p>
<table cellpadding="2" cellspacing="2" border="1" width="100%">
<tr>
<td valign="top">&nbsp;</td>
<td valign="top">Generate Model Code</td>
<td valign="top">Generate Edit Code</td>
<td valign="top">Generate Editor Code</td>
</tr>
<tr>
<td valign="top">Model &lt;M&gt;</td>
<td valign="top">
plugin.xml<br/>
&lt;M&gt;Plugin.java&nbsp;*<br/>
...plus the files for each package
</td>
<td valign="top">
plugin.xml<br/>
plugin.properties<br/>
&lt;M&gt;EditPlugin.java<br/>
...plus the files for each package
</td>
<td valign="top">
plugin.xml<br/>
plugin.properties<br/>
&lt;M&gt;EditorPlugin.java<br/>
...plus the files for each package
</td>
</tr>
<tr>
<td valign="top">Package &lt;P&gt;</td>
<td valign="top">
&lt;P&gt;Package.java<br/>
&lt;P&gt;PackageImpl.java<br/>
&lt;P&gt;Factory.java<br/>
&lt;P&gt;FactoryImpl.java<br/>
&lt;P&gt;Switch.java<br/>
&lt;P&gt;AdaptorFactory.java<br/>
&lt;P&gt;ResourceImpl.java&nbsp;*<br/>
&lt;P&gt;ResourceFactoryImpl.java&nbsp;*<br/>
&lt;P&gt;Validator.java&nbsp;*<br/>
...plus the files for each class and enum
</td>
<td valign="top">
&lt;P&gt;ItemProviderAdaptorFactory.java<br/>
...plus the files for each class
</td>
<td valign="top">
&lt;P&gt;Editor.java<br/>
&lt;P&gt;ModelWizard.java<br/>
&lt;P&gt;ActionBarContributor.java<br/>
</td>
</tr>
<tr>
<td valign="top">Class &lt;C&gt; </td>
<td valign="top">
&lt;C&gt;.java<br/>
&lt;C&gt;Impl.java
</td>
<td valign="top">&lt;C&gt;ItemProvider.java</td>
<td valign="top">&nbsp;</td>
</tr>
<tr>
<td valign="top">Enum &lt;E&gt;</td>
<td valign="top">&lt;E&gt;.java </td>
<td valign="top">&nbsp;</td>
<td valign="top">&nbsp;</td>
</tr>
</table>
<p>* These files are not generated by default.</p>
<p>Now, we can test our change.</p>
<ul>
<li>Launch the run-time workbench again and open the "My.schoollibrary"
resource. Expand the resource object and select the school library. Notice that
the location of the school library is shown in the label, instead of its
name.<br/>
<img src="images/img403.gif" alt="School Library with location label"/><br/>
&nbsp;</li>
</ul>
<p>Suppose now that you don't like the prefix "School Library" in the label and
want to get rid of it. The only way to do this is to edit the code, but it is an
easy change to make.</p>
<p>As described in the <a href="../../references/overview/EMF.Edit.html">EMF.Edit
Framework Overview</a>, EMF.Edit uses item providers to, among other things,
determine what label to display for a given type of object. In particular, it
is the getText() method that does this, and that we'll need to change.</p>
<ul>
<li>In the Package Explorer, expand the "schoollibrary.edit" project. Locate and
open "SchoolLibraryItemProvider.java".<br/>
<img src="images/img404.gif" alt="Locate SchoolLibraryItemProvider.java"/><br/>
&nbsp;</li>
<li>Locate the "getText()" method in the Outline view and select it.<br/>
<img src="images/img405.gif" alt="Select getText()"/><br/>
&nbsp;</li>
<li>The cursor in the Java editor will move to that method.<br/>
<img src="images/img406.gif" alt="Generated implementation of getText()"/><br/>
&nbsp;</li>
<li>Remove the second getString() invocation, which preprends the externalized
class name string, from the return statement. To ensure the change is not lost
when the code is regenerated, the "@generated" Javadoc tag needs to be removed
as well.<br/>
<img src="images/img407.gif" alt="Modified getText() implementation"/><br/>
&nbsp;</li>
<li>Save the change, launch the run-time workbench again, and open
"My.schoollibrary". Notice that the label for the school library now contains
just the value of its location attribute.<br/>
<img src="images/img408.gif" alt="School library with unqualified location label"/><br/>
&nbsp;</li>
</ul>
<p>We have changed the implementation of getText() from what was originally
generated. The label feature property on the SchoolLibrary class in the
generator model no longer has any effect on the generated code. This is because
we have removed the @generated Javadoc tag, preventing this method from being
overwritten during code generation.</p>
<p>Now suppose that you have not yet decided whether the editor should display
the value of the location attribute or of the name attribute. Instead, you want
to be able to change it via the generator model later. However, you know that
you don't want the "School Library" prefix to be displayed. Essentially, you
would like to keep the generated implementation available to be used by a
hand-coded method that removes the prefix from whatever it returns. The new
method must be called "getText()", so the generated method must be renamed.</p>
<p>Fortunately, the EMF code generator supports this: when a method it is going
to generate would conflict with a method that does not have an @generated tag,
it looks for a method with the same name plus the suffix "Gen". If the method
exists and is tagged with "@generated", the implementation will be generated
into this method, instead.</p>
<ul>
<li>Rename the getText() method to "getTextGen(), keeping its "@generated" tag
intact. To show that it will really be regenerated, remove the method body and
replace it by a single return statement. Create a getText() method that removes
the prefix from the string returned by getTextGen().<br/>
<img src="images/img409.gif" alt="Empty getTextGen() implementation and hand-coded getText()"/><br/>
&nbsp;</li>
<li>Save SchoolLibraryItemProvider.java, switch back to the generator model,
select "SchoolLibrary", and regenerate the edit code.<br/>
<img src="images/img410.gif" alt="Generate Edit Code"/><br/>
&nbsp;</li>
<li>Switch back to the getTextGen() method in SchoolLibraryItemProvider.java.
Notice that the original implementation has been generated back into it.<br/>
<img src="images/img411.gif" alt="Regenerated getTextGen()"/><br/>
&nbsp;</li>
</ul>
<p>You can go back to the generator model, change the label feature property,
regenerate the code, and verify that that does indeed affect the generated
code.</p>
<hr/>
<p style="text-align: right"><a id="appendix" name="appendix">&nbsp;</a><a href="#top">contents</a></p>
<h2>Appendix: An Alternative Way to Generate the Model</h2>
<p>If you do not already have the base library model its editor generated in
separate projects, you can generate both the library and school library models
into the same set of projects in a single step. This can be done either from
the Rose model or the set of annotated Java interfaces.</p>
<p>Starting with the Rose model, the process is the same as described above,
except that both packages are selected for code generation.</p>
<ul>
<li>On the last page of the New Project wizard, select both the "library" and
"schoollibrary" packages, instead of referencing one.<br/>
<img src="images/img501.gif" alt="Select the library and schoollibrary packages for code generation"/><br/>
&nbsp;</li>
</ul>
<p>Starting with annotated Java interfaces, both packages are imported into a
single Java project before any code generation is done.</p>
<ul>
<li>Import the packages from <a href="images/../library.zip">library.zip</a> and
<a href="images/../schoollibrary.zip">schoollibrary.zip</a>.<br/>
&nbsp;</li>
<li>On the last page of the New Models wizard, select both the "library" and
"schoollibrary" packages.<br/>
<img src="images/img502.gif" alt="Select the library and schoollibrary packages for code generation"/><br/>
&nbsp;</li>
</ul>
<p>When you launch the run-time workspace to test the new editor, you may
notice one small difference in the editor for the library model, as compared to
when we generated it separately from the schoollibrary model.</p>
<ul>
<li>Create or open a library model, expand the resource object, and right-click
the "Library" object. Select the "New Child" menu item.<br/>
<img src="images/img503.gif" alt="New Child"/><br/>
&nbsp;</li>
</ul>
<p>Notice that there are three types of children available, whereas in the
previous tutorial, there were only two. Specifically, "School Book", which comes
from the schoollibrary package, is included. Previously, the code generator was
not aware of it when generating the item provider for Library. Now, since the
two packages were generated together, the base package knows all about the
package that extends it.</p>
<hr/>
<p style="text-align: right"><a href="#top">contents</a></p>
</body>
</html>