blob: acfc916ac618620e9a53230cf4789526c52f3f69 [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="Eclipse4" ></a>
<h1>Eclipse 4</h1>
<div class="toc">
<ul>
<li><a href="07-Eclipse4.php#GetFirstExample.php" >First Example Setup</a></li>
<li><a href="07-Eclipse4.php#PrepareForEclipse4Application.php" >Preparing for a pure Eclipse 4 Application</a></li>
<li><a href="07-Eclipse4.php#CreateEclipse4Application.php" >Create an Eclipse 4 Application</a></li>
<li><a href="07-Eclipse4.php#Eclipse4ApplicationAndEMFParsley.php" >Using an EMF Parsley TreeComposite into an Eclipse 4 Part</a></li>
<li><a href="07-Eclipse4.php#Eclipse4Save.php" >Adding the dirty state and Save command</a></li>
</ul>
</div>
<p>
Instead of using the Extension Point mechanism, EMF Parsley leverages from DSL and Google Guice Injection.
</p>
<p>
Because of this, it is very easy to use it with Eclipse 4.
</p>
<a name="GetFirstExample" ></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>First Example Setup</h1>
<p>
If you followed the steps described in section <a href="02-GettingStarted.php" title="Go to &quot;Getting Started&quot;">Getting Started</a> you will have already
what we need to begin. Otherwise the following wizard will bring you to that point.
</p>
<p>
<ol>
<li>File -&gt; New... -&gt; Example...</li>
<li>from Category &quot;Emf Parsley Examples&quot;, select &quot;Emf Parsley First Example&quot;</li>
<li>press Next and Finish</li>
</ol>
</p>
<p>
You will end up with three plug-ins:
</p>
<p>
<ul>
<li>org.eclipse.emf.parsley.examples.firstexample (the EMF Parsley example plug-in)</li>
<li>org.eclipse.emf.examples.library (the model plug-in)</li>
<li>org.eclipse.emf.examples.library.edit (the model.edit plug-in)</li>
</ul>
</p>
<p>
As a reminder, in section <a href="02-GettingStarted.php" title="Go to &quot;Getting Started&quot;">Getting Started</a> we reached the point where we launched a second Eclipse
instance (but, of course, just defining a product you could have a standalone 3.x application) with a
view (called &quot;My Library Tree Form&quot;) that allowed to manage the model.
</p>
<a name="PrepareForEclipse4Application" ></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>Preparing for a pure Eclipse 4 Application</h1>
<p>
What we will do now is starting from the previous step and create an Eclipse 4 Application (on top of
the previous plug-ins) that gets to the same result, but now with a pure Eclipse 4 Part.
</p>
<p>
In order to do this we need to export the <em>&quot;org.eclipse.emf.parsley.examples.firstexample&quot;</em> package from the first plug-in.
</p>
<a name="CreateEclipse4Application" ></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>Create an Eclipse 4 Application</h1>
<p>
Now let's create a new, empty, Eclipse 4 application, e.g. <em>&quot;org.eclipse.emf.parsley.examples.firstexample.application&quot;</em>
(you can find details on how to create Eclipse 4 applications in <a href="http://www.rcp-vision.com/?p=4694&lang=en" >our
tutorials</a>).
</p>
<p>
Create a Part and ensure that the application starts.
</p>
<a name="Eclipse4ApplicationAndEMFParsley" ></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>Using an EMF Parsley TreeComposite into an Eclipse 4 Part</h1>
<p>
In the just created plug-in we need dependencies from the previous plug-ins: so open the <em>org.eclipse.emf.parsley.examples.firstexample.application/MANIFEST.MF</em> file, go to <em>Dependencies</em>
tab and add the three previous plug-ins. Add also <em>&quot;org.eclipse.emf.parsley&quot;</em> plug-in.
Don't forget to add the previous, and the required plug-ins, also to the Product.
</p>
<p>
Open the Part java class and make the following changes:
<div class="literallayout">
<div class="incode">
<p class="code">
<span class="comment">//&nbsp;Use&nbsp;these&nbsp;imports&nbsp;during&nbsp;Organizing&nbsp;Imports&nbsp;operation<br/>
</span><span class="keyword">import</span>&nbsp;org.eclipse.emf.common.util.URI;<br/>
<span class="keyword">import</span>&nbsp;org.eclipse.emf.ecore.resource.Resource;<br/>
<span class="keyword">import</span>&nbsp;org.eclipse.swt.widgets.Composite;
</p>
</div>
</div>
</p>
<p>
<div class="literallayout">
<div class="incode">
<p class="code">
<span class="comment">//&nbsp;The&nbsp;part&nbsp;implements&nbsp;IMenuListener&nbsp;for&nbsp;context&nbsp;menu&nbsp;handling<br/>
</span>public&nbsp;class&nbsp;MyEclipse4Part&nbsp;implements&nbsp;IMenuListener
</p>
</div>
</div>
</p>
<p>
<div class="literallayout">
<div class="incode">
<p class="code">
<span class="comment">//the&nbsp;parent&nbsp;composite<br/>
</span>private&nbsp;Composite&nbsp;parent;<br/>
<span class="comment">//the&nbsp;EMF&nbsp;Parley&nbsp;composite&nbsp;for&nbsp;showing&nbsp;a&nbsp;tree&nbsp;and&nbsp;a&nbsp;detail&nbsp;form<br/>
</span>private&nbsp;TreeFormComposite&nbsp;treeFormComposite;<br/>
<span class="comment">//the&nbsp;EMF&nbsp;Resource<br/>
</span>private&nbsp;Resource&nbsp;resource;<br/>
<br/>
<span class="comment">//Guice&nbsp;injected&nbsp;EMF&nbsp;Parsley&nbsp;component&nbsp;for&nbsp;contributing&nbsp;to&nbsp;the&nbsp;tree&nbsp;context&nbsp;menu<br/>
</span>private&nbsp;TreeActionBarContributor&nbsp;treeActionBarContributor&nbsp;=&nbsp;FirstexampleActivator.getDefault().getInjector()<br/>
<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.getInstance(TreeActionBarContributor.class);<br/>
<br/>
<br/>
<span class="comment">//Guice&nbsp;injected&nbsp;EMF&nbsp;Parsley&nbsp;factory&nbsp;for&nbsp;the&nbsp;tree&nbsp;detail&nbsp;form<br/>
</span>private&nbsp;TreeFormFactory&nbsp;treeFormFactory&nbsp;=&nbsp;FirstexampleActivator.getDefault().getInjector()<br/>
<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.getInstance(TreeFormFactory.class);<br/>
<br/>
<span class="comment">//Guice&nbsp;injected&nbsp;EMF&nbsp;Parsley&nbsp;Resource&nbsp;loader<br/>
</span>private&nbsp;ResourceLoader&nbsp;resourceLoader&nbsp;=&nbsp;FirstexampleActivator.getDefault().getInjector()<br/>
<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.getInstance(ResourceLoader.class);<br/>
<br/>
<span class="comment">//Guice&nbsp;injected&nbsp;EMF&nbsp;Parsley&nbsp;editing&nbsp;domain<br/>
</span>private&nbsp;AdapterFactoryEditingDomain&nbsp;editingDomain&nbsp;=&nbsp;FirstexampleActivator.getDefault().getInjector()<br/>
<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.getInstance(AdapterFactoryEditingDomain.class);<br/>
<br/>
<span class="comment">//Guice&nbsp;injected&nbsp;viewer&nbsp;initializer<br/>
</span>private&nbsp;ViewerInitializer&nbsp;viewerInitializer&nbsp;=&nbsp;(ViewerInitializer)&nbsp;FirstexampleActivator.getDefault().getInjector()<br/>
<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.getInstance(ViewerInitializer.class);<br/>
<br/>
<span class="comment">//Guice&nbsp;injected&nbsp;save&nbsp;manager<br/>
</span>private&nbsp;ResourceSaveManager&nbsp;resourceSaveManager&nbsp;=&nbsp;FirstexampleActivator.getDefault().getInjector()<br/>
<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.getInstance(ResourceSaveManager.class);<br/>
<br/>
<span class="comment">//URI&nbsp;for&nbsp;EMF&nbsp;Resource<br/>
</span>private&nbsp;URI&nbsp;uri&nbsp;=&nbsp;URI.createFileURI(System.getProperty(<span class="string">"user.home"</span>)<br/>
<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;+&nbsp;<span class="string">"/MyLibrary.library"</span>);
</p>
</div>
</div>
</p>
<p>
Modify the <em>@PostConstruct</em> method with this code:
</p>
<p>
<div class="literallayout">
<div class="incode">
<p class="code">
@PostConstruct<br/>
public&nbsp;void&nbsp;postConstruct(Composite&nbsp;parent)&nbsp;{<br/>
&nbsp;&nbsp;&nbsp;&nbsp;this.parent&nbsp;=&nbsp;parent;<br/>
<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="comment">//&nbsp;Initialize&nbsp;TreeFormFactory&nbsp;&amp;&nbsp;ResourceLoader<br/>
</span>&nbsp;&nbsp;&nbsp;&nbsp;init(treeFormFactory,&nbsp;resourceLoader);<br/>
<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="comment">//&nbsp;Prepare&nbsp;the&nbsp;menu&nbsp;action&nbsp;bar&nbsp;contributor&nbsp;upon&nbsp;the&nbsp;selection<br/>
</span>&nbsp;&nbsp;&nbsp;&nbsp;treeFormComposite.getViewer().addSelectionChangedListener(treeActionBarContributor);<br/>
<br/>
}
</p>
</div>
</div>
</p>
<p>
and add the following methods:
</p>
<p>
<div class="literallayout">
<div class="incode">
<p class="code">
public&nbsp;void&nbsp;init(TreeFormFactory&nbsp;treeFormFactory,&nbsp;ResourceLoader&nbsp;resourceLoader)&nbsp;{<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="comment">//create&nbsp;the&nbsp;tree-form&nbsp;composite<br/>
</span>&nbsp;&nbsp;&nbsp;&nbsp;treeFormComposite&nbsp;=&nbsp;treeFormFactory.createTreeFormMasterDetailComposite(parent,&nbsp;SWT.BORDER);<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="comment">//load&nbsp;the&nbsp;resource<br/>
</span>&nbsp;&nbsp;&nbsp;&nbsp;resource&nbsp;=&nbsp;resourceLoader.getResource(editingDomain,&nbsp;uri).getResource();<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="comment">//update&nbsp;the&nbsp;composite<br/>
</span>&nbsp;&nbsp;&nbsp;&nbsp;treeFormComposite.update(resource);<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="comment">//initialize&nbsp;and&nbsp;bind&nbsp;the&nbsp;context&nbsp;menu&nbsp;to&nbsp;the&nbsp;tree-form&nbsp;composite<br/>
</span>&nbsp;&nbsp;&nbsp;&nbsp;treeActionBarContributor.initialize(editingDomain);<br/>
&nbsp;&nbsp;&nbsp;&nbsp;viewerInitializer.addContextMenu(<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;treeFormComposite.getViewer(),&nbsp;treeActionBarContributor,&nbsp;editingDomain,&nbsp;this);<br/>
}<br/>
<br/>
<br/>
@Override<br/>
public&nbsp;void&nbsp;menuAboutToShow(IMenuManager&nbsp;manager)&nbsp;{<br/>
&nbsp;&nbsp;&nbsp;&nbsp;treeActionBarContributor.menuAboutToShow(manager);<br/>
}
</p>
</div>
</div>
</p>
<p>
If you now run the application you will be able to manage the model:
</p>
<p>
<div class="image" >
<a class="gallery" rel="prettyPhoto[all]" title="" href="images/07-eclipse4-part.png">
<img src="images/07-eclipse4-part.png"
width="600px"
/>
</a>
<div class="caption">
</div>
</div>
</p>
<p>
but you will notice that it is not possible to persist the changes to the model.
</p>
<a name="Eclipse4Save" ></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>Adding the dirty state and Save command</h1>
<p>
In order to allow persisting the model changes we have to add the dirty state handling to the part and
the Save command to the application.
Let's start with adding the following attribute to the part
</p>
<p>
<div class="literallayout">
<div class="incode">
<p class="code">
@Inject<br/>
MDirtyable&nbsp;dirtyable;
</p>
</div>
</div>
</p>
<p>
initialize it in the <em>@PostConstruct</em> method
</p>
<p>
<div class="literallayout">
<div class="incode">
<p class="code">
@PostConstruct<br/>
public&nbsp;void&nbsp;postConstruct(Composite&nbsp;parent,&nbsp;MDirtyable&nbsp;dirtyable)&nbsp;{<br/>
<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;this.dirtyable&nbsp;=&nbsp;dirtyable;<br/>
<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;this.dirtyable.setDirty(false);
</p>
</div>
</div>
</p>
<p>
add to <em>init</em> method the following code in order to update the dirty state
</p>
<p>
<div class="literallayout">
<div class="incode">
<p class="code">
editingDomain.getCommandStack().addCommandStackListener(<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;new&nbsp;CommandStackListener()&nbsp;{<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;public&nbsp;void&nbsp;commandStackChanged(EventObject&nbsp;event)&nbsp;{<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(dirtyable&nbsp;!=&nbsp;null)<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dirtyable.setDirty(true);<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;});
</p>
</div>
</div>
</p>
<p>
and add the <em>@Persist</em> method, which will be called when the part is saved
</p>
<p>
<div class="literallayout">
<div class="incode">
<p class="code">
@Persist<br/>
public&nbsp;void&nbsp;save(MDirtyable&nbsp;dirty)&nbsp;throws&nbsp;IOException&nbsp;{<br/>
&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(resourceSaveManager.save(resource))&nbsp;{<br/>
<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(dirty&nbsp;!=&nbsp;null)&nbsp;{<br/>
<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dirty.setDirty(false);<br/>
<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br/>
<br/>
&nbsp;&nbsp;&nbsp;&nbsp;}<br/>
}
</p>
</div>
</div>
</p>
<p>
and, in the end, add the <em>Save</em> handler along with the correspondent <em>Command</em> and <em>Menu</em>
(you can find how to create handlers, commands and menus in an Eclipse 4 applications in <a href="http://www.rcp-vision.com/?p=4972&lang=en" >our
tutorials</a>)
</p>
<p>
<div class="literallayout">
<div class="incode">
<p class="code">
public&nbsp;class&nbsp;SaveHandler&nbsp;{<br/>
<br/>
&nbsp;&nbsp;&nbsp;&nbsp;@Execute<br/>
&nbsp;&nbsp;&nbsp;&nbsp;void&nbsp;execute(EPartService&nbsp;partService,&nbsp;@Named(IServiceConstants.ACTIVE_PART)&nbsp;MPart&nbsp;part)&nbsp;{<br/>
<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;partService.savePart(part,&nbsp;false);<br/>
&nbsp;&nbsp;&nbsp;&nbsp;}<br/>
<br/>
}
</p>
</div>
</div>
</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 = 'Eclipse4';
var disqus_url = documentationRoot+'07-Eclipse4.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;">