<?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</title>
	<atom:link href="http://urbas.tk/index.php/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>JDD09</title>
		<link>http://urbas.tk/index.php/2009/10/17/jdd09/</link>
		<comments>http://urbas.tk/index.php/2009/10/17/jdd09/#comments</comments>
		<pubDate>Sat, 17 Oct 2009 19:34:46 +0000</pubDate>
		<dc:creator>Radoslaw Urbas</dc:creator>
				<category><![CDATA[IT]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[java conference]]></category>
		<category><![CDATA[jdd]]></category>
		<category><![CDATA[krakow]]></category>
		<category><![CDATA[poland]]></category>

		<guid isPermaLink="false">http://urbas.tk/?p=139</guid>
		<description><![CDATA[4th edition of Java Developers&#8217; Day is over. It was the first time I attended this conference. I enjoyed most of the sessions and the organization was pretty good. I will definitely plan to be there next year as well. My favorite JDD09 speakers/sessions: Effective Code Review for Agile Java Developers &#8211; Wojciech Seliga (I [...]]]></description>
			<content:encoded><![CDATA[<p><img class="size-full wp-image-141 alignleft" style="margin-right: 5px" title="Java Developers' Day" src="http://urbas.tk/wp-content/jdd.png" alt="Java Developers' Day" width="165" height="61" align="left" />4th edition of <a href="http://jdd.org.pl/" target="_blank">Java Developers&#8217; Day</a> is over. It was the first time I attended this conference. I enjoyed most of the sessions and the organization was pretty good.  I will definitely plan to be there next year as well. My favorite JDD09 speakers/sessions:</p>
<ul>
<li><em>Effective Code Review for Agile Java Developers</em> &#8211; <a href="http://www.spartez.com/en/our-people-agile-developers/wojciech-seliga.html" target="_blank">Wojciech Seliga</a> (I need to try Crucible!)</li>
<li><a href="http://wmrichards.com/slides/JDD_2009_AntiPatterns.pdf" target="_blank"><em>Common Anti-patterns and Ways to Avoid Them</em></a> – <a href="http://wmrichards.com/" target="_blank">Mark Richards</a> (It could be at least twice as long as it was)</li>
<li><em>Resource-Oriented Architecture (ROA) and REST</em> &#8211; <a href="http://www.davisworld.org/" target="_blank">Scott Davis</a> (A lot of evangelism but the show was really good)</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://urbas.tk/index.php/2009/10/17/jdd09/feed/</wfw:commentRss>
		<slash:comments>0</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>Considering learning new language/technology</title>
		<link>http://urbas.tk/index.php/2009/07/21/considering-learning-new-languagetechnology/</link>
		<comments>http://urbas.tk/index.php/2009/07/21/considering-learning-new-languagetechnology/#comments</comments>
		<pubDate>Tue, 21 Jul 2009 21:48:09 +0000</pubDate>
		<dc:creator>Radoslaw Urbas</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[IT]]></category>

		<guid isPermaLink="false">http://urbas.tk/?p=123</guid>
		<description><![CDATA[learning suggestions]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m considering learning new programming language or technology.</p>
<p>My very basic requirements:</p>
<ul>
<li>no for buying new laptop (I&#8217;m happy with my ThinkPad)</li>
<li>no for buying new mobile device just to run something at all (I&#8217;m happy with my Nokia)</li>
</ul>
<p>Any suggestions?</p>
]]></content:encoded>
			<wfw:commentRss>http://urbas.tk/index.php/2009/07/21/considering-learning-new-languagetechnology/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>That is why WordPress is so cool</title>
		<link>http://urbas.tk/index.php/2009/06/20/that-is-why-wordpress-is-so-cool/</link>
		<comments>http://urbas.tk/index.php/2009/06/20/that-is-why-wordpress-is-so-cool/#comments</comments>
		<pubDate>Sat, 20 Jun 2009 16:02:26 +0000</pubDate>
		<dc:creator>Radoslaw Urbas</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[2.8]]></category>
		<category><![CDATA[upgrade]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://urbas.tk/?p=119</guid>
		<description><![CDATA[Single click &#8230; Downloading update from http://wordpress.org/wordpress-2.8.zip Unpacking the core update Verifying the unpacked files Installing the latest version Upgrading database WordPress upgraded successfully &#8230; and voilà! Upgrade completed!]]></description>
			<content:encoded><![CDATA[<p>Single click &#8230;</p>
<p><em><span style="color: #808080;">Downloading update from http://wordpress.org/wordpress-2.8.zip<br />
Unpacking the core update<br />
Verifying the unpacked files<br />
Installing the latest version<br />
Upgrading database</span><span style="color: #808080;"><br />
WordPress upgraded successfully</span></em></p>
<p>&#8230; and voilà! Upgrade completed!</p>
]]></content:encoded>
			<wfw:commentRss>http://urbas.tk/index.php/2009/06/20/that-is-why-wordpress-is-so-cool/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>June 2009 elections at the European Parliament</title>
		<link>http://urbas.tk/index.php/2009/06/08/european-parliament/</link>
		<comments>http://urbas.tk/index.php/2009/06/08/european-parliament/#comments</comments>
		<pubDate>Mon, 08 Jun 2009 19:42:31 +0000</pubDate>
		<dc:creator>Radoslaw Urbas</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://urbas.tk/?p=113</guid>
		<description><![CDATA[elections, Poland, European Parliament  ]]></description>
			<content:encoded><![CDATA[<p>The website of Państwowa Komisja Wyborcza (the institution responsible for the elections in Poland) around the time when the official results are supposed to be published.</p>
<div id="attachment_114" class="wp-caption aligncenter" style="width: 452px"><a href="http://urbas.tk/wp-content/pkw.jpg"><img class="size-large wp-image-114" title="Państwowa Komisja Wyborcza" src="http://urbas.tk/wp-content/pkw-1024x622.jpg" alt="Państwowa Komisja Wyborcza" width="442" height="268" /></a><p class="wp-caption-text">Państwowa Komisja Wyborcza</p></div>
]]></content:encoded>
			<wfw:commentRss>http://urbas.tk/index.php/2009/06/08/european-parliament/feed/</wfw:commentRss>
		<slash:comments>0</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>
	</channel>
</rss>

