<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Radek's Tech Blog &#187; eclipse</title>
	<atom:link href="http://urbas.tk/index.php/tag/eclipse/feed/" rel="self" type="application/rss+xml" />
	<link>http://urbas.tk</link>
	<description>Radoslaw H. Urbas homepage / blog</description>
	<lastBuildDate>Tue, 01 Jun 2010 20:31:19 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Generating p2 meta data from command line</title>
		<link>http://urbas.tk/index.php/2010/06/01/generating-p2-meta-data-from-command-line/</link>
		<comments>http://urbas.tk/index.php/2010/06/01/generating-p2-meta-data-from-command-line/#comments</comments>
		<pubDate>Tue, 01 Jun 2010 20:15:30 +0000</pubDate>
		<dc:creator>Radoslaw Urbas</dc:creator>
				<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[IT]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[FeaturesAndBundlesPublisher]]></category>
		<category><![CDATA[generating]]></category>
		<category><![CDATA[meta data]]></category>
		<category><![CDATA[p2]]></category>

		<guid isPermaLink="false">http://urbas.tk/?p=215</guid>
		<description><![CDATA[Many times when working with Eclipse RCP I had to generate ad-hoc updatesites (usually containing some 3rd party plug-ins). What I usually did to achieve this (with Eclipse IDE): create new feature project add plug-ins to the feature create new updatesite project add the feature to the updatesite (pre-p2 style &#8211; site.xml) export newly created updatesite [...]]]></description>
			<content:encoded><![CDATA[<p>Many times when working with Eclipse RCP I had to generate ad-hoc updatesites (usually containing some 3rd party plug-ins). What I usually did to achieve this (with Eclipse IDE):</p>
<ul>
<li>create new feature project</li>
<li>add plug-ins to the feature</li>
<li>create new updatesite project</li>
<li>add the feature to the updatesite (pre-p2 style &#8211; site.xml)</li>
<li>export newly created updatesite (letting Eclipse to deal with creating p2 meta data)</li>
</ul>
<p>Since I needed to automate this process I started researching on p2 capabilities and found out that it can be done from command line using FeatureAndBundlesPublisher application. Sample command line invocation to do it:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">%ECLIPSE_EXE% -application org.eclipse.equinox.p2.publisher.FeaturesAndBundlesPublisher -metadataRepository file:/%P2_TARGET% -artifactRepository file:/%P2_TARGET% -source %P2_SRC% -compress -configs win32.win32.x86 -publishArtifacts</pre></div></div>

<p>Where:</p>
<ul>
<li>ECLIPSE_EXE &#8211; points to Eclipse executable;</li>
<li>P2_TARGET &#8211; path to an empty directory where p2 repository should be created;</li>
<li>P2_SRC &#8211; path to the directory with /plugins subdirectory and plug-ins to be published (jar files) inside;</li>
<li><em>-compress</em> parameter is optional. It compresses artifacts.xml and content.xml to jar (zip) files.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://urbas.tk/index.php/2010/06/01/generating-p2-meta-data-from-command-line/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Eclipse 3.5 Galileo &#8211; my personal Top 5</title>
		<link>http://urbas.tk/index.php/2009/07/30/eclipse-3-5-galileo-my-personal-top-5/</link>
		<comments>http://urbas.tk/index.php/2009/07/30/eclipse-3-5-galileo-my-personal-top-5/#comments</comments>
		<pubDate>Thu, 30 Jul 2009 21:31:40 +0000</pubDate>
		<dc:creator>Radoslaw Urbas</dc:creator>
				<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[IT]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[3.5]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[galileo]]></category>
		<category><![CDATA[review]]></category>

		<guid isPermaLink="false">http://urbas.tk/?p=126</guid>
		<description><![CDATA[There are several new and exciting features in Galileo release. Multiple projects, hundreds of contributors, huge audience&#8230; I decided to choose my very personal Top 5 for Galileo release: Update. New UI for installing and updating new features in Eclipse really leverages user experience. After introducing p2 in 3.4 a lot of people missed old [...]]]></description>
			<content:encoded><![CDATA[<p>There are several new and exciting features in Galileo release. Multiple projects, hundreds of contributors, huge audience&#8230;</p>
<p>I decided to choose my very personal Top 5 for Galileo release:</p>
<ol>
<li>Update. New UI for installing and updating new features in Eclipse really leverages user experience. After introducing p2 in 3.4 a lot of people missed old Update Manager. With more stable and matured p2 in 3.5 version hopefully no one is missing 3.3 style updates any more. One capability I would find useful there is installing particular Installable Units instead just these which are based on Eclipse features. In p2 world all IUs are supposed to be equal.</li>
<li>Setting the cookies in Browser. I&#8217;m really happy to finally see setCookie(value, url) method in SWT Browser class. That&#8217;s the part of API that was really missing there to make embedded browser more functional in Eclipse RCP world. Next step would be probably providing SWT support for the Webkit based browsers.</li>
<li>Target Platforms. Galileo way of defining target platform is another item I find really useful for Eclipse RCP. Finally at least partially runtime for Eclipse RCP application can be independent from the plug-ins set in Eclipse IDE used for development!</li>
<li>Mylyn. Previous Mylyn version satisfied most of my requirements to work with Bugzilla. But new Mylyn Editor just feels better for me even if it took me a day or two to get used to the context activation button being moved from right to left side of the toolbar.</li>
<li>OSGi Declarative Services. I&#8217;m excited about declarative services in Equinox. I didn&#8217;t have opportunity to try it yet but I have high hopes for the near future!</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://urbas.tk/index.php/2009/07/30/eclipse-3-5-galileo-my-personal-top-5/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Automatic PDE build with Pluginbuilder</title>
		<link>http://urbas.tk/index.php/2009/02/11/automatic-pde-build-with-pluginbuilder/</link>
		<comments>http://urbas.tk/index.php/2009/02/11/automatic-pde-build-with-pluginbuilder/#comments</comments>
		<pubDate>Wed, 11 Feb 2009 22:10:37 +0000</pubDate>
		<dc:creator>Radoslaw Urbas</dc:creator>
				<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[headless build]]></category>
		<category><![CDATA[map file]]></category>
		<category><![CDATA[pde]]></category>
		<category><![CDATA[pluginbuilder]]></category>
		<category><![CDATA[rcp]]></category>

		<guid isPermaLink="false">http://urbas.tk/?p=54</guid>
		<description><![CDATA[Pluginbuilder is Eclipse tool that generates build configuration based on PDE build. By default the tool generates map file containing the information how source code of the plug-ins should be obtained. Supported methods are: CVS, GET and COPY. Assuming that you want to build your features or product from source files that are checked-out from [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.pluginbuilder.org/" target="_blank">Pluginbuilder</a> is Eclipse tool that generates build configuration based on PDE build. By default the tool generates map file containing the information how source code of the plug-ins should be obtained. Supported methods are: CVS, GET and COPY. Assuming that you want to build your features or product from source files that are checked-out from repository independently from the build process COPY options seems to look reasonable. There are few problems with that:</p>
<ul>
<li>it requires absolute paths to plug-ins/features locations</li>
<li>every single plug-in has to be listed there</li>
</ul>
<p>Workaround for this is not using map file at all and provide appropriate build directory structure outside. To skip fetching resources based on map file configuration one need to set <strong>skipMaps</strong> property in <strong>build.properties</strong> file. Next step is to configure getting plug-ins/features resources into build directory. Recommended phase for copying the source code is <strong>preSetup</strong> phase in PDE build. To hook into this phase standard ant task for copying the files/directories in to build directory have to be invoked in preSetup target in <strong>customTargets.xml</strong> (it is generated by Pluginbuilder as well as other configuratoin files in build-files directory).</p>
<p>Those two modifications allow to make use of Pluginbuilder generated scripts to build Eclipse based applications without coupling it tightly to version control system.</p>
]]></content:encoded>
			<wfw:commentRss>http://urbas.tk/index.php/2009/02/11/automatic-pde-build-with-pluginbuilder/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Eclipse Jobs API &#8211; Errata</title>
		<link>http://urbas.tk/index.php/2009/02/04/eclipse-jobs-api-errata/</link>
		<comments>http://urbas.tk/index.php/2009/02/04/eclipse-jobs-api-errata/#comments</comments>
		<pubDate>Wed, 04 Feb 2009 17:19:54 +0000</pubDate>
		<dc:creator>Radoslaw Urbas</dc:creator>
				<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[IT]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[icons]]></category>
		<category><![CDATA[jobs api]]></category>
		<category><![CDATA[progress]]></category>
		<category><![CDATA[rcp]]></category>

		<guid isPermaLink="false">http://urbas.tk/?p=48</guid>
		<description><![CDATA[My colleague Lukasz Milewski has just spotted a missing piece in a code sample for creating icons presented in previous post. In the screenshot you can see nice icons for currently running Jobs as well as for scheduled Jobs. You need to set two properties in your Job implementation to associate an icon with it. [...]]]></description>
			<content:encoded><![CDATA[<p>My colleague <a href="http://milewski.ws/" target="_blank">Lukasz Milewski</a> has just spotted a missing piece in a code sample for creating icons presented in previous post. In the screenshot you can see nice icons for currently running Jobs as well as for scheduled Jobs. You need to set two properties in your Job implementation to associate an icon with it.</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">	setProperty<span style="color: #009900;">&#40;</span>IProgressConstants.<span style="color: #006633;">KEEP_PROPERTY</span>, <span style="color: #003399;">Boolean</span>.<span style="color: #000066; font-weight: bold;">TRUE</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	setProperty<span style="color: #009900;">&#40;</span>IProgressConstants.<span style="color: #006633;">ICON_PROPERTY</span>, ImageDescriptorFactory
		.<span style="color: #006633;">createImageDescriptor</span><span style="color: #009900;">&#40;</span>ICON_NAME<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://urbas.tk/index.php/2009/02/04/eclipse-jobs-api-errata/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Using Eclipse Jobs API</title>
		<link>http://urbas.tk/index.php/2009/01/14/using-eclipse-jobs-api/</link>
		<comments>http://urbas.tk/index.php/2009/01/14/using-eclipse-jobs-api/#comments</comments>
		<pubDate>Wed, 14 Jan 2009 02:30:50 +0000</pubDate>
		<dc:creator>Radoslaw Urbas</dc:creator>
				<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[IT]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[jobs api]]></category>
		<category><![CDATA[progress bar]]></category>
		<category><![CDATA[rcp]]></category>

		<guid isPermaLink="false">http://urbas.tk/?p=41</guid>
		<description><![CDATA[Eclipse platform offers great API for managing long running operations in the background. Besides the API for starting, stopping and monitoring progress of the Job &#8211; there is also standard UI for managing all those operations. I&#8217;m going to present sample usage of Jobs API in you own plug-in/application. Creating and scheduling Job may look [...]]]></description>
			<content:encoded><![CDATA[<p>Eclipse platform offers great API for managing long running operations in the background. Besides the API for starting, stopping and monitoring progress of the Job &#8211; there is also standard UI for managing all those operations. I&#8217;m going to present sample usage of Jobs API in you own plug-in/application.</p>
<p>Creating and scheduling Job may look like this:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"> TrainJob job <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> TrainJob<span style="color: #009900;">&#40;</span>TRAIN_JOB_NAME <span style="color: #339933;">+</span> file.<span style="color: #006633;">getName</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, classifier<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 job.<span style="color: #006633;">setRule</span><span style="color: #009900;">&#40;</span>file<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 job.<span style="color: #006633;">setUser</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 job.<span style="color: #006633;">setPriority</span><span style="color: #009900;">&#40;</span>Job.<span style="color: #006633;">SHORT</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 job.<span style="color: #006633;">schedule</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// start as soon as possible</span></pre></div></div>

<p>Sample of custom Job:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">pl.edu.agh.caracal.classifier.popup.jobs</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">static</span> org.<span style="color: #006633;">eclipse</span>.<span style="color: #006633;">core</span>.<span style="color: #006633;">runtime</span>.<span style="color: #006633;">Status</span>.<span style="color: #006633;">OK_STATUS</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.eclipse.core.runtime.IProgressMonitor</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.eclipse.core.runtime.IStatus</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.eclipse.core.runtime.jobs.Job</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">pl.edu.agh.caracal.classifier.ext.classifiers.AbstractClassifier</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #008000; font-style: italic; font-weight: bold;">/**
 * Class for execution of training of a classifier
 *
 * @since 1.0
 */</span>
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> TrainJob <span style="color: #000000; font-weight: bold;">extends</span> Job <span style="color: #009900;">&#123;</span>
 <span style="color: #000000; font-weight: bold;">private</span> AbstractClassifier classifier<span style="color: #339933;">;</span>
&nbsp;
<span style="color: #008000; font-style: italic; font-weight: bold;">/**
  * Public constructor TrainJob
  *
  * @param name Train job name
  * @param classifier Classifier to be trained
  */</span>
 <span style="color: #000000; font-weight: bold;">public</span> TrainJob<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> name, AbstractClassifier classifier<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
 	<span style="color: #000000; font-weight: bold;">super</span><span style="color: #009900;">&#40;</span>name<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 	<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">classifier</span> <span style="color: #339933;">=</span> classifier<span style="color: #339933;">;</span>
 <span style="color: #009900;">&#125;</span>
&nbsp;
 @Override
 <span style="color: #000000; font-weight: bold;">protected</span> IStatus run<span style="color: #009900;">&#40;</span>IProgressMonitor monitor<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
 	<span style="color: #666666; font-style: italic;">// Long running operation - in this case classifier training</span>
       <span style="color: #666666; font-style: italic;">// ...</span>
       <span style="color: #000000; font-weight: bold;">return</span> OK_STATUS<span style="color: #339933;">;</span>
 <span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Standard GUI for presenting Job progress:</p>
<p><img src="http://urbas.tk/wp-content/jobsapi_view.PNG" alt="Jobs API View" /></p>
]]></content:encoded>
			<wfw:commentRss>http://urbas.tk/index.php/2009/01/14/using-eclipse-jobs-api/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Eclipse RCP tips and tricks</title>
		<link>http://urbas.tk/index.php/2008/09/09/eclipse-rcp-tips-and-tricks/</link>
		<comments>http://urbas.tk/index.php/2008/09/09/eclipse-rcp-tips-and-tricks/#comments</comments>
		<pubDate>Tue, 09 Sep 2008 21:49:26 +0000</pubDate>
		<dc:creator>Radoslaw Urbas</dc:creator>
				<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[IT]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[decoration context]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[icons]]></category>
		<category><![CDATA[jobs progress bar]]></category>
		<category><![CDATA[navigator icons]]></category>
		<category><![CDATA[rcp]]></category>

		<guid isPermaLink="false">http://urbas.tk/?p=42</guid>
		<description><![CDATA[Recently I had to do couple of tricks Eclipse RCP applications. Basically all of the pieces of code presented below need to be placed in method initialize(IWorkbenchConfigurer configurer). You need to override this method in WorkbenchAdvisor subclass. Displaying icons in Navigator View final String ICONS_PATH = &#34;icons/full/&#34;; final String PATH_OBJECT = ICONS_PATH + &#34;obj16/&#34;; Bundle [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I had to do couple of tricks Eclipse RCP applications. Basically all of the pieces of code presented below need to be placed in method <code>initialize(IWorkbenchConfigurer configurer)</code>. You need to override this method in <code>WorkbenchAdvisor</code> subclass.</p>
<ul>
<li>Displaying icons in Navigator View

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">final</span> <span style="color: #003399;">String</span> ICONS_PATH <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;icons/full/&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">final</span> <span style="color: #003399;">String</span> PATH_OBJECT <span style="color: #339933;">=</span> ICONS_PATH <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot;obj16/&quot;</span><span style="color: #339933;">;</span>
Bundle ideBundle <span style="color: #339933;">=</span> Platform.<span style="color: #006633;">getBundle</span><span style="color: #009900;">&#40;</span>IDEWorkbenchPlugin.<span style="color: #006633;">IDE_WORKBENCH</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
declareWorkbenchImage<span style="color: #009900;">&#40;</span>configurer, ideBundle,
IDE.<span style="color: #006633;">SharedImages</span>.<span style="color: #006633;">IMG_OBJ_PROJECT</span>, PATH_OBJECT <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot;prj_obj.gif&quot;</span>, <span style="color: #000066; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
declareWorkbenchImage<span style="color: #009900;">&#40;</span>configurer, ideBundle,
IDE.<span style="color: #006633;">SharedImages</span>.<span style="color: #006633;">IMG_OBJ_PROJECT_CLOSED</span>, PATH_OBJECT
<span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot;cprj_obj.gif&quot;</span>, <span style="color: #000066; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

</li>
<li>Enabling Decoration Context

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">DecorationContext dc <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>DecorationContext<span style="color: #009900;">&#41;</span> DecorationContext.<span style="color: #006633;">DEFAULT_CONTEXT</span><span style="color: #339933;">;</span>
dc.<span style="color: #006633;">putProperty</span><span style="color: #009900;">&#40;</span>IDecoration.<span style="color: #006633;">ENABLE_REPLACE</span>, <span style="color: #003399;">Boolean</span>.<span style="color: #000066; font-weight: bold;">TRUE</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

</li>
<li>Enabling Jobs Progress Bar

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">IWorkbench wb <span style="color: #339933;">=</span> PlatformUI.<span style="color: #006633;">getWorkbench</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
wb.<span style="color: #006633;">getProgressService</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

</li>
</ul>
<p>Probably you don&#8217;t need any of those when running your plug-ins in Eclipse IDE. The tricky part is running it in a stripped to minimum RCP based applications.</p>
]]></content:encoded>
			<wfw:commentRss>http://urbas.tk/index.php/2008/09/09/eclipse-rcp-tips-and-tricks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Eclipse RCP launcher icon</title>
		<link>http://urbas.tk/index.php/2008/08/12/eclipse-rcp-launcher-icon/</link>
		<comments>http://urbas.tk/index.php/2008/08/12/eclipse-rcp-launcher-icon/#comments</comments>
		<pubDate>Tue, 12 Aug 2008 00:43:56 +0000</pubDate>
		<dc:creator>Radoslaw Urbas</dc:creator>
				<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[IT]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[exe]]></category>
		<category><![CDATA[icon]]></category>
		<category><![CDATA[launcher]]></category>
		<category><![CDATA[rcp]]></category>

		<guid isPermaLink="false">http://urbas.tk/?p=43</guid>
		<description><![CDATA[Eclipse RCP allows easily create an application. Additional advantage of the platform is a native launcher of the application which allows it to behave more like &#8220;native&#8221; application. It much better to have a process called your_application.exe running instead of another java.exe process.  You will probably also want to have some nice icon attached to [...]]]></description>
			<content:encoded><![CDATA[<p>Eclipse RCP allows easily create an application. Additional advantage of the platform is a native launcher of the application which allows it to behave more like &#8220;native&#8221; application. It much better to have a process called your_application.exe running instead of another java.exe process.  You will probably also want to have some nice icon attached to *.exe file of your application. This can be done easily in Eclipse 3.4. First you need to create *.ico file (containing all necassary images inside) &#8211; one of the generators available on the web can be used for this (<a href="http://www.convertico.com/" title="convertico.com" target="_blank">for example</a>).</p>
<p>Next step is configuration in *.product file:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;launcher</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;caracal&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;solaris<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;win</span> <span style="color: #000066;">useico</span>=<span style="color: #ff0000;">&quot;true&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
         <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;ico</span> <span style="color: #000066;">path</span>=<span style="color: #ff0000;">&quot;/pl.edu.agh.caracal.application/icons/caracal.ico&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;/ico<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
         <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;bmp<span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #000000; font-weight: bold;">&lt;/bmp<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/win<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/solaris<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/launcher<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>You can also use product file editor for this (a lot of enhancements were added in Eclipse 3.4):</p>
<p><img src="http://urbas.tk/wp-content/rcp_launcher_icon.PNG" alt="Launcher icon configuration" width="356" height="133" /></p>
<p>After building the application based on product file launcher will have your custom icon. No resource hacking, nor recompiling native C code is required!</p>
<p><img src="http://urbas.tk/wp-content/rcp_launcher_icon2.PNG" alt="Launcher custom icon" width="404" height="122" /></p>
]]></content:encoded>
			<wfw:commentRss>http://urbas.tk/index.php/2008/08/12/eclipse-rcp-launcher-icon/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Long-running operation in a wizard page</title>
		<link>http://urbas.tk/index.php/2008/08/05/long-running-operation-in-a-wizard-page/</link>
		<comments>http://urbas.tk/index.php/2008/08/05/long-running-operation-in-a-wizard-page/#comments</comments>
		<pubDate>Tue, 05 Aug 2008 01:07:24 +0000</pubDate>
		<dc:creator>Radoslaw Urbas</dc:creator>
				<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[IT]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[long-running operation]]></category>
		<category><![CDATA[wizard]]></category>

		<guid isPermaLink="false">http://urbas.tk/?p=40</guid>
		<description><![CDATA[Some time you may need to do some long running operation in one of the pages in your wizard. Probably the best solution would be to redesign the flow of an application in such way that this operation can be performed outside the wizard as a background task (using Eclipse Jobs API). If you really [...]]]></description>
			<content:encoded><![CDATA[<p>Some time you may need to do some long running operation in one of the pages in your wizard. Probably the best solution would be to redesign the flow of an application in such way that this operation can be performed outside the wizard as a background task (using Eclipse Jobs API). If you really need to place this inside wizard than in order to not freeze your application completely with such operation you can use <code>IRunnableWithProgress</code>. Sample usage of this interface is presented below.</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.lang.reflect.InvocationTargetException</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.logging.Logger</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.eclipse.core.runtime.IProgressMonitor</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.eclipse.jface.operation.IRunnableWithProgress</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.eclipse.jface.wizard.WizardPage</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.eclipse.swt.SWT</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.eclipse.swt.events.SelectionAdapter</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.eclipse.swt.events.SelectionEvent</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.eclipse.swt.widgets.Button</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.eclipse.swt.widgets.Composite</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #008000; font-style: italic; font-weight: bold;">/**
 * Wizard Page with long running operation
 *
 */</span>
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> DummyWizardPage <span style="color: #000000; font-weight: bold;">extends</span> WizardPage <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">private</span> Logger logger <span style="color: #339933;">=</span> Logger.<span style="color: #006633;">getLogger</span><span style="color: #009900;">&#40;</span>DummyWizardPage.<span style="color: #000000; font-weight: bold;">class</span>.<span style="color: #006633;">getName</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">protected</span> DummyWizardPage<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> pageName<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">super</span><span style="color: #009900;">&#40;</span>pageName<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #008000; font-style: italic; font-weight: bold;">/**
     * {@inheritDoc}
     */</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> createControl<span style="color: #009900;">&#40;</span><span style="color: #003399;">Composite</span> parent<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #003399;">Composite</span> composite <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">Composite</span><span style="color: #009900;">&#40;</span>parent, SWT.<span style="color: #006633;">NONE</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #003399;">Button</span> button <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">Button</span><span style="color: #009900;">&#40;</span>composite, SWT.<span style="color: #006633;">PUSH</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	button.<span style="color: #006633;">addSelectionListener</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> SelectionAdapter<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> widgetSelected<span style="color: #009900;">&#40;</span>SelectionEvent event<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span>
&nbsp;
		    <span style="color: #666666; font-style: italic;">// Invoking long running operation</span>
		    getContainer<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">run</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">true</span>, <span style="color: #000066; font-weight: bold;">false</span>,
			    <span style="color: #000000; font-weight: bold;">new</span> IRunnableWithProgress<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
				<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> run<span style="color: #009900;">&#40;</span>IProgressMonitor monitor<span style="color: #009900;">&#41;</span>
					<span style="color: #000000; font-weight: bold;">throws</span> <span style="color: #003399;">InvocationTargetException</span>,
					<span style="color: #003399;">InterruptedException</span> <span style="color: #009900;">&#123;</span>
				    <span style="color: #666666; font-style: italic;">// Some time consuming operation</span>
				<span style="color: #009900;">&#125;</span>
&nbsp;
			    <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">InvocationTargetException</span> e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		    logger.<span style="color: #006633;">warning</span><span style="color: #009900;">&#40;</span>e.<span style="color: #006633;">getMessage</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">InterruptedException</span> e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		    logger.<span style="color: #006633;">warning</span><span style="color: #009900;">&#40;</span>e.<span style="color: #006633;">getMessage</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
	    <span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// Setting control for Wizard Page</span>
	setControl<span style="color: #009900;">&#40;</span>composite<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://urbas.tk/index.php/2008/08/05/long-running-operation-in-a-wizard-page/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Help in Eclipse RCP application</title>
		<link>http://urbas.tk/index.php/2008/07/26/help-contenst-in-eclipse-rcp-application/</link>
		<comments>http://urbas.tk/index.php/2008/07/26/help-contenst-in-eclipse-rcp-application/#comments</comments>
		<pubDate>Sat, 26 Jul 2008 03:06:48 +0000</pubDate>
		<dc:creator>Radoslaw Urbas</dc:creator>
				<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[IT]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[help]]></category>
		<category><![CDATA[rcp]]></category>

		<guid isPermaLink="false">http://urbas.tk/?p=39</guid>
		<description><![CDATA[Until you are working at Google or Apple your applications probably requires some sort of help system (UX). Eclipse help system can be easily reused in your custom application based on Eclipse RCP. Let assume that you already have RCP application (if not you can use one of the wizards provided in Eclipse to get [...]]]></description>
			<content:encoded><![CDATA[<p>Until you are working at Google or Apple your applications probably requires some sort of help system (<a href="http://www.ikiw.org/wp-content/uploads/2008/03/imagesapple-20google-20and-20you.png" target="_blank">UX</a>). Eclipse help system can be easily reused in your custom application based on Eclipse RCP.</p>
<p>Let assume that you already have RCP application (if not you can use one of the wizards provided in Eclipse to get one).  In order to enable help there you need to add three dependencies explicitly in plugin.xml:</p>
<ul>
<li>org.eclipse.help.ui</li>
<li>org.eclipse.help.ui.webapp</li>
<li>org.eclipse.equinox.http.jetty</li>
</ul>
<p>After adding those make sure to update *.product configuration and add all new required dependencies.</p>
<p>The next step is adding an extension which will provide the help content in plug-ins that will contribute it. The extension point that provides this feature is: org.eclipse.help.toc (there is one template with dummy help content available to choose in Extension Point Selection form).</p>
<p>Now some menu item that will launch help needs to be added. It can be done in plugin.xml:</p>
<ul>
<li>Add an extension (if you don&#8217;t have it already) : org.eclipse.ui.menus</li>
<li>Add new element: menuContribution with locationURI menu:file</li>
<li>Add new command with id: org.eclipse.ui.help.helpContents</li>
</ul>
<p>Last step is registering an action that will be binded to previously created menu item. It can be done in a class that extends ActionBarAdvisor (if you created your RCP application using default wizard it will be called ApplicationActionBarAdvisor. You need to override one method:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000066; font-weight: bold;">void</span> makeActions<span style="color: #009900;">&#40;</span>IWorkbenchWindow window<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">contentsHelpAction</span> <span style="color: #339933;">=</span> ActionFactory.<span style="color: #006633;">HELP_CONTENTS</span>.<span style="color: #006633;">create</span><span style="color: #009900;">&#40;</span>window<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	register<span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">contentsHelpAction</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Now help system with sample content should be available in Help menu. It will launch separate window and display content there. A help content can be provided by any plug-in extending org.eclipse.help.toc extension point. It is set of HTML documents which are displayed together in one common place, framework provides built-in search, index, table of contents etc (Eclipse uses Jetty as a web server, try <a href="http://localhost:4838/help/index.jsp?topic=/org.eclipse.help.base/doc/help_home.html" target="_blank">this</a> in a browser).</p>
]]></content:encoded>
			<wfw:commentRss>http://urbas.tk/index.php/2008/07/26/help-contenst-in-eclipse-rcp-application/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>JFace Binding</title>
		<link>http://urbas.tk/index.php/2008/07/22/jface-binding/</link>
		<comments>http://urbas.tk/index.php/2008/07/22/jface-binding/#comments</comments>
		<pubDate>Mon, 21 Jul 2008 23:55:52 +0000</pubDate>
		<dc:creator>Radoslaw Urbas</dc:creator>
				<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[IT]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[binding]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[jface]]></category>
		<category><![CDATA[swt]]></category>

		<guid isPermaLink="false">http://urbas.tk/?p=38</guid>
		<description><![CDATA[Recently I have started using JFace Binding. Unfortunately there are not many resources available on the web with non-trivial examples. Let present example of master-detail view: a drop-down list and two text fields which display some details regarding option chosen from the list. POJO Category. It contains two fields: name and description which will be [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I have started using JFace Binding. Unfortunately there are not many resources available on the web with non-trivial examples.</p>
<p>Let present example of master-detail view: a drop-down list and two text fields which display some details regarding option chosen from the list.</p>
<p>POJO Category. It contains two fields: name and description which will be displayed as details of the object chosen from the drop-down list:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.beans.PropertyChangeListener</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.io.Serializable</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #008000; font-style: italic; font-weight: bold;">/**
* Domain object representing category
*
*/</span>
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> Category <span style="color: #000000; font-weight: bold;">implements</span> <span style="color: #003399;">Serializable</span> <span style="color: #009900;">&#123;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">final</span> <span style="color: #000066; font-weight: bold;">long</span> serialVersionUID <span style="color: #339933;">=</span> <span style="color: #339933;">-</span>5542167952605551865L<span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399;">String</span> name<span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399;">String</span> description<span style="color: #339933;">;</span>
&nbsp;
<span style="color: #008000; font-style: italic; font-weight: bold;">/**
* Default constructor
*/</span>
<span style="color: #000000; font-weight: bold;">public</span> Category<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #666666; font-style: italic;">// Do nothing</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #008000; font-style: italic; font-weight: bold;">/**
* Constructor
*
* @param name
*            name of a category
* @param description
*            description of a category
*/</span>
<span style="color: #000000; font-weight: bold;">public</span> Category<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> name, <span style="color: #003399;">String</span> description<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">name</span> <span style="color: #339933;">=</span> name<span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">description</span> <span style="color: #339933;">=</span> description<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #008000; font-style: italic; font-weight: bold;">/**
* @return the name
*/</span>
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> getName<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #000000; font-weight: bold;">return</span> name<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #008000; font-style: italic; font-weight: bold;">/**
* @param name the name to set
*/</span>
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> setName<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> name<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">name</span> <span style="color: #339933;">=</span> name<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #008000; font-style: italic; font-weight: bold;">/**
* @return the description
*/</span>
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> getDescription<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #000000; font-weight: bold;">return</span> description<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #008000; font-style: italic; font-weight: bold;">/**
* @param description the description to set
*/</span>
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> setDescription<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> description<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">description</span> <span style="color: #339933;">=</span> description<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Class of model that will be used to bind the data to the view:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.List</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #008000; font-style: italic; font-weight: bold;">/**
* Model for displaying categories
*
*/</span>
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> CategoriesModel <span style="color: #000000; font-weight: bold;">extends</span> AbstractModelObject <span style="color: #009900;">&#123;</span>
<span style="color: #000000; font-weight: bold;">private</span> List<span style="color: #339933;">&lt;</span>Category<span style="color: #339933;">&gt;</span> categories<span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">private</span> IDataManager dataManager<span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">private</span> Category category<span style="color: #339933;">;</span>
&nbsp;
<span style="color: #008000; font-style: italic; font-weight: bold;">/**
* The constructor
*/</span>
<span style="color: #000000; font-weight: bold;">public</span> CategoriesModel<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">dataManager</span> <span style="color: #339933;">=</span> <span style="color: #003399;">Activator</span>.<span style="color: #006633;">getDataManager</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">categories</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">dataManager</span>.<span style="color: #006633;">getAllCategories</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #008000; font-style: italic; font-weight: bold;">/**
* @return the category
*/</span>
<span style="color: #000000; font-weight: bold;">public</span> Category getCategory<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">category</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #008000; font-style: italic; font-weight: bold;">/**
* @param category
*            the category to set
*/</span>
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> setCategory<span style="color: #009900;">&#40;</span>Category category<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">category</span> <span style="color: #339933;">=</span> category<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #008000; font-style: italic; font-weight: bold;">/**
* @return the categories
*/</span>
<span style="color: #000000; font-weight: bold;">public</span> List<span style="color: #339933;">&lt;</span>Category<span style="color: #339933;">&gt;</span> getCategories<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #000000; font-weight: bold;">return</span> categories<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #008000; font-style: italic; font-weight: bold;">/**
* @param categories the categories to set
*/</span>
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> setCategories<span style="color: #009900;">&#40;</span>List<span style="color: #339933;">&lt;</span>Category<span style="color: #339933;">&gt;</span> categories<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">categories</span> <span style="color: #339933;">=</span> categories<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Class of view (in this case it is Eclipse View containing managed form):</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.logging.Logger</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.eclipse.core.databinding.DataBindingContext</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.eclipse.core.databinding.UpdateValueStrategy</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.eclipse.core.databinding.beans.BeansObservables</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.eclipse.core.databinding.observable.Realm</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.eclipse.core.databinding.observable.list.WritableList</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.eclipse.core.databinding.observable.map.IObservableMap</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.eclipse.core.databinding.observable.value.IObservableValue</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.eclipse.jface.databinding.swt.SWTObservables</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.eclipse.jface.databinding.viewers.ObservableListContentProvider</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.eclipse.jface.databinding.viewers.ObservableMapLabelProvider</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.eclipse.jface.databinding.viewers.ViewersObservables</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.eclipse.jface.viewers.ComboViewer</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.eclipse.swt.SWT</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.eclipse.swt.layout.GridData</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.eclipse.swt.layout.GridLayout</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.eclipse.swt.widgets.Composite</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.eclipse.swt.widgets.Text</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.eclipse.ui.forms.ManagedForm</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.eclipse.ui.forms.widgets.FormToolkit</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.eclipse.ui.forms.widgets.ScrolledForm</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.eclipse.ui.part.ViewPart</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #008000; font-style: italic; font-weight: bold;">/**
* Allows to view list of categories and their details
*
*/</span>
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> CategoryView <span style="color: #000000; font-weight: bold;">extends</span> ViewPart <span style="color: #009900;">&#123;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">private</span> Logger logger <span style="color: #339933;">=</span> Logger.<span style="color: #006633;">getLogger</span><span style="color: #009900;">&#40;</span>CategoryView.<span style="color: #000000; font-weight: bold;">class</span>.<span style="color: #006633;">getName</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">final</span> <span style="color: #003399;">String</span> FORM_TITLE <span style="color: #339933;">=</span> Messages
.<span style="color: #006633;">getString</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;category.view.form.title&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">private</span> FormToolkit formToolkit<span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">private</span> CategoriesModel model<span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">private</span> Text nameText<span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">private</span> Text descriptionText<span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">private</span> ComboViewer categoriesComboViewer<span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">private</span> DataBindingContext dbc<span style="color: #339933;">;</span>
&nbsp;
<span style="color: #008000; font-style: italic; font-weight: bold;">/**
* {@inheritDoc}
*/</span>
@Override
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> createPartControl<span style="color: #009900;">&#40;</span><span style="color: #003399;">Composite</span> parent<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
model <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> CategoriesModel<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
ManagedForm mForm <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> ManagedForm<span style="color: #009900;">&#40;</span>parent<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
ScrolledForm scrolledForm <span style="color: #339933;">=</span> mForm.<span style="color: #006633;">getForm</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
FormToolkit formToolkit <span style="color: #339933;">=</span> mForm.<span style="color: #006633;">getToolkit</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #003399;">Composite</span> formBody <span style="color: #339933;">=</span> scrolledForm.<span style="color: #006633;">getBody</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
formToolkit.<span style="color: #006633;">decorateFormHeading</span><span style="color: #009900;">&#40;</span>scrolledForm.<span style="color: #006633;">getForm</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
scrolledForm.<span style="color: #006633;">setText</span><span style="color: #009900;">&#40;</span>FORM_TITLE<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
formBody.<span style="color: #006633;">setLayout</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">GridLayout</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">2</span>, <span style="color: #000066; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
categoriesComboViewer <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> ComboViewer<span style="color: #009900;">&#40;</span>formBody, SWT.<span style="color: #006633;">DROP_DOWN</span>
<span style="color: #339933;">|</span> SWT.<span style="color: #006633;">READ_ONLY</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
GridData comboGridData <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> GridData<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
comboGridData.<span style="color: #006633;">horizontalSpan</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">2</span><span style="color: #339933;">;</span>
comboGridData.<span style="color: #006633;">horizontalAlignment</span> <span style="color: #339933;">=</span> GridData.<span style="color: #006633;">FILL</span><span style="color: #339933;">;</span>
categoriesComboViewer.<span style="color: #006633;">getCombo</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">setLayoutData</span><span style="color: #009900;">&#40;</span>comboGridData<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
nameText <span style="color: #339933;">=</span> formToolkit.<span style="color: #006633;">createText</span><span style="color: #009900;">&#40;</span>formBody, <span style="color: #0000ff;">&quot;&quot;</span>, SWT.<span style="color: #006633;">NONE</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
GridData nameGridData <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> GridData<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
nameGridData.<span style="color: #006633;">horizontalSpan</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">2</span><span style="color: #339933;">;</span>
nameGridData.<span style="color: #006633;">horizontalAlignment</span> <span style="color: #339933;">=</span> GridData.<span style="color: #006633;">FILL</span><span style="color: #339933;">;</span>
nameText.<span style="color: #006633;">setLayoutData</span><span style="color: #009900;">&#40;</span>nameGridData<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
descriptionText <span style="color: #339933;">=</span> formToolkit.<span style="color: #006633;">createText</span><span style="color: #009900;">&#40;</span>formBody, <span style="color: #0000ff;">&quot;&quot;</span>, SWT.<span style="color: #006633;">MULTI</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
GridData textGridData <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> GridData<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
textGridData.<span style="color: #006633;">horizontalSpan</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">2</span><span style="color: #339933;">;</span>
textGridData.<span style="color: #006633;">horizontalAlignment</span> <span style="color: #339933;">=</span> GridData.<span style="color: #006633;">FILL</span><span style="color: #339933;">;</span>
textGridData.<span style="color: #006633;">heightHint</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">100</span><span style="color: #339933;">;</span>
descriptionText.<span style="color: #006633;">setLayoutData</span><span style="color: #009900;">&#40;</span>textGridData<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
formToolkit.<span style="color: #006633;">paintBordersFor</span><span style="color: #009900;">&#40;</span>formBody<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
bindData<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #008000; font-style: italic; font-weight: bold;">/**
* {@inheritDoc}
*/</span>
@Override
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> setFocus<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #666666; font-style: italic;">// Do nothing</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #008000; font-style: italic; font-weight: bold;">/**
* This method binds the value from UI layer to the model object
*/</span>
<span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000066; font-weight: bold;">void</span> bindData<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
dbc <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> DataBindingContext<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Seting content provider for combo viewer</span>
ObservableListContentProvider categoryViewerContentProvider <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> ObservableListContentProvider<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
categoriesComboViewer.<span style="color: #006633;">setContentProvider</span><span style="color: #009900;">&#40;</span>categoryViewerContentProvider<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
IObservableMap<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> attributeMaps <span style="color: #339933;">=</span> BeansObservables.<span style="color: #006633;">observeMaps</span><span style="color: #009900;">&#40;</span>
categoryViewerContentProvider.<span style="color: #006633;">getKnownElements</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>,
Category.<span style="color: #000000; font-weight: bold;">class</span>, <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">String</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span> <span style="color: #0000ff;">&quot;name&quot;</span> <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
categoriesComboViewer.<span style="color: #006633;">setLabelProvider</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> ObservableMapLabelProvider<span style="color: #009900;">&#40;</span>
attributeMaps<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
categoriesComboViewer.<span style="color: #006633;">setInput</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> WritableList<span style="color: #009900;">&#40;</span>model.<span style="color: #006633;">getCategories</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>,
Category.<span style="color: #000000; font-weight: bold;">class</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Observing changes in selection in combo viewer</span>
IObservableValue selection <span style="color: #339933;">=</span> ViewersObservables
.<span style="color: #006633;">observeSingleSelection</span><span style="color: #009900;">&#40;</span>categoriesComboViewer<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Observing the properties of the current selection</span>
IObservableValue detailNameObservable <span style="color: #339933;">=</span> BeansObservables
.<span style="color: #006633;">observeDetailValue</span><span style="color: #009900;">&#40;</span>Realm.<span style="color: #006633;">getDefault</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, selection, <span style="color: #0000ff;">&quot;name&quot;</span>,
<span style="color: #003399;">String</span>.<span style="color: #000000; font-weight: bold;">class</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
IObservableValue detailDescriptionObservable <span style="color: #339933;">=</span> BeansObservables
.<span style="color: #006633;">observeDetailValue</span><span style="color: #009900;">&#40;</span>Realm.<span style="color: #006633;">getDefault</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, selection,
<span style="color: #0000ff;">&quot;description&quot;</span>, <span style="color: #003399;">String</span>.<span style="color: #000000; font-weight: bold;">class</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Binding the Text widgets to the name and description details</span>
<span style="color: #666666; font-style: italic;">// (selection's properties).</span>
dbc.<span style="color: #006633;">bindValue</span><span style="color: #009900;">&#40;</span>SWTObservables.<span style="color: #006633;">observeText</span><span style="color: #009900;">&#40;</span>nameText, SWT.<span style="color: #006633;">None</span><span style="color: #009900;">&#41;</span>,
detailNameObservable, <span style="color: #000000; font-weight: bold;">new</span> UpdateValueStrategy<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">false</span>,
UpdateValueStrategy.<span style="color: #006633;">POLICY_NEVER</span><span style="color: #009900;">&#41;</span>, <span style="color: #000066; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
dbc.<span style="color: #006633;">bindValue</span><span style="color: #009900;">&#40;</span>SWTObservables.<span style="color: #006633;">observeText</span><span style="color: #009900;">&#40;</span>descriptionText, SWT.<span style="color: #006633;">None</span><span style="color: #009900;">&#41;</span>,
detailDescriptionObservable, <span style="color: #000000; font-weight: bold;">new</span> UpdateValueStrategy<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">false</span>,
UpdateValueStrategy.<span style="color: #006633;">POLICY_NEVER</span><span style="color: #009900;">&#41;</span>, <span style="color: #000066; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #008000; font-style: italic; font-weight: bold;">/**
* {@inheritDoc}
*/</span>
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> dispose<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>formToolkit <span style="color: #339933;">!=</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
formToolkit.<span style="color: #006633;">dispose</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">super</span>.<span style="color: #006633;">dispose</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>AbstractModelObject which provides methods required by JFace Binding (it&#8217;s not checked on compilation level):</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.beans.PropertyChangeListener</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.beans.PropertyChangeSupport</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #008000; font-style: italic; font-weight: bold;">/**
* Provides minimal JavaBeans support for model objects
*
*/</span>
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">abstract</span> <span style="color: #000000; font-weight: bold;">class</span> AbstractModelObject <span style="color: #009900;">&#123;</span>
<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399;">PropertyChangeSupport</span> propertyChangeSupport <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">PropertyChangeSupport</span><span style="color: #009900;">&#40;</span>
<span style="color: #000000; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #008000; font-style: italic; font-weight: bold;">/**
* @param listener
*/</span>
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> addPropertyChangeListener<span style="color: #009900;">&#40;</span><span style="color: #003399;">PropertyChangeListener</span> listener<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
propertyChangeSupport.<span style="color: #006633;">addPropertyChangeListener</span><span style="color: #009900;">&#40;</span>listener<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #008000; font-style: italic; font-weight: bold;">/**
* @param propertyName
* @param listener
*/</span>
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> addPropertyChangeListener<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> propertyName,
<span style="color: #003399;">PropertyChangeListener</span> listener<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
propertyChangeSupport.<span style="color: #006633;">addPropertyChangeListener</span><span style="color: #009900;">&#40;</span>propertyName, listener<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #008000; font-style: italic; font-weight: bold;">/**
* @param listener
*/</span>
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> removePropertyChangeListener<span style="color: #009900;">&#40;</span><span style="color: #003399;">PropertyChangeListener</span> listener<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
propertyChangeSupport.<span style="color: #006633;">removePropertyChangeListener</span><span style="color: #009900;">&#40;</span>listener<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #008000; font-style: italic; font-weight: bold;">/**
* @param propertyName
* @param listener
*/</span>
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> removePropertyChangeListener<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> propertyName,
<span style="color: #003399;">PropertyChangeListener</span> listener<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
propertyChangeSupport.<span style="color: #006633;">removePropertyChangeListener</span><span style="color: #009900;">&#40;</span>propertyName,
listener<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #008000; font-style: italic; font-weight: bold;">/**
*
* @param propertyName
* @param oldValue
* @param newValue
*/</span>
<span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000066; font-weight: bold;">void</span> firePropertyChange<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> propertyName, <span style="color: #003399;">Object</span> oldValue,
<span style="color: #003399;">Object</span> newValue<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
propertyChangeSupport.<span style="color: #006633;">firePropertyChange</span><span style="color: #009900;">&#40;</span>propertyName, oldValue,
newValue<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://urbas.tk/index.php/2008/07/22/jface-binding/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
