blob: 8fca4e1c7122a1097a8afb784113b23559ee6488 [file] [log] [blame]
<br style="clear:both;height:1em;">
<div id="leftcol">
<div class="nav-logo">
<a href="index.php"><img src="logo.png" style="margin-left:10px; width:155px"/></a>
</div>
<ul id="leftnav">
<li class="partentry" >
Documentation
</li>
<li class="separator"><div class="separator">
<img src="triangle.gif" style="height:12px; margin-right: 2px; display:none" /><img src="triangle-90.gif" style="display:none; margin-right: 2px" height="12px" />
<a href="01-Introduction.php">Introduction</a></div>
</li>
<li class="separator"><div class="separator">
<img src="triangle.gif" style="height:12px; margin-right: 2px; " /><img src="triangle-90.gif" style="display:none; margin-right: 2px" height="12px" />
<a href="02-GettingStarted.php">Getting Started</a></div>
<ul style="display: none;" id="subToc_02-GettingStarted.html">
<li id="02-GettingStarted.html#Installation.html" ><a href="02-GettingStarted.php#Installation.php" >Installation</a></li>
<li id="02-GettingStarted.html#FirstExample.html" ><a href="02-GettingStarted.php#FirstExample.php" >First Example</a></li>
<li id="02-GettingStarted.html#RCPMail.html" ><a href="02-GettingStarted.php#RCPMail.php" >RCP Mail Example</a></li>
</ul>
</li>
<li class="separator"><div class="separator">
<img src="triangle.gif" style="height:12px; margin-right: 2px; " /><img src="triangle-90.gif" style="display:none; margin-right: 2px" height="12px" />
<a href="03-Components.php">Components</a></div>
<ul style="display: none;" id="subToc_03-Components.html">
<li id="03-Components.html#FormComponent.html" ><a href="03-Components.php#FormComponent.php" >Form Component</a></li>
<li id="03-Components.html#TreeComponent.html" ><a href="03-Components.php#TreeComponent.php" >Tree Component</a></li>
<li id="03-Components.html#TreeFormComponent.html" ><a href="03-Components.php#TreeFormComponent.php" >Tree Form Component</a></li>
<li id="03-Components.html#TableComponent.html" ><a href="03-Components.php#TableComponent.php" >Table Component</a></li>
</ul>
</li>
<li class="separator"><div class="separator">
<img src="triangle.gif" style="height:12px; margin-right: 2px; " /><img src="triangle-90.gif" style="display:none; margin-right: 2px" height="12px" />
<a href="04-Customization.php">Customization</a></div>
<ul style="display: none;" id="subToc_04-Customization.html">
<li id="04-Customization.html#ResourceManagers.html" ><a href="04-Customization.php#ResourceManagers.php" >Managing Resources</a></li>
<li id="04-Customization.html#Providers.html" ><a href="04-Customization.php#Providers.php" >Providers</a></li>
<li id="04-Customization.html#SelectionAndMenu.html" ><a href="04-Customization.php#SelectionAndMenu.php" >Selection And Menu</a></li>
<li id="04-Customization.html#Builders.html" ><a href="04-Customization.php#Builders.php" >Builders</a></li>
<li id="04-Customization.html#Factories.html" ><a href="04-Customization.php#Factories.php" >Factories</a></li>
<li id="04-Customization.html#Viewers.html" ><a href="04-Customization.php#Viewers.php" >Viewers</a></li>
</ul>
</li>
<li class="separator"><div class="separator">
<img src="triangle.gif" style="height:12px; margin-right: 2px; " /><img src="triangle-90.gif" style="display:none; margin-right: 2px" height="12px" />
<a href="05-DSL.php">EMF Parsley DSL</a></div>
<ul style="display: none;" id="subToc_05-DSL.html">
<li id="05-DSL.html#xbase.html" ><a href="05-DSL.php#xbase.php" >Xbase features</a></li>
</ul>
</li>
<li class="separator"><div class="separator">
<img src="triangle.gif" style="height:12px; margin-right: 2px; display:none" /><img src="triangle-90.gif" style="display:none; margin-right: 2px" height="12px" />
<a href="06-AdvancedComponents.php">Advanced Components</a></div>
</li>
<li class="separator"><div class="separator">
<img src="triangle.gif" style="height:12px; margin-right: 2px; " /><img src="triangle-90.gif" style="display:none; margin-right: 2px" height="12px" />
<a href="07-Eclipse4.php">Eclipse 4</a></div>
<ul style="display: none;" id="subToc_07-Eclipse4.html">
<li id="07-Eclipse4.html#GetFirstExample.html" ><a href="07-Eclipse4.php#GetFirstExample.php" >First Example Setup</a></li>
<li id="07-Eclipse4.html#PrepareForEclipse4Application.html" ><a href="07-Eclipse4.php#PrepareForEclipse4Application.php" >Preparing for a pure Eclipse 4 Application</a></li>
<li id="07-Eclipse4.html#CreateEclipse4Application.html" ><a href="07-Eclipse4.php#CreateEclipse4Application.php" >Create an Eclipse 4 Application</a></li>
<li id="07-Eclipse4.html#Eclipse4ApplicationAndEMFParsley.html" ><a href="07-Eclipse4.php#Eclipse4ApplicationAndEMFParsley.php" >Using an EMF Parsley TreeComposite into an Eclipse 4 Part</a></li>
<li id="07-Eclipse4.html#Eclipse4Save.html" ><a href="07-Eclipse4.php#Eclipse4Save.php" >Adding the dirty state and Save command</a></li>
</ul>
</li>
<li class="partentry" >
Appendix
</li>
<li class="separator"><div class="separator">
<img src="triangle.gif" style="height:12px; margin-right: 2px; display:none" /><img src="triangle-90.gif" style="display:none; margin-right: 2px" height="12px" />
<a href="GettingSources.php">Getting Sources</a></div>
</li>
<li class="separator"><div class="separator">
<img src="triangle.gif" style="height:12px; margin-right: 2px; display:none" /><img src="triangle-90.gif" style="display:none; margin-right: 2px" height="12px" />
<a href="Downloads.php">EMF Parsley - Downloads</a></div>
</li>
</ul>
</div>
<div id="midcolumn">
<a name="Customization" ></a>
<h1>Customization</h1>
<div class="toc">
<ul>
<li><a href="04-Customization.php#ResourceManagers.php" >Managing Resources</a></li>
<li><a href="04-Customization.php#Providers.php" >Providers</a></li>
<li><a href="04-Customization.php#SelectionAndMenu.php" >Selection And Menu</a></li>
<li><a href="04-Customization.php#Builders.php" >Builders</a></li>
<li><a href="04-Customization.php#Factories.php" >Factories</a></li>
<li><a href="04-Customization.php#Viewers.php" >Viewers</a></li>
</ul>
</div>
<a name="ResourceManagers" ></a>
<span style="float:left; border-top: 1px dotted #d4d4dd; margin-left: 0; margin-top: 5px;
padding: 5px 0;
padding-top: 5px;"></span><a style="float: right" href="#">Top</a>
<br style="clear:both"></br>
<h1>Managing Resources</h1>
<div class="toc">
<ul>
<li><a href="04-Customization.php#ResourceLoader.php" >Resource Loader</a></li>
<li><a href="04-Customization.php#EmptyResourceInitializer.php" >Empty Resource Initializer</a></li>
<li><a href="04-Customization.php#EditingDomainFinder.php" >Editing Domain Finder</a></li>
<li><a href="04-Customization.php#ResourceSaveManager.php" >Resource Save Manager</a></li>
</ul>
</div>
<a name="ResourceLoader" ></a>
<h2>Resource Loader</h2>
<p>
The class <a class="jdoc" href="http://download.eclipse.org/modeling/emf/emf/javadoc/2.9.0/org/eclipse/emf/parsley/resource/ResourceLoader.html" title="org.eclipse.emf.parsley.resource.ResourceLoader">ResourceLoader</abbr></a> <a class="srcLink" href="https://github.com/eclipse/emf/blob/R2_8_0/plugins/org.eclipse.emf.ecore/src/org/eclipse/emf/parsley/resource/ResourceLoader.java" title="View Source Code" >(src)</a> can be used to handle resource loading.
This class uses internally the <a href="04-Customization.php#EmptyResourceInitializer.php" title="Go to &quot;Empty Resource Initializer&quot;">Empty Resource Initializer</a>.
</p>
<a name="EmptyResourceInitializer" ></a>
<h2>Empty Resource Initializer</h2>
<p>
If you need to initialize your model, for the first use, you can define an implementation of <a class="jdoc" href="http://download.eclipse.org/modeling/emf/emf/javadoc/2.9.0/org/eclipse/emf/parsley/resource/EmptyResourceInitializer.html" title="org.eclipse.emf.parsley.resource.EmptyResourceInitializer">EmptyResourceInitializer</abbr></a> <a class="srcLink" href="https://github.com/eclipse/emf/blob/R2_8_0/plugins/org.eclipse.emf.ecore/src/org/eclipse/emf/parsley/resource/EmptyResourceInitializer.java" title="View Source Code" >(src)</a>.
When the main resource will be found empty, your code will be executed.
</p>
<a name="EditingDomainFinder" ></a>
<h2>Editing Domain Finder</h2>
<p>
The class <a class="jdoc" href="http://download.eclipse.org/modeling/emf/emf/javadoc/2.9.0/org/eclipse/emf/parsley/edit/EditingDomainFinder.html" title="org.eclipse.emf.parsley.edit.EditingDomainFinder">EditingDomainFinder</abbr></a> <a class="srcLink" href="https://github.com/eclipse/emf/blob/R2_8_0/plugins/org.eclipse.emf.ecore/src/org/eclipse/emf/parsley/edit/EditingDomainFinder.java" title="View Source Code" >(src)</a> can be inherited to provide a specific
way to find the editign domain.
</p>
<a name="ResourceSaveManager" ></a>
<h2>Resource Save Manager</h2>
<p>
Resource saving is delegated to <a class="jdoc" href="http://download.eclipse.org/modeling/emf/emf/javadoc/2.9.0/org/eclipse/emf/parsley/edit/ResourceSaveManager.html" title="org.eclipse.emf.parsley.edit.ResourceSaveManager">ResourceSaveManager</abbr></a> <a class="srcLink" href="https://github.com/eclipse/emf/blob/R2_8_0/plugins/org.eclipse.emf.ecore/src/org/eclipse/emf/parsley/edit/ResourceSaveManager.java" title="View Source Code" >(src)</a>
which, by defaults only saves the passed <a class="jdoc" href="http://download.eclipse.org/modeling/emf/emf/javadoc/2.9.0/org/eclipse/emf/ecore/resource/Resource.html" title="org.eclipse.emf.ecore.resource.Resource">Resource</abbr></a> <a class="srcLink" href="https://github.com/eclipse/emf/blob/R2_8_0/plugins/org.eclipse.emf.ecore/src/org/eclipse/emf/ecore/resource/Resource.java" title="View Source Code" >(src)</a>.
You can inject your own save manager and implement the method <span class="inlinecode">precondition(Resource)</span>, for
instance, you may want to validate the resource before saving, and in case the validation
fails to return <span class="inlinecode">false</span>. If the precondition is <span class="inlinecode">false</span> the default implementation
will not save the resource (and in turn will return <span class="inlinecode">false</span>).
</p>
<a name="ValidateResourceSaveManager" ></a>
<h3>Validate Resource Save Manager</h3>
<p>
We provide an example of custom resource save manager: <a class="jdoc" href="http://download.eclipse.org/modeling/emf/emf/javadoc/2.9.0/org/eclipse/emf/parsley/edit/ValidateResourceSaveManager.html" title="org.eclipse.emf.parsley.edit.ValidateResourceSaveManager">ValidateResourceSaveManager</abbr></a> <a class="srcLink" href="https://github.com/eclipse/emf/blob/R2_8_0/plugins/org.eclipse.emf.ecore/src/org/eclipse/emf/parsley/edit/ValidateResourceSaveManager.java" title="View Source Code" >(src)</a>,
we show here only relevant parts to give an example:
</p>
<p>
<div class="literallayout">
<div class="incode">
<p class="code">
<span class="keyword">public</span>&nbsp;<span class="keyword">class</span>&nbsp;ValidateResourceSaveManager&nbsp;<span class="keyword">extends</span>&nbsp;ResourceSaveManager&nbsp;{<br/>
<br/>
&nbsp;&nbsp;&nbsp;&nbsp;@Override<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">protected</span>&nbsp;<span class="keyword">boolean</span>&nbsp;precondition(Resource&nbsp;resource)&nbsp;{<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">return</span>&nbsp;<span class="keyword">super</span>.precondition(resource)&nbsp;&amp;&amp;&nbsp;validateModel(resource);<br/>
&nbsp;&nbsp;&nbsp;&nbsp;}<br/>
<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">protected</span>&nbsp;<span class="keyword">boolean</span>&nbsp;validateModel(Resource&nbsp;resource)&nbsp;{<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">for</span>&nbsp;(EObject&nbsp;eObject&nbsp;:&nbsp;resource.getContents())&nbsp;{<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Diagnostic&nbsp;diagnostic&nbsp;=&nbsp;Diagnostician.INSTANCE.validate(eObject);<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">if</span>&nbsp;(diagnostic.getSeverity()&nbsp;==&nbsp;Diagnostic.ERROR)&nbsp;{<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="comment">//&nbsp;SKIPPED:&nbsp;present&nbsp;the&nbsp;errors<br/>
</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">return</span>&nbsp;false;<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;<span class="keyword">else</span>&nbsp;<span class="keyword">if</span>&nbsp;(diagnostic.getSeverity()&nbsp;==&nbsp;Diagnostic.WARNING)&nbsp;{<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="comment">//&nbsp;SKIPPED:&nbsp;present&nbsp;the&nbsp;warnings<br/>
</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">return</span>&nbsp;true;<br/>
&nbsp;&nbsp;&nbsp;&nbsp;}<br/>
}
</p>
</div>
</div>
</p>
<a name="Providers" ></a>
<span style="float:left; border-top: 1px dotted #d4d4dd; margin-left: 0; margin-top: 5px;
padding: 5px 0;
padding-top: 5px;"></span><a style="float: right" href="#">Top</a>
<br style="clear:both"></br>
<h1>Providers</h1>
<div class="toc">
<ul>
<li><a href="04-Customization.php#FeaturesProvider.php" >Features Provider</a></li>
<li><a href="04-Customization.php#PropertyDescriptionProvider.php" >Feature Caption Provider</a></li>
<li><a href="04-Customization.php#ViewerLabelProvider.php" >Viewer Label Provider</a></li>
<li><a href="04-Customization.php#ViewerContentProvider.php" >Viewer Content Provider</a></li>
<li><a href="04-Customization.php#ProposalProvider.php" >Proposal Provider</a></li>
<li><a href="04-Customization.php#ViewerContextMenuFactory.php" >Viewer Context Menu Factory</a></li>
<li><a href="04-Customization.php#TableColumnLabelProvider.php" >Table Column Label Provider</a></li>
</ul>
</div>
<a name="FeaturesProvider" ></a>
<h2>Features Provider</h2>
<p>
<em>This can be done with Parsley DSL too!</em>
<div class="todo" >
TODO: merge delle 2 versioni
</div>
</p>
<a name="FeatureProvider1" ></a>
<h3>Prima versione</h3>
<p>
To customize the <em>feature list</em> it can be injected a <a class="jdoc" href="http://download.eclipse.org/modeling/emf/emf/javadoc/2.9.0/org/eclipse/emf/parsley/ui/provider/FeaturesProvider.html" title="org.eclipse.emf.parsley.ui.provider.FeaturesProvider">FeaturesProvider</abbr></a> <a class="srcLink" href="https://github.com/eclipse/emf/blob/R2_8_0/plugins/org.eclipse.emf.ecore/src/org/eclipse/emf/parsley/ui/provider/FeaturesProvider.java" title="View Source Code" >(src)</a>.
The default is to return the list of all the features in the EClass, but the programmer can customize it (for instance,
by returning only a superset, or using a different order) on an EClass-based strategy. The customization can be done
redefining buildMap and adding mappings.
</p>
<p>
<div class="literallayout">
<div class="incode">
<p class="code">
<span class="keyword">protected</span>&nbsp;<span class="keyword">void</span>&nbsp;buildMap(EClassToEStructuralFeatureMap&nbsp;map)&nbsp;{<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">super</span>.buildMap(map);<br/>
&nbsp;&nbsp;&nbsp;&nbsp;map.mapTo(LIBRARY,LIBRARY__NAME,&nbsp;ADDRESSABLE__ADDRESS);<br/>
}
</p>
</div>
</div>
</p>
<p>
In the example we specify that for the EClass <em>Library</em> the feature that are to be displayed are <em>name</em>
and <em>address</em>.
</p>
<a name="FeatureProvider2" ></a>
<h3>Seconda versione</h3>
<p>
When the framework builds components according to the
<a class="jdoc" href="http://download.eclipse.org/modeling/emf/emf/javadoc/2.9.0/org/eclipse/emf/ecore/EStructuralFeature.html" title="org.eclipse.emf.ecore.EStructuralFeature">EStructuralFeature</abbr></a> <a class="srcLink" href="https://github.com/eclipse/emf/blob/R2_8_0/plugins/org.eclipse.emf.ecore/src/org/eclipse/emf/ecore/EStructuralFeature.java" title="View Source Code" >(src)</a>s of a given
<a class="jdoc" href="http://download.eclipse.org/modeling/emf/emf/javadoc/2.9.0/org/eclipse/emf/ecore/EClass.html" title="org.eclipse.emf.ecore.EClass">EClass</abbr></a> <a class="srcLink" href="https://github.com/eclipse/emf/blob/R2_8_0/plugins/org.eclipse.emf.ecore/src/org/eclipse/emf/ecore/EClass.java" title="View Source Code" >(src)</a> it relies on an injected
<a class="jdoc" href="http://download.eclipse.org/modeling/emf/emf/javadoc/2.9.0/org/eclipse/emf/parsley/ui/provider/FeaturesProvider.html" title="org.eclipse.emf.parsley.ui.provider.FeaturesProvider">FeaturesProvider</abbr></a> <a class="srcLink" href="https://github.com/eclipse/emf/blob/R2_8_0/plugins/org.eclipse.emf.ecore/src/org/eclipse/emf/parsley/ui/provider/FeaturesProvider.java" title="View Source Code" >(src)</a>.
The default behavior is to simply return all the features of the a given EClass,
in the order they are defined in the EClass;
you may want to provide a custom implementation by redefining
the method <span class="inlinecode">List&lt;EStructuralFeature&gt;&nbsp;getFeatures(EClass)</span>, or
<span class="inlinecode">List&lt;EStructuralFeature&gt;&nbsp;getFeatures(EObject)</span>,
for instance by returning the features ordered according to their name
(the following snippet uses an utility class from the framework)
</p>
<p>
<div class="literallayout">
<div class="incode">
<p class="code">
<span class="keyword">public</span>&nbsp;<span class="keyword">class</span>&nbsp;OrderedEStructuralFeaturesProvider&nbsp;<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">extends</span>&nbsp;FeaturesProvider&nbsp;{<br/>
<br/>
&nbsp;&nbsp;&nbsp;&nbsp;@Inject<br/>
&nbsp;&nbsp;&nbsp;&nbsp;EStructuralFeatureNameComparator&nbsp;comparator;<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<br/>
&nbsp;&nbsp;&nbsp;&nbsp;@Override<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">public</span>&nbsp;List&lt;EStructuralFeature&gt;&nbsp;getFeatures(EClass&nbsp;eClass)&nbsp;{<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;List&lt;EStructuralFeature&gt;&nbsp;features&nbsp;=&nbsp;<span class="keyword">super</span>.getFeatures(eClass);<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Collections.sort(features,&nbsp;<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">new</span>&nbsp;EStructuralFeatureNameComparator());<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">return</span>&nbsp;features;<br/>
&nbsp;&nbsp;&nbsp;&nbsp;}<br/>
}
</p>
</div>
</div>
</p>
<p>
Alternatively, you can set the mappings, i.e., specify the structural
features you want to be used given an EClass, by implementing
the method <span class="inlinecode">buildMap</span>, which receives the
<a class="jdoc" href="http://download.eclipse.org/modeling/emf/emf/javadoc/2.9.0/org/eclipse/emf/parsley/ui/provider/FeaturesProvider.EClassToEStructuralFeatureMap.html" title="org.eclipse.emf.parsley.ui.provider.FeaturesProvider.EClassToEStructuralFeatureMap">FeaturesProvider.EClassToEStructuralFeatureMap</abbr></a> <a class="srcLink" href="https://github.com/eclipse/emf/blob/R2_8_0/plugins/org.eclipse.emf.ecore/src/org/eclipse/emf/parsley/ui/provider/FeaturesProvider.java" title="View Source Code" >(src)</a>
that can be filled with the method <span class="inlinecode">mapTo</span>;
for instance, using the EMF extended library
example, this customization will return only the <em>name</em> and <em>address</em> features
for <span class="inlinecode">Library</span>, the <em>firstName</em>, <em>lastName</em> and <em>address</em> for
<span class="inlinecode">Person</span>, and the <em>firstName</em>, <em>lastName</em> and <em>books</em> (but
not <em>address</em>) for <span class="inlinecode">Writer</span> (which inherits from <span class="inlinecode">Person</span>).
</p>
<p>
<div class="literallayout">
<div class="incode">
<p class="code">
<span class="keyword">import</span>&nbsp;<span class="keyword">static</span>&nbsp;org.eclipse.emf.examples.extlibrary.EXTLibraryPackage.Literals.*;<br/>
<span class="keyword">import</span>&nbsp;org.eclipse.emf.parsley.ui.provider.EStructuralFeaturesProvider;<br/>
<br/>
<span class="keyword">public</span>&nbsp;<span class="keyword">class</span>&nbsp;LibraryEStructuralFeaturesProvider&nbsp;<span class="keyword">extends</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;FeaturesProvider&nbsp;{<br/>
<br/>
&nbsp;&nbsp;&nbsp;&nbsp;@Override<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">protected</span>&nbsp;<span class="keyword">void</span>&nbsp;buildMap(EClassToEStructuralFeatureMap&nbsp;map)&nbsp;{<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">super</span>.buildMap(map);<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;map.mapTo(LIBRARY,<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;LIBRARY__NAME,&nbsp;ADDRESSABLE__ADDRESS);<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;map.mapTo(PERSON,<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;PERSON__FIRST_NAME,&nbsp;PERSON__LAST_NAME,<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ADDRESSABLE__ADDRESS);<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;map.mapTo(WRITER,<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;PERSON__FIRST_NAME,&nbsp;PERSON__LAST_NAME,<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;WRITER__BOOKS);<br/>
&nbsp;&nbsp;&nbsp;&nbsp;}<br/>
}
</p>
</div>
</div>
</p>
<p>
Another possibility is to build a map which relies on Strings
both for the <a class="jdoc" href="http://download.eclipse.org/modeling/emf/emf/javadoc/2.9.0/org/eclipse/emf/ecore/EClass.html" title="org.eclipse.emf.ecore.EClass">EClass</abbr></a> <a class="srcLink" href="https://github.com/eclipse/emf/blob/R2_8_0/plugins/org.eclipse.emf.ecore/src/org/eclipse/emf/ecore/EClass.java" title="View Source Code" >(src)</a> and for
the list of <a class="jdoc" href="http://download.eclipse.org/modeling/emf/emf/javadoc/2.9.0/org/eclipse/emf/ecore/EStructuralFeature.html" title="org.eclipse.emf.ecore.EStructuralFeature">EStructuralFeature</abbr></a> <a class="srcLink" href="https://github.com/eclipse/emf/blob/R2_8_0/plugins/org.eclipse.emf.ecore/src/org/eclipse/emf/ecore/EStructuralFeature.java" title="View Source Code" >(src)</a>;
note that the name of the <a class="jdoc" href="http://download.eclipse.org/modeling/emf/emf/javadoc/2.9.0/org/eclipse/emf/ecore/EClass.html" title="org.eclipse.emf.ecore.EClass">EClass</abbr></a> <a class="srcLink" href="https://github.com/eclipse/emf/blob/R2_8_0/plugins/org.eclipse.emf.ecore/src/org/eclipse/emf/ecore/EClass.java" title="View Source Code" >(src)</a> should
be obtained by using <span class="inlinecode">getInstanceClassName()</span>; you can also
combine the two approaches (in that case the map built with
<span class="inlinecode">buildMap</span> has the precedence):
</p>
<p>
<div class="literallayout">
<div class="incode">
<p class="code">
<span class="keyword">import</span>&nbsp;<span class="keyword">static</span>&nbsp;org.eclipse.emf.examples.extlibrary.EXTLibraryPackage.Literals.*;<br/>
<span class="keyword">import</span>&nbsp;org.eclipse.emf.parsley.ui.provider.FeaturesProvider;<br/>
<br/>
<span class="keyword">public</span>&nbsp;<span class="keyword">class</span>&nbsp;LibraryEStructuralFeaturesAsStringsProvider&nbsp;<span class="keyword">extends</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;FeaturesProvider&nbsp;{<br/>
<br/>
&nbsp;&nbsp;&nbsp;&nbsp;@Override<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">protected</span>&nbsp;<span class="keyword">void</span>&nbsp;buildMap(EClassToEStructuralFeatureMap&nbsp;map)&nbsp;{<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">super</span>.buildMap(map);<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;map.mapTo(LIBRARY,&nbsp;LIBRARY__NAME,&nbsp;ADDRESSABLE__ADDRESS);<br/>
&nbsp;&nbsp;&nbsp;&nbsp;}<br/>
<br/>
&nbsp;&nbsp;&nbsp;&nbsp;@Override<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">protected</span>&nbsp;<span class="keyword">void</span>&nbsp;buildStringMap(<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;EClassToEStructuralFeatureAsStringsMap&nbsp;stringMap)&nbsp;{<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">super</span>.buildStringMap(stringMap);<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;stringMap.mapTo(PERSON.getInstanceClassName(),&nbsp;<span class="string">"firstName"</span>,&nbsp;<span class="string">"lastName"</span>,<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="string">"address"</span>);<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;stringMap.mapTo(WRITER.getInstanceClassName(),&nbsp;<span class="string">"firstName"</span>,&nbsp;<span class="string">"lastName"</span>,<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="string">"books"</span>);<br/>
<br/>
&nbsp;&nbsp;&nbsp;&nbsp;}<br/>
}
</p>
</div>
</div>
</p>
<a name="FeaturesColumnProvider" ></a>
<h3>Features Column Provider</h3>
<p>
As an extension, you can use the <a class="jdoc" href="http://download.eclipse.org/modeling/emf/emf/javadoc/2.9.0/org/eclipse/emf/parsley/ui/provider/FeaturesColumnProvider.html" title="org.eclipse.emf.parsley.ui.provider.FeaturesColumnProvider">FeaturesColumnProvider</abbr></a> <a class="srcLink" href="https://github.com/eclipse/emf/blob/R2_8_0/plugins/org.eclipse.emf.ecore/src/org/eclipse/emf/parsley/ui/provider/FeaturesColumnProvider.java" title="View Source Code" >(src)</a>:
the customizations will be applied only to <a href="03-Components.php#TableComponent.php" title="Go to &quot;Table Component&quot;">tables</a>, not to <a href="03-Components.php#FormComponent.php" title="Go to &quot;Form Component&quot;">Forms</a>.
</p>
<a name="PropertyDescriptionProvider" ></a>
<h2>Feature Caption Provider</h2>
<p>
<em>This can be done with Parsley DSL too!</em>
The <a class="jdoc" href="http://download.eclipse.org/modeling/emf/emf/javadoc/2.9.0/org/eclipse/emf/parsley/ui/provider/FeatureCaptionProvider.html" title="org.eclipse.emf.parsley.ui.provider.FeatureCaptionProvider">FeatureCaptionProvider</abbr></a> <a class="srcLink" href="https://github.com/eclipse/emf/blob/R2_8_0/plugins/org.eclipse.emf.ecore/src/org/eclipse/emf/parsley/ui/provider/FeatureCaptionProvider.java" title="View Source Code" >(src)</a> provides captions for
the features. It can be customized, with injection (see Injection paragraph), to customize the caption label on the
left of each control in a form and the headers in a table's columns.
The framework use a polimorphic mechanism to find customizations, so that It can
be written a method with a specific signature build by the keyword <em>'text'</em> followed by the EClass and the EStructuralFeature.
All parts of the name are separated by an underscore character and the method must accept a parameter of type EStructuralFeature.
</p>
<p>
In the following example we specify the caption text for the feature 'Author' of Book and the feature 'Name' for
Writer.
</p>
<p>
<div class="literallayout">
<div class="incode">
<p class="code">
<span class="keyword">public</span>&nbsp;String&nbsp;text_Book_author(<span class="keyword">final</span>&nbsp;EStructuralFeature&nbsp;feature)&nbsp;{<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">return</span>&nbsp;<span class="string">"Wrote&nbsp;by:"</span>;<br/>
}<br/>
<br/>
<span class="keyword">public</span>&nbsp;String&nbsp;text_Writer_name(<span class="keyword">final</span>&nbsp;EStructuralFeature&nbsp;feature)&nbsp;{<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">return</span>&nbsp;<span class="string">"Name:"</span>;<br/>
}
</p>
</div>
</div>
</p>
<a name="FormPropertyDescriptionProvider" ></a>
<h3>Form Feature Caption Provider</h3>
<p>
The <a class="jdoc" href="http://download.eclipse.org/modeling/emf/emf/javadoc/2.9.0/org/eclipse/emf/parsley/ui/provider/FormFeatureCaptionProvider.html" title="org.eclipse.emf.parsley.ui.provider.FormFeatureCaptionProvider">FormFeatureCaptionProvider</abbr></a> <a class="srcLink" href="https://github.com/eclipse/emf/blob/R2_8_0/plugins/org.eclipse.emf.ecore/src/org/eclipse/emf/parsley/ui/provider/FormFeatureCaptionProvider.java" title="View Source Code" >(src)</a> can be used if you want
to define the description only for the form. For example using the <a href="03-Components.php#TreeFormComponent.php" title="Go to &quot;Tree Form Component&quot;">Tree
Form</a> your definition will not be used in the tree.
</p>
<p>
In this case you can also define a method the returns directly the control, like in the example
below. In such methods there is another parameter that is the parent composite.
</p>
<p>
<div class="literallayout">
<div class="incode">
<p class="code">
<span class="keyword">public</span>&nbsp;Label&nbsp;label_Writer_name(Composite&nbsp;parent,&nbsp;EStructuralFeature&nbsp;feature)&nbsp;{<br/>
&nbsp;&nbsp;&nbsp;&nbsp;Label&nbsp;label&nbsp;=&nbsp;defaultLabel(parent,&nbsp;feature);<br/>
&nbsp;&nbsp;&nbsp;&nbsp;label.setBackground(getFormToolkit().getColors().getColor(IFormColors.TITLE));<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">return</span>&nbsp;label;<br/>
}
</p>
</div>
</div>
</p>
<a name="ViewerLabelProvider" ></a>
<h2>Viewer Label Provider</h2>
<p>
The Label Provider can be customized by providing a specific implementation of <a class="jdoc" href="http://help.eclipse.org/helios/topic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/jface/viewers/ILabelProvider.html" title="org.eclipse.jface.viewers.ILabelProvider">ILabelProvider</abbr></a>
and injecting it in the spefic module <em>(TODO)</em>.
EMF Parsley provides such an implementation with the class <a class="jdoc" href="http://download.eclipse.org/modeling/emf/emf/javadoc/2.9.0/org/eclipse/emf/parsley/ui/provider/ViewerLabelProvider.html" title="org.eclipse.emf.parsley.ui.provider.ViewerLabelProvider">ViewerLabelProvider</abbr></a> <a class="srcLink" href="https://github.com/eclipse/emf/blob/R2_8_0/plugins/org.eclipse.emf.ecore/src/org/eclipse/emf/parsley/ui/provider/ViewerLabelProvider.java" title="View Source Code" >(src)</a>
that is inteded to be surclassed by the programmer to provides specific implementations like in the example below.
</p>
<p>
<div class="literallayout">
<div class="incode">
<p class="code">
<span class="keyword">public</span>&nbsp;<span class="keyword">class</span>&nbsp;CustomLibraryLabelProvider&nbsp;<span class="keyword">extends</span>&nbsp;ViewerLabelProvider&nbsp;{<br/>
<br/>
&nbsp;&nbsp;&nbsp;&nbsp;@Inject<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">public</span>&nbsp;CustomLibraryLabelProvider(AdapterFactoryLabelProvider&nbsp;delegate)&nbsp;{<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">super</span>(delegate);<br/>
&nbsp;&nbsp;&nbsp;&nbsp;}<br/>
<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">public</span>&nbsp;String&nbsp;text(Book&nbsp;book)&nbsp;{<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">return</span>&nbsp;<span class="string">"Book:&nbsp;"</span>&nbsp;+&nbsp;book.getTitle();<br/>
&nbsp;&nbsp;&nbsp;&nbsp;}<br/>
<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">public</span>&nbsp;String&nbsp;image(Book&nbsp;book)&nbsp;{<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">return</span>&nbsp;<span class="string">"book2.png"</span>;<br/>
&nbsp;&nbsp;&nbsp;&nbsp;}<br/>
<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">public</span>&nbsp;String&nbsp;text(Borrower&nbsp;b)&nbsp;{<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">return</span>&nbsp;<span class="string">"Borrower:&nbsp;"</span>&nbsp;+&nbsp;b.getFirstName();<br/>
&nbsp;&nbsp;&nbsp;&nbsp;}<br/>
}
</p>
</div>
</div>
</p>
<a name="ViewerContentProvider" ></a>
<h2>Viewer Content Provider</h2>
<p>
The programmer can provide a specific implementation of <a class="jdoc" href="http://help.eclipse.org/helios/topic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/jface/viewers/IContentProvider.html" title="org.eclipse.jface.viewers.IContentProvider">IContentProvider</abbr></a>
by injecting it in the spefic module <em>(TODO)</em>. EMF Parsley provides an implementation with the class
<a class="jdoc" href="http://download.eclipse.org/modeling/emf/emf/javadoc/2.9.0/org/eclipse/emf/parsley/edit/ui/provider/ViewerContentProvider.html" title="org.eclipse.emf.parsley.edit.ui.provider.ViewerContentProvider">ViewerContentProvider</abbr></a> <a class="srcLink" href="https://github.com/eclipse/emf/blob/R2_8_0/plugins/org.eclipse.emf.ecore/src/org/eclipse/emf/parsley/edit/ui/provider/ViewerContentProvider.java" title="View Source Code" >(src)</a> that can be easily used to
specify the children of all object on the tree, like in the example below.
</p>
<p>
<div class="literallayout">
<div class="incode">
<p class="code">
<span class="keyword">public</span>&nbsp;<span class="keyword">class</span>&nbsp;CustomLibraryViewerContentProvider&nbsp;<span class="keyword">extends</span>&nbsp;ViewerContentProvider&nbsp;{<br/>
<br/>
&nbsp;&nbsp;&nbsp;&nbsp;@Inject<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">public</span>&nbsp;CustomLibraryViewerContentProvider(AdapterFactory&nbsp;adapterFactory)&nbsp;{<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">super</span>(adapterFactory);<br/>
&nbsp;&nbsp;&nbsp;&nbsp;}<br/>
<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">public</span>&nbsp;Object&nbsp;children(Library&nbsp;library)&nbsp;{<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">return</span>&nbsp;library.getBooks();<br/>
&nbsp;&nbsp;&nbsp;&nbsp;}<br/>
<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">public</span>&nbsp;Object&nbsp;children(Book&nbsp;book)&nbsp;{<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ArrayList&lt;Object&gt;&nbsp;children&nbsp;=&nbsp;<span class="keyword">new</span>&nbsp;ArrayList&lt;Object&gt;();<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Writer&nbsp;author&nbsp;=&nbsp;book.getAuthor();<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">if</span>&nbsp;(author&nbsp;!=&nbsp;null)&nbsp;{<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;children.add(author);<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;children.addAll(book.getBorrowers());<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">return</span>&nbsp;children;<br/>
&nbsp;&nbsp;&nbsp;&nbsp;}<br/>
}
</p>
</div>
</div>
</p>
<a name="ProposalProvider" ></a>
<h2>Proposal Provider</h2>
<p>
<em>This can be done with Parsley DSL too!</em>
Some controls use a list of proposal to help the end user experince: for example the combo box has a
list of proposal, but also the simple text can use the proposal to assist and correct the hand-writed
values. For each feature it can be specified a list of proposals using a method that starts with the
keyword <em>'proposals'</em> followed byt the EClass and Feature undescore-character-separated.
</p>
<p>
<div class="literallayout">
<div class="incode">
<p class="code">
<span class="keyword">public</span>&nbsp;List&lt;?&gt;&nbsp;proposals_Book_author(Book&nbsp;book)&nbsp;{<br/>
&nbsp;&nbsp;&nbsp;&nbsp;List&lt;Object&gt;&nbsp;proposals&nbsp;=&nbsp;<span class="keyword">new</span>&nbsp;LinkedList&lt;Object&gt;();<br/>
&nbsp;&nbsp;&nbsp;&nbsp;Writer&nbsp;writer&nbsp;=&nbsp;EXTLibraryFactory.eINSTANCE.createWriter();<br/>
&nbsp;&nbsp;&nbsp;&nbsp;writer.setFirstName(<span class="string">"Fake"</span>);<br/>
&nbsp;&nbsp;&nbsp;&nbsp;writer.setLastName(<span class="string">"Writer"</span>);<br/>
&nbsp;&nbsp;&nbsp;&nbsp;proposals.add(writer);<br/>
&nbsp;&nbsp;&nbsp;&nbsp;writer&nbsp;=&nbsp;EXTLibraryFactory.eINSTANCE.createWriter();<br/>
&nbsp;&nbsp;&nbsp;&nbsp;writer.setFirstName(<span class="string">"Fake"</span>);<br/>
&nbsp;&nbsp;&nbsp;&nbsp;writer.setLastName(<span class="string">"Writer2"</span>);<br/>
&nbsp;&nbsp;&nbsp;&nbsp;proposals.add(writer);<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">return</span>&nbsp;proposals;<br/>
}
</p>
</div>
</div>
</p>
<a name="ViewerContextMenuFactory" ></a>
<h2>Viewer Context Menu Factory</h2>
<p>
<a class="jdoc" href="http://download.eclipse.org/modeling/emf/emf/javadoc/2.9.0/org/eclipse/emf/parsley/menus/ViewerContextMenuFactory.html" title="org.eclipse.emf.parsley.menus.ViewerContextMenuFactory">ViewerContextMenuFactory</abbr></a> <a class="srcLink" href="https://github.com/eclipse/emf/blob/R2_8_0/plugins/org.eclipse.emf.ecore/src/org/eclipse/emf/parsley/menus/ViewerContextMenuFactory.java" title="View Source Code" >(src)</a>
</p>
<a name="TableColumnLabelProvider" ></a>
<h2>Table Column Label Provider</h2>
<p>
<a class="jdoc" href="http://download.eclipse.org/modeling/emf/emf/javadoc/2.9.0/org/eclipse/emf/parsley/ui/provider/TableColumnLabelProvider.html" title="org.eclipse.emf.parsley.ui.provider.TableColumnLabelProvider">TableColumnLabelProvider</abbr></a> <a class="srcLink" href="https://github.com/eclipse/emf/blob/R2_8_0/plugins/org.eclipse.emf.ecore/src/org/eclipse/emf/parsley/ui/provider/TableColumnLabelProvider.java" title="View Source Code" >(src)</a>
</p>
<a name="SelectionAndMenu" ></a>
<span style="float:left; border-top: 1px dotted #d4d4dd; margin-left: 0; margin-top: 5px;
padding: 5px 0;
padding-top: 5px;"></span><a style="float: right" href="#">Top</a>
<br style="clear:both"></br>
<h1>Selection And Menu</h1>
<div class="toc">
<ul>
<li><a href="04-Customization.php#EmfSelectionHelper.php" >Emf Selection Helper</a></li>
</ul>
</div>
<a name="EmfSelectionHelper" ></a>
<h2>Emf Selection Helper</h2>
<p>
<a class="jdoc" href="http://download.eclipse.org/modeling/emf/emf/javadoc/2.9.0/org/eclipse/emf/parsley/util/EmfSelectionHelper.html" title="org.eclipse.emf.parsley.util.EmfSelectionHelper">EmfSelectionHelper</abbr></a> <a class="srcLink" href="https://github.com/eclipse/emf/blob/R2_8_0/plugins/org.eclipse.emf.ecore/src/org/eclipse/emf/parsley/util/EmfSelectionHelper.java" title="View Source Code" >(src)</a>
</p>
<a name="Builders" ></a>
<span style="float:left; border-top: 1px dotted #d4d4dd; margin-left: 0; margin-top: 5px;
padding: 5px 0;
padding-top: 5px;"></span><a style="float: right" href="#">Top</a>
<br style="clear:both"></br>
<h1>Builders</h1>
<div class="toc">
<ul>
<li><a href="04-Customization.php#TableViewerBuilder.php" >Table Viewer Builder</a></li>
<li><a href="04-Customization.php#TableViewerColumnBuilder.php" >Table Viewer Column Builder</a></li>
</ul>
</div>
<a name="TableViewerBuilder" ></a>
<h2>Table Viewer Builder</h2>
<p>
<a class="jdoc" href="http://download.eclipse.org/modeling/emf/emf/javadoc/2.9.0/org/eclipse/emf/parsley/builders/TableViewerBuilder.html" title="org.eclipse.emf.parsley.builders.TableViewerBuilder">TableViewerBuilder</abbr></a> <a class="srcLink" href="https://github.com/eclipse/emf/blob/R2_8_0/plugins/org.eclipse.emf.ecore/src/org/eclipse/emf/parsley/builders/TableViewerBuilder.java" title="View Source Code" >(src)</a>
</p>
<p>
<ul>
<li><a href="04-Customization.php#TableViewerColumnBuilder.php" title="Go to &quot;Table Viewer Column Builder&quot;">TableViewerColumnBuilder</a></li>
<li><a href="04-Customization.php#ViewerInitializer.php" title="Go to &quot;Viewer Initializer&quot;">ViewerInitializer</a></li>
</ul>
</p>
<a name="TableViewerColumnBuilder" ></a>
<h2>Table Viewer Column Builder</h2>
<p>
<a class="jdoc" href="http://download.eclipse.org/modeling/emf/emf/javadoc/2.9.0/org/eclipse/emf/parsley/builders/TableViewerColumnBuilder.html" title="org.eclipse.emf.parsley.builders.TableViewerColumnBuilder">TableViewerColumnBuilder</abbr></a> <a class="srcLink" href="https://github.com/eclipse/emf/blob/R2_8_0/plugins/org.eclipse.emf.ecore/src/org/eclipse/emf/parsley/builders/TableViewerColumnBuilder.java" title="View Source Code" >(src)</a>
</p>
<p>
<ul>
<li><a href="04-Customization.php#JfaceProviderFactory.php" title="Go to &quot;Jface Provider Factory&quot;">JfaceProviderFactory</a></li>
<li><a href="04-Customization.php#PropertyDescriptionProvider.php" title="Go to &quot;Feature Caption Provider&quot;">PropertyDescriptionProvider</a></li>
<li><a href="04-Customization.php#FeaturesProvider.php" title="Go to &quot;Features Provider&quot;">FeaturesProvider</a></li>
</ul>
</p>
<a name="TableViewerEditableColumnBuilder" ></a>
<h3>Table Viewer Editable Column Builder</h3>
<p>
<a class="jdoc" href="http://download.eclipse.org/modeling/emf/emf/javadoc/2.9.0/org/eclipse/emf/parsley/builders/TableViewerEditableColumnBuilder.html" title="org.eclipse.emf.parsley.builders.TableViewerEditableColumnBuilder">TableViewerEditableColumnBuilder</abbr></a> <a class="srcLink" href="https://github.com/eclipse/emf/blob/R2_8_0/plugins/org.eclipse.emf.ecore/src/org/eclipse/emf/parsley/builders/TableViewerEditableColumnBuilder.java" title="View Source Code" >(src)</a>
</p>
<a name="Factories" ></a>
<span style="float:left; border-top: 1px dotted #d4d4dd; margin-left: 0; margin-top: 5px;
padding: 5px 0;
padding-top: 5px;"></span><a style="float: right" href="#">Top</a>
<br style="clear:both"></br>
<h1>Factories</h1>
<div class="toc">
<ul>
<li><a href="04-Customization.php#FormFactory.php" >Form Factory</a></li>
<li><a href="04-Customization.php#JfaceProviderFactory.php" >Jface Provider Factory</a></li>
<li><a href="04-Customization.php#FormControlFactory.php" >Form Control Factory</a></li>
<li><a href="04-Customization.php#TreeFormFactory.php" >Tree Form Factory</a></li>
<li><a href="04-Customization.php#ViewerFactory.php" >Viewer Factory</a></li>
<li><a href="04-Customization.php#AdapterFactoryEditingDomain.php" >Viewer Factory</a></li>
</ul>
</div>
<a name="FormFactory" ></a>
<h2>Form Factory</h2>
<p>
<a class="jdoc" href="http://download.eclipse.org/modeling/emf/emf/javadoc/2.9.0/org/eclipse/emf/parsley/factories/FormFactory.html" title="org.eclipse.emf.parsley.factories.FormFactory">FormFactory</abbr></a> <a class="srcLink" href="https://github.com/eclipse/emf/blob/R2_8_0/plugins/org.eclipse.emf.ecore/src/org/eclipse/emf/parsley/factories/FormFactory.java" title="View Source Code" >(src)</a>
</p>
<p>
<ul>
<li><a href="04-Customization.php#FormPropertyDescriptionProvider.php" title="Go to &quot;Form Feature Caption Provider&quot;">FormPropertyDescriptionProvider</a></li>
<li><a href="04-Customization.php#FormControlFactory.php" title="Go to &quot;Form Control Factory&quot;">Form Control Factory</a></li>
<li><a href="04-Customization.php#EditingDomainFinder.php" title="Go to &quot;Editing Domain Finder&quot;">EditingDomainFinder</a></li>
<li><a href="04-Customization.php#JfaceProviderFactory.php" title="Go to &quot;Jface Provider Factory&quot;">JfaceProviderFactory</a></li>
<li><a href="04-Customization.php#FeaturesProvider.php" title="Go to &quot;Features Provider&quot;">FeaturesProvider</a></li>
</ul>
</p>
<a name="JfaceProviderFactory" ></a>
<h2>Jface Provider Factory</h2>
<p>
<a class="jdoc" href="http://download.eclipse.org/modeling/emf/emf/javadoc/2.9.0/org/eclipse/emf/parsley/factories/ColumnLabelProviderFactory.html" title="org.eclipse.emf.parsley.factories.ColumnLabelProviderFactory">ColumnLabelProviderFactory</abbr></a> <a class="srcLink" href="https://github.com/eclipse/emf/blob/R2_8_0/plugins/org.eclipse.emf.ecore/src/org/eclipse/emf/parsley/factories/ColumnLabelProviderFactory.java" title="View Source Code" >(src)</a>
</p>
<p>
<ul>
<li><a href="04-Customization.php#ViewerLabelProvider.php" title="Go to &quot;Viewer Label Provider&quot;">ViewerLabelProvider</a></li>
<li><a href="04-Customization.php#TableColumnLabelProvider.php" title="Go to &quot;Table Column Label Provider&quot;">TableColumnLabelProvider</a></li>
</ul>
</p>
<a name="FormControlFactory" ></a>
<h2>Form Control Factory</h2>
<p>
<em>This can be done with Parsley DSL too!</em>
If you want to customize the controls on the right, it can be injected a specification of the class <a class="jdoc" href="http://download.eclipse.org/modeling/emf/emf/javadoc/2.9.0/org/eclipse/emf/parsley/binding/FormControlFactory.html" title="org.eclipse.emf.parsley.binding.FormControlFactory">FormControlFactory</abbr></a> <a class="srcLink" href="https://github.com/eclipse/emf/blob/R2_8_0/plugins/org.eclipse.emf.ecore/src/org/eclipse/emf/parsley/binding/FormControlFactory.java" title="View Source Code" >(src)</a>.
Using the same polimorphic mechanism of the labels, the programmer can write a method with the keyword <em>'control'</em>
followed by the EClass and EStructuralFeature undescore-character-separated. In the signature of the
method must be both the <em>DataBinding Context</em> and the <em>Feature Observable</em> that can be used for databinding.
</p>
<p>
<div class="literallayout">
<div class="incode">
<p class="code">
<span class="keyword">public</span>&nbsp;Control&nbsp;control_Writer_name(DataBindingContext&nbsp;dbc,IObservableValue&nbsp;featureObservable)&nbsp;{<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="comment">//Creating&nbsp;the&nbsp;control<br/>
</span>&nbsp;&nbsp;&nbsp;&nbsp;Text&nbsp;text&nbsp;=&nbsp;getToolkit().createText(getParent(),&nbsp;<span class="string">""</span>);<br/>
&nbsp;&nbsp;&nbsp;&nbsp;text.setData(FormToolkit.KEY_DRAW_BORDER,&nbsp;FormToolkit.TREE_BORDER);<br/>
&nbsp;&nbsp;&nbsp;&nbsp;text.setBackground(getToolkit().getColors().getColor(IFormColors.TITLE));<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="comment">//Binding&nbsp;the&nbsp;control&nbsp;to&nbsp;the&nbsp;feature&nbsp;observable<br/>
</span>&nbsp;&nbsp;&nbsp;&nbsp;dbc.bindValue(SWTObservables.observeText(text,&nbsp;SWT.Modify),&nbsp;&nbsp;&nbsp;&nbsp;featureObservable);<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">return</span>&nbsp;text;<br/>
}
</p>
</div>
</div>
</p>
<p>
For more info, see the other parts that are used internally by the <em>Form Control Factory</em>:
</p>
<p>
<ul>
<li><a href="04-Customization.php#JfaceProviderFactory.php" title="Go to &quot;Jface Provider Factory&quot;">JfaceProviderFactory</a></li>
</ul>
</p>
<a name="TreeFormFactory" ></a>
<h2>Tree Form Factory</h2>
<p>
<a class="jdoc" href="http://download.eclipse.org/modeling/emf/emf/javadoc/2.9.0/org/eclipse/emf/parsley/factories/TreeFormFactory.html" title="org.eclipse.emf.parsley.factories.TreeFormFactory">TreeFormFactory</abbr></a> <a class="srcLink" href="https://github.com/eclipse/emf/blob/R2_8_0/plugins/org.eclipse.emf.ecore/src/org/eclipse/emf/parsley/factories/TreeFormFactory.java" title="View Source Code" >(src)</a>
</p>
<p>
<ul>
<li><a href="04-Customization.php#ViewerInitializer.php" title="Go to &quot;Viewer Initializer&quot;">ViewerInitializer</a></li>
<li><a href="04-Customization.php#FormFactory.php" title="Go to &quot;Form Factory&quot;">FormFactory</a></li>
</ul>
</p>
<a name="ViewerFactory" ></a>
<h2>Viewer Factory</h2>
<p>
<a class="jdoc" href="http://download.eclipse.org/modeling/emf/emf/javadoc/2.9.0/org/eclipse/emf/parsley/factories/ViewerFactory.html" title="org.eclipse.emf.parsley.factories.ViewerFactory">ViewerFactory</abbr></a> <a class="srcLink" href="https://github.com/eclipse/emf/blob/R2_8_0/plugins/org.eclipse.emf.ecore/src/org/eclipse/emf/parsley/factories/ViewerFactory.java" title="View Source Code" >(src)</a>
</p>
<p>
<ul>
<li><a href="04-Customization.php#TableViewerBuilder.php" title="Go to &quot;Table Viewer Builder&quot;">TableViewerBuilder</a></li>
<li><a href="04-Customization.php#ViewerInitializer.php" title="Go to &quot;Viewer Initializer&quot;">ViewerInitializer</a></li>
</ul>
</p>
<a name="AdapterFactoryEditingDomain" ></a>
<h2>Viewer Factory</h2>
<p>
AdapterFactoryEditingDomain
</p>
<p>
AdapterFactory
</p>
<a name="Viewers" ></a>
<span style="float:left; border-top: 1px dotted #d4d4dd; margin-left: 0; margin-top: 5px;
padding: 5px 0;
padding-top: 5px;"></span><a style="float: right" href="#">Top</a>
<br style="clear:both"></br>
<h1>Viewers</h1>
<div class="toc">
<ul>
<li><a href="04-Customization.php#ViewerInitializer.php" >Viewer Initializer</a></li>
</ul>
</div>
<a name="ViewerInitializer" ></a>
<h2>Viewer Initializer</h2>
<p>
<a class="jdoc" href="http://download.eclipse.org/modeling/emf/emf/javadoc/2.9.0/org/eclipse/emf/parsley/viewers/ViewerInitializer.html" title="org.eclipse.emf.parsley.viewers.ViewerInitializer">ViewerInitializer</abbr></a> <a class="srcLink" href="https://github.com/eclipse/emf/blob/R2_8_0/plugins/org.eclipse.emf.ecore/src/org/eclipse/emf/parsley/viewers/ViewerInitializer.java" title="View Source Code" >(src)</a>
</p>
<p>
<ul>
<li><em>AdapterFactoryEditingDomain</em></li>
<li><a href="04-Customization.php#ViewerContextMenuFactory.php" title="Go to &quot;Viewer Context Menu Factory&quot;">AdapterFactory</a></li>
<li><em>ILabelProvider</em></li>
<li><em>IContentProvider</em></li>
</ul>
</p>
<div id="disqus_thread"></div>
<script type="text/javascript" src="documentationRoot.js"></script>
<script type="text/javascript">
/* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
var disqus_shortname = 'xtext'; // required: replace example with your forum shortname
// The following are highly recommended additional parameters. Remove the slashes in front to use.
var disqus_identifier = 'Customization';
var disqus_url = documentationRoot+'04-Customization.php';
/* * * DON'T EDIT BELOW THIS LINE * * */
(function() {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
</script>
<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
</div>
<br style="clear:both;height:1em;">