| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
| <html> |
| <head> |
| <title>Define script execution context : <context> tag</title> |
| <link rel="stylesheet" type="text/css" href="userguide.css"> |
| </head> |
| |
| <body> |
| |
| <h1>Define script execution context : <context> tag</h1> |
| <p>Before a <strong><gendoc> </strong>tag, a <strong><context> </strong> |
| must have been defined to determine the model and the element to use as starting context.</p> |
| |
| <p><a name="#_<context>_tag_"/><strong><context> </strong> |
| tag can contain the following attributes :</p> |
| <ul> |
| <li><strong>model</strong> : Model absolute path (<a href="configure_generation.html#_Define_global_parameters"> |
| global parameters</a> can be used)</li> |
| <li><strong>element</strong> : Path to the model element to use as script context (path from model root)</li> |
| <li><strong>importedBundles</strong> : List of external bundles names (separated by ‘;’ character)</li> |
| <li><strong>searchMetamodels</strong> : false(default)/true. <br /> Set to “true” when your model |
| uses element from external meta-models, for example with SysML, when both UML and SysML meta-models are used.</li> |
| </ul> |
| |
| <div class="codeBox"> |
| <p class="code"><span class="red"><context </span><br/> |
|   model='${model_folder}/model_1.uml'<br/> |
|   element='model/package1/subpackage1'<br/> |
|   importedBundles='gmf;papyrus'<br/> |
|   searchMetamodels='true'<br/> |
| <span class="red">/></span></p> |
| </div> |
| |
| <p>The context tag <strong>must be defined at least once </strong>in the document.</p> |
| <p>When executing a script, the <strong>last defined</strong> context is used.</p> |
| <p>Values of the attributes that are not updated are <strong>kept from previous context.<br /></strong> |
| For example, “importedBundles” attribute can be defined only once in the document and will |
| be kept until a new value is indicated.</p> |
| |
| <h2>Dealing with specific models</h2> |
| |
| <h3>Using multiple meta-models</h3> |
| |
| <p>If the model selected references another meta-model, set the following attribute to “true” |
| in order for gendoc to analyse meta-models used as references.</p> |
| <div class="codeBox"> |
| <p class="code">searchMetamodels='true'</p> |
| </div> |
| |
| <h3>Meta-models where elements have no ‘name’ feature</h3> |
| |
| <p>With specific meta-models where elements have no ‘name’ property, context elements are defined:</p> |
| <ul> |
| <li>Using another property for all the elements in path |
| <ul> |
| <li>Ex : <span class="code"><context … element='id1/id2/id3' labelFeature='id'/> </span><br /> |
| Property ‘id’ is used for all elements in path</li> |
| <li>Note : standard case is equivalent to <context … element='modelRoot/package1/subPackage1' |
| labelFeature='name'/></li> |
| </ul> |
| </li> |
| <li>Using another property only for some elements in path |
| <ul> |
| <li>Ex : <span class="code"><context … element='modelRoot/id=“id2”/subPackage1'/></span> <br /> |
| Property ‘id’ is used only for the package part of the element path<br /> Property ‘name’ is used for others</li> |
| </ul> |
| </li> |
| <li>Using indexes of the position inside model tree (starting at 0 and not 1) |
| <ul> |
| <li>Ex: <span class="code"><context … element='modelRoot/{1}/subPackage1'/></span> <br/> |
| If package2 is at the second place inside the model.</li> |
| </ul> |
| </li> |
| </ul> |
| </body> |
| </html> |