<?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/category/it/java-it/eclipse-java-it-it/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.3.2</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>9</slash:comments>
		</item>
		<item>
		<title>Running servlets inside Equinox/Eclipse</title>
		<link>http://urbas.tk/index.php/2010/01/22/running-servlets-inside-equinox/</link>
		<comments>http://urbas.tk/index.php/2010/01/22/running-servlets-inside-equinox/#comments</comments>
		<pubDate>Fri, 22 Jan 2010 17:57:34 +0000</pubDate>
		<dc:creator>Radoslaw Urbas</dc:creator>
				<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[IT]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[equinox]]></category>
		<category><![CDATA[jetty]]></category>
		<category><![CDATA[servlets]]></category>

		<guid isPermaLink="false">http://urbas.tk/?p=195</guid>
		<description><![CDATA[Creating plug-in hosting servlet Create new plug-in project Add plug-in dependencies javax.servlet org.eclipse.equinox.http.registry Add extension: org.eclipse.equinox.http.registry.servlets Configure servlet mapping in extension definition &#60;?xml version=&#34;1.0&#34; encoding=&#34;UTF-8&#34;?&#62; &#60;?eclipse version=&#34;3.4&#34;?&#62; &#60;plugin&#62; &#160; &#60;extension point=&#34;org.eclipse.equinox.http.registry.servlets&#34;&#62; &#60;servlet alias=&#34;/echo&#34; class=&#34;servlets.EchoServlet&#34; /&#62; &#60;/extension&#62; &#160; &#60;/plugin&#62; Create servlet class package servlets; &#160; package servlets; &#160; import java.io.IOException; import java.io.PrintWriter; &#160; import javax.servlet.http.HttpServlet; import [...]]]></description>
			<content:encoded><![CDATA[<ul>
<li>Creating plug-in hosting servlet
<ul>
<li>Create new plug-in project<a href="http://urbas.tk/wp-content/equinox_servlets_1.PNG"><img class="size-full wp-image-196 aligncenter" title="equinox_servlets_1" src="http://urbas.tk/wp-content/equinox_servlets_1.PNG" alt="equinox_servlets_1" width="360" height="430" /></a></li>
<li>Add plug-in dependencies
<ul>
<li><strong><em>javax.servlet</em></strong></li>
<li><strong><em>org.eclipse.equinox.http.registry</em></strong></li>
</ul>
</li>
<li>Add extension: <strong><em>org.eclipse.equinox.http.registry.servlets</em></strong></li>
<li>Configure servlet mapping in extension definition

<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;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;UTF-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?eclipse</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;3.4&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;plugin<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;extension</span> <span style="color: #000066;">point</span>=<span style="color: #ff0000;">&quot;org.eclipse.equinox.http.registry.servlets&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;servlet</span> <span style="color: #000066;">alias</span>=<span style="color: #ff0000;">&quot;/echo&quot;</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;servlets.EchoServlet&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/extension<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/plugin<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

</li>
<li>Create servlet class

<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;">servlets</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">servlets</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.io.IOException</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.io.PrintWriter</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javax.servlet.http.HttpServlet</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javax.servlet.http.HttpServletRequest</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javax.servlet.http.HttpServletResponse</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> EchoServlet <span style="color: #000000; font-weight: bold;">extends</span> HttpServlet <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> 137926368689939745L<span style="color: #339933;">;</span>
&nbsp;
	@Override
	<span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000066; font-weight: bold;">void</span> doGet<span style="color: #009900;">&#40;</span>HttpServletRequest request,
			HttpServletResponse response<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
		<span style="color: #003399;">String</span> value <span style="color: #339933;">=</span> request.<span style="color: #006633;">getParameter</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;value&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #003399;">PrintWriter</span> writer<span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span>
			writer <span style="color: #339933;">=</span> response.<span style="color: #006633;">getWriter</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #003399;">String</span> outputText <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;Echo Servlet inside Equinox/Eclipse says: &quot;</span>
					<span style="color: #339933;">+</span> value<span style="color: #339933;">;</span>
			<span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span>outputText<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			writer.<span style="color: #006633;">write</span><span style="color: #009900;">&#40;</span>outputText<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			writer.<span style="color: #006633;">close</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;">catch</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">IOException</span> e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #666666; font-style: italic;">// TODO Auto-generated catch block</span>
			e.<span style="color: #006633;">printStackTrace</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: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

</li>
</ul>
</li>
<li>Running plug-in hosting servlets in Eclipse IDE
<ul>
<li>Create new Run Configuration</li>
<li>Choose OSGi Framework</li>
<li>Deselect all preselected plug-ins from bundles list</li>
<li>Select only:
<ul>
<li>Newly created plug-in that&#8217;s hosting servlets</li>
<li><em><strong>org.mortbay.jetty.server</strong></em></li>
<li><em><strong>org.eclipse.equinox.http.jetty</strong></em></li>
</ul>
</li>
<li>Use Add Required Bundles option</li>
<li>Save configuration and Run it</li>
</ul>
</li>
<li>Using servlet
<ul>
<li>By default when running this configuration Jetty will start on port 80</li>
<li>Open a browser and hit URL for this example <em>http://localhost/echo?value=Hello<a href="http://urbas.tk/wp-content/equinox_servlets_2.PNG"><img class="aligncenter size-full wp-image-209" title="equinox_servlets_2" src="http://urbas.tk/wp-content/equinox_servlets_2.PNG" alt="equinox_servlets_2" width="419" height="312" /></a></em><a href="http://urbas.tk/wp-content/equinox_servlets_3.PNG"><img class="aligncenter size-full wp-image-197" title="equinox_servlets_3" src="http://urbas.tk/wp-content/equinox_servlets_3.PNG" alt="equinox_servlets_3" width="417" height="444" /></a></li>
</ul>
</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://urbas.tk/index.php/2010/01/22/running-servlets-inside-equinox/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Adding menu item, command and handler</title>
		<link>http://urbas.tk/index.php/2009/10/27/adding-menu-item-command-and-handler/</link>
		<comments>http://urbas.tk/index.php/2009/10/27/adding-menu-item-command-and-handler/#comments</comments>
		<pubDate>Mon, 26 Oct 2009 23:12:52 +0000</pubDate>
		<dc:creator>Radoslaw Urbas</dc:creator>
				<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[IT]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[command]]></category>
		<category><![CDATA[eclipse rcp]]></category>
		<category><![CDATA[handler]]></category>
		<category><![CDATA[menu item]]></category>

		<guid isPermaLink="false">http://urbas.tk/?p=172</guid>
		<description><![CDATA[Step by step in Eclipse IDE Create new Eclipse plug-in: File -&#62; New -&#62; Other -&#62; Plug-in Development -&#62; Plug-in Project Add dependency: MANIFEST.MF -&#62; Dependencies tab -&#62; Add -&#62; org.eclipse.ui Add extension point org.eclipse.ui.menus: plugin.xml -&#62; Extension -&#62; Add -&#62; org.eclipse.ui.menus Right-click -&#62; New -&#62; menuContribution Enter locationURI: menu:file Right click -&#62; New -&#62; command Enter [...]]]></description>
			<content:encoded><![CDATA[<h4>Step by step in Eclipse IDE</h4>
<ul>
<li>Create new Eclipse plug-in: File -&gt; New -&gt; Other -&gt; Plug-in Development -&gt; Plug-in Project</li>
<li>Add dependency: MANIFEST.MF -&gt; Dependencies tab -&gt; Add -&gt; <em>org.eclipse.ui</em></li>
<li>Add extension point org.eclipse.ui.menus: plugin.xml -&gt; Extension -&gt; Add -&gt; <em>org.eclipse.ui.menus </em>
<ul>
<li>Right-click -&gt; New -&gt; menuContribution
<ul>
<li>Enter locationURI: menu:file
<ul>
<li>Right click -&gt; New -&gt; command</li>
<li>Enter commandId: <em><strong>tk.urbas.eclipse.sample.sampleCommand</strong></em></li>
<li>Enter label: Sample Menu Item</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
<li>Add extension point org.eclipse.ui.commands: plugin.xml -&gt; Extensions -&gt; Add -&gt; <em>org.eclipse.ui.commands </em>
<ul>
<li>Right-click -&gt; New -&gt; command
<ul>
<li>Enter id: <em><strong>tk.urbas.eclipse.sample.sampleCommand</strong></em></li>
<li>Enter label: Sample Command</li>
</ul>
</li>
</ul>
</li>
<li>Add extension point org.eclipse.ui.handlers: plugin.xml -&gt; Extensions -&gt; Add -&gt; <em>org.eclipse.ui.handlers </em>
<ul>
<li>Right-click -&gt; New -&gt; handler
<ul>
<li>Enter commandId: <em><strong>tk.urbas.eclipse.sample.sampleCommand</strong></em></li>
<li>Enter class: tk.urbas.eclipse.sample.SampleHandler</li>
<li>Click class link and create class</li>
<li>Provide sample implementation of the handler class implementing <em>org.eclipse.core.commands.IHandler</em> or extending <em>org.eclipse.core.commands.AbstractHandler</em></li>
</ul>
</li>
</ul>
</li>
</ul>
<p></p>
<div id="attachment_179" class="wp-caption alignleft" style="width: 364px"><img src="http://urbas.tk/wp-content/adding_handler.png" alt="Menu, command, handler" title="adding_handler" width="354" height="466" class="size-full wp-image-179" /><p class="wp-caption-text">Menu, command, handler</p></div>
<h4>MANIFEST.MF</h4>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Sample Handler
Bundle-SymbolicName: tk.urbas.eclipse.sample;singleton:=true
Bundle-Version: 1.0.0.qualifier
Bundle-Vendor: urbas.tk
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Require-Bundle: org.eclipse.ui</pre></div></div>

<h4>plugin.xml</h4>

<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;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;UTF-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?eclipse</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;3.4&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;plugin<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;extension</span></span>
<span style="color: #009900;">         <span style="color: #000066;">point</span>=<span style="color: #ff0000;">&quot;org.eclipse.ui.menus&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;menuContribution</span></span>
<span style="color: #009900;">            <span style="color: #000066;">locationURI</span>=<span style="color: #ff0000;">&quot;menu:file&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
         <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;command</span></span>
<span style="color: #009900;">               <span style="color: #000066;">commandId</span>=<span style="color: #ff0000;">&quot;tk.urbas.eclipse.sample.sampleCommand&quot;</span></span>
<span style="color: #009900;">               <span style="color: #000066;">label</span>=<span style="color: #ff0000;">&quot;Sample Menu Item&quot;</span></span>
<span style="color: #009900;">               <span style="color: #000066;">style</span>=<span style="color: #ff0000;">&quot;push&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
         <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/command<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/menuContribution<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/extension<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;extension</span></span>
<span style="color: #009900;">         <span style="color: #000066;">point</span>=<span style="color: #ff0000;">&quot;org.eclipse.ui.commands&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;command</span></span>
<span style="color: #009900;">            <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;tk.urbas.eclipse.sample.sampleCommand&quot;</span></span>
<span style="color: #009900;">            <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;Sample Command&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/command<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/extension<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;extension</span></span>
<span style="color: #009900;">         <span style="color: #000066;">point</span>=<span style="color: #ff0000;">&quot;org.eclipse.ui.handlers&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;handler</span></span>
<span style="color: #009900;">            <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;tk.urbas.eclipse.sample.SampleHandler&quot;</span></span>
<span style="color: #009900;">            <span style="color: #000066;">commandId</span>=<span style="color: #ff0000;">&quot;tk.urbas.eclipse.sample.sampleCommand&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/handler<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/extension<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/plugin<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<h4>Handler &#8211; sample implementation showing a message</h4>

<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;">tk.urbas.eclipse.sample</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.eclipse.core.commands.AbstractHandler</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.eclipse.core.commands.ExecutionEvent</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.eclipse.core.commands.ExecutionException</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.eclipse.jface.dialogs.MessageDialog</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.eclipse.swt.widgets.Display</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> SampleHandler <span style="color: #000000; font-weight: bold;">extends</span> AbstractHandler <span style="color: #009900;">&#123;</span>
&nbsp;
	@Override
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">Object</span> execute<span style="color: #009900;">&#40;</span>ExecutionEvent event<span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> ExecutionException <span style="color: #009900;">&#123;</span>
		MessageDialog.<span style="color: #006633;">openInformation</span><span style="color: #009900;">&#40;</span>Display.<span style="color: #006633;">getDefault</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getActiveShell</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>,
				<span style="color: #0000ff;">&quot;Sample Handler&quot;</span>, <span style="color: #0000ff;">&quot;Sample Handler&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">null</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/2009/10/27/adding-menu-item-command-and-handler/feed/</wfw:commentRss>
		<slash:comments>2</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>2</slash:comments>
		</item>
		<item>
		<title>p2 and fragments</title>
		<link>http://urbas.tk/index.php/2009/05/18/p2-and-fragments/</link>
		<comments>http://urbas.tk/index.php/2009/05/18/p2-and-fragments/#comments</comments>
		<pubDate>Mon, 18 May 2009 20:58:30 +0000</pubDate>
		<dc:creator>Radoslaw Urbas</dc:creator>
				<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[IT]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[fragment provisioning]]></category>
		<category><![CDATA[p2]]></category>

		<guid isPermaLink="false">http://urbas.tk/?p=110</guid>
		<description><![CDATA[Recently I&#8217;m getting a bit confused about p2. There is an update site created with PDE headless build. There are IUs generated for each plug-in/fragment/feature. Everything looks great so far. Let&#8217;s assume: plug-in A and fragment B with a defined host plug-in A are sitting together on single update site. Plug-in A in reality cannot [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I&#8217;m getting a bit confused about p2. There is an update site created with PDE headless build. There are IUs generated for each plug-in/fragment/feature. Everything looks great so far.</p>
<p>Let&#8217;s assume: plug-in A and fragment B with a defined host plug-in A are sitting together on single update site. Plug-in A in reality cannot run without appropriate version of fragment B (e.g. situation similar  to SWT).</p>
<p>My understanding of p2-power was that I wouldn&#8217;t need to create separate feature C aggregating A and B just to make fragment B be automatically installed when I request installation of plug-in A.</p>
<p>I spent some time on reviewing Eclipse Bugzilla and mailing lists. Interesting findings:</p>
<p><a title="http://wiki.eclipse.org/Equinox_p2_Meeting_2007#Fragments_optional_vs._requirement" href="http://wiki.eclipse.org/Equinox_p2_Meeting_2007#Fragments_optional_vs._requirement" target="_blank">http://wiki.eclipse.org/Equinox_p2_Meeting_2007#Fragments_optional_vs._requirement</a></p>
<p><a title="https://bugs.eclipse.org/bugs/show_bug.cgi?id=256430" href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=256430" target="_blank">https://bugs.eclipse.org/bugs/show_bug.cgi?id=256430</a></p>
<p>Any suggestions about handling such &#8220;required&#8221; fragment scenario without getting rid of autogenerated p2 repository and hand crafting p2 metadata?</p>
]]></content:encoded>
			<wfw:commentRss>http://urbas.tk/index.php/2009/05/18/p2-and-fragments/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Defining a background Job to run periodically</title>
		<link>http://urbas.tk/index.php/2009/03/01/defining-a-background-job-to-run-periodically/</link>
		<comments>http://urbas.tk/index.php/2009/03/01/defining-a-background-job-to-run-periodically/#comments</comments>
		<pubDate>Sun, 01 Mar 2009 11:47:25 +0000</pubDate>
		<dc:creator>Radoslaw Urbas</dc:creator>
				<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[IT]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[earlystartup]]></category>
		<category><![CDATA[eclipse jobs api]]></category>
		<category><![CDATA[periodical task]]></category>

		<guid isPermaLink="false">http://urbas.tk/?p=81</guid>
		<description><![CDATA[One may need to run some task periodically in the background in Eclipse. This background task should run automatically and shouldn&#8217;t block user from regular usage of the application. My proposal for accomplishing this is using Eclipse Jobs API and org.eclipse.ui.startup extension-point. Adding org.eclipse.ui.startup extension: Dependencies: org.eclipse.ui org.eclipse.core.runtime Extension: &#60;?xml version="1.0" encoding="UTF-8"?&#62; &#60;?eclipse version="3.2"?&#62; &#60;plugin&#62; [...]]]></description>
			<content:encoded><![CDATA[<p>One may need to run some task periodically in the background in Eclipse. This background task should run automatically and shouldn&#8217;t block user from regular usage of the application. My proposal for accomplishing this is using Eclipse Jobs API and <em>org.eclipse.ui.startup</em> extension-point.</p>
<ol>
<li>Adding <em>org.eclipse.ui.startup</em> extension:
<ul>
<li>Dependencies:
<ul>
<li><em>org.eclipse.ui</em></li>
<li><em>org.eclipse.core.runtime</em></li>
</ul>
</li>
<li>Extension:
<pre>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;?eclipse version="3.2"?&gt;
&lt;plugin&gt;
   &lt;extension point="org.eclipse.ui.startup"&gt;
      &lt;startup class="tk.urbas.eclipse.urbanlife.Startup"&gt;&lt;/startup&gt;
   &lt;/extension&gt;
&lt;/plugin&gt;</pre>
</li>
</ul>
</li>
<li>Implementing Job:

<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;">tk.urbas.eclipse.urbanlife</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.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.Status</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>
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> RefreshDataJob <span style="color: #000000; font-weight: bold;">extends</span> Job <span style="color: #009900;">&#123;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> RefreshDataJob<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;">super</span><span style="color: #009900;">&#40;</span>name<span style="color: #009900;">&#41;</span><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;">// Work to do in the background</span>
        <span style="color: #000000; font-weight: bold;">return</span> Status.<span style="color: #006633;">OK_STATUS</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

</li>
<li>Scheduling Job to run periodically:

<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;">tk.urbas.eclipse.urbanlife</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.eclipse.core.runtime.jobs.IJobChangeEvent</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;">org.eclipse.core.runtime.jobs.JobChangeAdapter</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.eclipse.ui.IStartup</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> Startup <span style="color: #000000; font-weight: bold;">implements</span> IStartup <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> STARTUP_DELAY <span style="color: #339933;">=</span> <span style="color: #cc66cc;">5000</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// 5 seconds delay for first run</span>
    <span style="color: #000000; font-weight: bold;">protected</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> JOB_INTERVAL <span style="color: #339933;">=</span> <span style="color: #cc66cc;">60000</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// Job should run every 60 seconds</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> earlyStartup<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;">final</span> Job updateJob <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> RefreshDataJob<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Refreshing data in the background&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        updateJob.<span style="color: #006633;">schedule</span><span style="color: #009900;">&#40;</span>STARTUP_DELAY<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        updateJob.<span style="color: #006633;">addJobChangeListener</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> JobChangeAdapter<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            @Override
            <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> done<span style="color: #009900;">&#40;</span>IJobChangeEvent event<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #000000; font-weight: bold;">super</span>.<span style="color: #006633;">done</span><span style="color: #009900;">&#40;</span>event<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                updateJob.<span style="color: #006633;">schedule</span><span style="color: #009900;">&#40;</span>JOB_INTERVAL<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;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

</li>
</ol>
<p>
Let me know if you have any better solution for implementing this. All improvements, suggestions and comments will be greatly appreciated.</p>
]]></content:encoded>
			<wfw:commentRss>http://urbas.tk/index.php/2009/03/01/defining-a-background-job-to-run-periodically/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Eclipse plug-in as a web service client</title>
		<link>http://urbas.tk/index.php/2009/02/20/eclipse-plug-in-as-a-web-service-client/</link>
		<comments>http://urbas.tk/index.php/2009/02/20/eclipse-plug-in-as-a-web-service-client/#comments</comments>
		<pubDate>Fri, 20 Feb 2009 21:16:07 +0000</pubDate>
		<dc:creator>Radoslaw Urbas</dc:creator>
				<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[IT]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[axis]]></category>
		<category><![CDATA[plug-in]]></category>
		<category><![CDATA[quick start]]></category>
		<category><![CDATA[web service client]]></category>

		<guid isPermaLink="false">http://urbas.tk/?p=57</guid>
		<description><![CDATA[Recently I was playing around consuming web service inside Eclipse plug-in. Making simple web service call maybe a bit tricky at the beginning. I&#8217;m going to provide quick start instruction here, Required software: Eclipse for RCP/Plug-in Developer JEE Standard Tools &#38; Axis Configuration steps: Define new JEE service in a workspace Create new plug-in project [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I was playing around consuming web service inside Eclipse plug-in. Making simple web service call maybe a bit tricky at the beginning. I&#8217;m going to provide quick start instruction here,</p>
<p><em><strong>Required software</strong></em>:</p>
<ul>
<li>Eclipse for RCP/Plug-in Developer</li>
<li>JEE Standard Tools &amp; Axis<br /><img class="aligncenter size-medium wp-image-59" title="JEE Standard Tools" src="http://urbas.tk/wp-content/eclipse_ws_quickstart_1-300x225.png" alt="JEE Standard Tools" width="300" height="225" /></li>
</ul>
<p><em><strong>Configuration steps</strong></em>:</p>
<ul>
<li>Define new JEE service in a workspace<br /><img class="aligncenter size-medium wp-image-60" title="Defining JEE server" src="http://urbas.tk/wp-content/eclipse_ws_quickstart_2-300x285.png" alt="Defining JEE server" width="300" height="285" /></li>
<li>Create new plug-in project<br /><img class="aligncenter size-medium wp-image-61" title="Creating new plug-in project" src="http://urbas.tk/wp-content/eclipse_ws_quickstart_3-300x285.png" alt="Creating new plug-in project" width="300" height="285" /></li>
<li>Add following dependencies to the plug-in:
<ul>
<li><em>org.apache.commons.logging</em></li>
<li><em>javax.wsdl</em></li>
<li><em>javax.xml.rpc</em></li>
<li><em>javax.xml.soap</em></li>
<li><em>org.apache.commons.discovery</em></li>
<li><em>org.apache.axis</em></li>
</ul>
<p><img class="aligncenter size-medium wp-image-62" title="Web service client dependencies" src="http://urbas.tk/wp-content/eclipse_ws_quickstart_4-289x300.png" alt="Web service client dependencies" width="289" height="300" /></li>
<li>Generate web service client code<br /><img class="aligncenter size-medium wp-image-64" title="Generating web service client code" src="http://urbas.tk/wp-content/eclipse_ws_quickstart_51-300x285.png" alt="Generating web service client code" width="300" height="285" />
<p><img class="aligncenter size-medium wp-image-65" title="Generating web service client code based on WSDL" src="http://urbas.tk/wp-content/eclipse_ws_quickstart_6-300x282.png" alt="Generating web service client code based on WSDL" width="300" height="282" /></li>
</ul>
<p><em><strong>Consume web service</strong></em>:</p>
<p>Using web service in side a plug-in is no different than anyone else. Sample of invoking web service method:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">TransportServiceSoap service <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> TransportServiceLocator<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getTransportServiceSoap</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
service.<span style="color: #006633;">getCities</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Instruction presented above is based on Eclipse 3.4.1 and uses sample web service from <a href="http://www.urbanlife.pl/">http://www.urbanlife.pl/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://urbas.tk/index.php/2009/02/20/eclipse-plug-in-as-a-web-service-client/feed/</wfw:commentRss>
		<slash:comments>6</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>1</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>3</slash:comments>
		</item>
	</channel>
</rss>

