<?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>EclipseSource Blog &#187; Matthias Kempka</title>
	<atom:link href="http://eclipsesource.com/blogs/author/mkempka/feed/" rel="self" type="application/rss+xml" />
	<link>http://eclipsesource.com/blogs</link>
	<description>Eclipse Equinox OSGi</description>
	<lastBuildDate>Tue, 27 Jul 2010 10:17:51 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>How to structure two dozen Eclipse workspaces</title>
		<link>http://eclipsesource.com/blogs/2010/05/21/how-to-structure-two-dozen-eclipse-workspaces/</link>
		<comments>http://eclipsesource.com/blogs/2010/05/21/how-to-structure-two-dozen-eclipse-workspaces/#comments</comments>
		<pubDate>Fri, 21 May 2010 10:36:20 +0000</pubDate>
		<dc:creator>Matthias Kempka</dc:creator>
				<category><![CDATA[eclipse]]></category>
		<category><![CDATA[syndicate]]></category>
		<category><![CDATA[yoxos5]]></category>
		<category><![CDATA[yoxos]]></category>

		<guid isPermaLink="false">http://eclipsesource.com/blogs/?p=4255</guid>
		<description><![CDATA[I have tons of Eclipse workspaces. The last time I counted it was around 24, but it actually changes on a daily basis.
With some of my workspaces I want to have a similar IDE as with others, but some IDEs require special plug-ins. A while ago, as I still unzipped Eclipse-downloads, this was a huge [...]]]></description>
			<content:encoded><![CDATA[<p>I have tons of Eclipse workspaces. The last time I counted it was around 24, but it actually changes on a daily basis.</p>
<p>With some of my workspaces I want to have a similar IDE as with others, but some IDEs require special plug-ins. A while ago, as I still unzipped Eclipse-downloads, this was a huge pain. Every time I wanted to work in a specific workspace I had to remember which IDE I used for what, then find the workspace location on the disk, before I could do anything.</p>
<h4>Permanent workspaces</h4>
<p>Now I double-click a .yoxos file on my Desktop, then start working. Related .yoxos files hang out together on different areas on my desktop. This is possible with the <a href="http://www.eclipsesource.com/yoxos5">Yoxos 5 Launcher</a> which I explained in my <a href="http://eclipsesource.com/blogs/2010/05/11/a-new-era-of-managing-eclipse-installations-has-begun/">last blog post</a>.</p>
<p>I associate the workspace I want to start in terms of &#8220;upper right&#8221; or &#8220;vaguely in the middle, left&#8221; on the screen. No need to remember long directory names.<br />
<a href="http://eclipsesource.com/blogs/2010/05/11/a-new-era-of-managing-eclipse-installations-has-begun/">Remember</a>, a .yoxos file is a definition of both the workspace and the IDE that works on the workspace. The actual workspace is somewhere in my home directory. Since every .yoxos file defines a separate IDE, I always click &#8220;Use this as default&#8221; after defining the first time where the workspace is located.<br />
<a href="http://eclipsesource.com/blogs/wp-content/uploads/2010/05/ScreenSnapz283.png"><img class="aligncenter size-medium wp-image-4261" title="Desktop structure" src="http://eclipsesource.com/blogs/wp-content/uploads/2010/05/ScreenSnapz283-300x207.png" alt="ScreenSnapz283 300x207 How to structure two dozen Eclipse workspaces" width="300" height="207" /></a></p>
<h4>Temporary workspaces</h4>
<p>Throwaway workspaces go to /tmp. Along with everything else in /tmp, they will be deleted the next time I reboot. The .yoxos file that defines a throwaway workspace should be deleted with it, so this belongs to /tmp as well. The IDE definition works this way:</p>
<ul>
<li>Start the Yoxos Launcher</li>
<li>Add &#8220;Project SDK&#8221; and all the other desired plug-ins</li>
<li>Save the .yoxos file to &#8220;/tmp/throwaway-workspace&#8221; (a new empty directory)</li>
<li>Hit &#8220;Launch&#8221;</li>
</ul>
<p><a href="http://eclipsesource.com/blogs/wp-content/uploads/2010/05/ScreenSnapz281.png"><img class="aligncenter size-medium wp-image-4263" title="ScreenSnapz281" src="http://eclipsesource.com/blogs/wp-content/uploads/2010/05/ScreenSnapz281-300x205.png" alt="ScreenSnapz281 300x205 How to structure two dozen Eclipse workspaces" width="300" height="205" /></a><br />
With the bundle pool I don&#8217;t worry about the plug-ins that compose the throwaway IDE. Only rarely something new gets downloaded anyway.</p>
<h4>.yoxos files and workspaces</h4>
<p>A special handling of .yoxos files in otherwise empty directories supports this workflow. If a .yoxos file is is started while residing in an empty directory, the IDE uses this directory as workspace. This provides an easy answer to the question about the &#8220;where&#8221;, and I use this feature at a regular basis.</p>
<p>On Mac OS X, I can append the extension &#8220;.yoxosws&#8221; to a directory that contains a .yoxos file. This defines a workspace that I can start directly with a double-click, without bothering about opening a folder to access the .yoxos file.</p>
<h4>Conclusion</h4>
<p>The <a href="http://www.eclipsesource.com/yoxos5">Yoxos 5 Launcher</a> makes it simple to handle a multitude of workspaces. The best thing is that you can stop wondering about the IDE contents and start thinking about workspaces. The Launcher provides a consistent UI to define new IDEs, including a huge number of 3rd-party plug-ins that are not shipped with the default Eclipse downloads.</p>
]]></content:encoded>
			<wfw:commentRss>http://eclipsesource.com/blogs/2010/05/21/how-to-structure-two-dozen-eclipse-workspaces/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>A new era of managing Eclipse installations has begun</title>
		<link>http://eclipsesource.com/blogs/2010/05/11/a-new-era-of-managing-eclipse-installations-has-begun/</link>
		<comments>http://eclipsesource.com/blogs/2010/05/11/a-new-era-of-managing-eclipse-installations-has-begun/#comments</comments>
		<pubDate>Tue, 11 May 2010 13:05:45 +0000</pubDate>
		<dc:creator>Matthias Kempka</dc:creator>
				<category><![CDATA[eclipse]]></category>
		<category><![CDATA[syndicate]]></category>
		<category><![CDATA[yoxos5]]></category>
		<category><![CDATA[yoxos]]></category>

		<guid isPermaLink="false">http://eclipsesource.com/blogs/?p=4200</guid>
		<description><![CDATA[Back in the old days, maintaining an Eclipse installation was easy. You just downloaded the Eclipse; it included the JDK and you used this Eclipse on all your workspaces.
But the number of useful plug-ins increased, and many are not included in the downloads from eclipse.org. Developers use different plug-ins in different workspace. For some developers, this [...]]]></description>
			<content:encoded><![CDATA[<p>Back in the old days, maintaining an Eclipse installation was easy. You just downloaded the Eclipse; it included the JDK and you used this Eclipse on all your workspaces.</p>
<p>But the number of useful plug-ins increased, and many are not included in the downloads from eclipse.org. Developers use different plug-ins in different workspace. For some developers, this leads to as many Eclipse installations as workspaces. Others capitulated and just don&#8217;t use many plug-ins even though they see their value; but managing the installations is just too hard. Others again have one huge installation that includes about everything for all the workspaces, and they too have pain with plug-in dependencies. They all suffer from plug-in dependencies.</p>
<p>Imagine you had a system where each plug-in you use is downloaded just once and reused whenever you need it for a new Eclipse IDE.</p>
<p>Yoxos 5 provides that.</p>
<p><a href="http://eclipsesource.com/blogs/wp-content/uploads/2010/05/ScreenSnapz276.png"><img class="aligncenter size-medium wp-image-4224" title="ScreenSnapz276" src="http://eclipsesource.com/blogs/wp-content/uploads/2010/05/ScreenSnapz276-300x142.png" alt="ScreenSnapz276 300x142 A new era of managing Eclipse installations has begun" width="300" height="142" /></a></p>
<p style="text-align: center;">
<p style="text-align: left;">
<p style="text-align: left;">
<p style="text-align: left;">Imagine you could just start your workspace and your IDE starts up including all plug-ins you want to work with in that workspace. If it is a new workspace you&#8217;d have automatically adjusted predefined settings, import projects etc.</p>
<p style="text-align: left;">Yoxos 5 excels at that.</p>
<p style="text-align: center;"><a href="http://eclipsesource.com/blogs/wp-content/uploads/2010/05/ScreenSnapz270.png"><img class="aligncenter size-medium wp-image-4210" title="ScreenSnapz270" src="http://eclipsesource.com/blogs/wp-content/uploads/2010/05/ScreenSnapz270-300x272.png" alt="ScreenSnapz270 300x272 A new era of managing Eclipse installations has begun" width="300" height="272" /></a></p>
<p style="text-align: center;">
<p style="text-align: left;">
<p style="text-align: left;">Yoxos 5 unifies the workspace settings and its IDE description in a Yoxos Profile. A Yoxos Profile can be defined in a .yoxos file. The Yoxos Launcher creates Yoxos Profiles and starts them, for example when double-clicking the .yoxos file. Plug-ins are downloaded to the bundle pool and started only if the profile includes them.</p>
<p style="text-align: left;">Yoxos 5 is now in beta phase. You can try it out now:</p>
<ul>
<li><a href="http://eclipsesource.com/en/yoxos/yoxos-5-beta/download-yoxos-5-beta/">Download</a> and install the Yoxos Launcher</li>
<li>Download and start one of the sample profiles (further down at the download page)</li>
</ul>
<p>Get more information at <a href="http://eclipsesource.com/yoxos5">http://eclipsesource.com/yoxos5</a></p>
]]></content:encoded>
			<wfw:commentRss>http://eclipsesource.com/blogs/2010/05/11/a-new-era-of-managing-eclipse-installations-has-begun/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Take actions against sluggish desktop applications</title>
		<link>http://eclipsesource.com/blogs/2009/10/23/take-actions-against-sluggish-desktop-applications/</link>
		<comments>http://eclipsesource.com/blogs/2009/10/23/take-actions-against-sluggish-desktop-applications/#comments</comments>
		<pubDate>Fri, 23 Oct 2009 10:43:47 +0000</pubDate>
		<dc:creator>Matthias Kempka</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[news]]></category>

		<guid isPermaLink="false">http://eclipsesource.com/blogs/?p=3244</guid>
		<description><![CDATA[Let me state two facts:

My computer has 2 cores (there will be more in the future).
My IDE feels sluggier with every version.

Applications feel fast if the time between user action and application reaction is short. Ben Galbraith suggests that this threshold is around 200 ms for web applications, for desktop applications the boundary is lower. [...]]]></description>
			<content:encoded><![CDATA[<p>Let me state two facts:</p>
<ol>
<li>My computer has 2 cores (there will be more in the future).</li>
<li>My IDE feels sluggier with every version.</li>
</ol>
<p>Applications feel fast if the time between user action and application reaction is short. Ben Galbraith <a href="http://ajaxian.com/archives/craftmanship-and-ui-latency">suggests</a> that this threshold is around 200 ms for web applications, for desktop applications the boundary is lower. <a href="http://www.useit.com/papers/responsetime.html">A rule of thumb</a> places it around 100 ms, so I there must be a yellow range in between.<br />
<a rel="attachment wp-att-3247" href="http://eclipsesource.com/blogs/2009/10/23/take-actions-against-sluggish-desktop-applications/performance/"></a></p>
<p style="text-align: center;"><img class="alignnone size-full wp-image-3247" title="performance" src="http://eclipsesource.com/blogs/wp-content/uploads/2009/10/performance.png" alt="performance Take actions against sluggish desktop applications" width="230" height="100" /></p>
<p>My IDE crosses this threshold more often than it should, so it&#8217;s sluggish. What&#8217;s the reason and what can be done about it?</p>
<p>It seems like a fundamental law in software engineering that every new version of any program executes more code than the previous version.</p>
<p>Java 5 introduced the java.util.concurrent API that made corse grained parallelism easier. The combination of thread pools, Futures and Barriers covered a wide range of tasks between CPU and I/O bound.</p>
<p>To me as UI programmer this had little consequence. For a while I could <a href="http://www.javaworld.com/javaworld/jw-02-1998/jw-02-jperf.html">still</a> state that Java+<a href="http://www.devx.com/Java/Article/21453">SWT</a> is <a href="http://en.wikipedia.org/wiki/Java_performance">fast</a>, consuming my part of that lunch that <a href="http://www.gotw.ca/publications/concurrency-ddj.htm">is not free any more</a> but was cheap enough anyway in the doses I required.</p>
<p>This is changing. A few years ago we saw a pain barrier reached and solved in startup time of various operating systems. Today my pain barrier is reached in many of the functions that are executed as reaction to user clicks and key presses in my IDE. Undoubtedly it is only a matter of time when this will apply to smaller desktop applications, too. They must react, and using multiple cores is the solution at hand.</p>
<p>Other languages and frameworks already have good support for multicore programming, Java 7 will include the <a href="http://gee.cs.oswego.edu/dl/jsr166/dist/jsr166ydocs/">ForkJoin framework</a> for Java. In the wild, it is a library known as <a href="http://gee.cs.oswego.edu/dl/concurrency-interest/">jsr166y</a> that can also be used with Java 6.</p>
<p>In the following I&#8217;ll discuss a little example that shows how to use the ForkJoin framework.</p>
<p>A simple easily parallelizable example is assigning random values in a large array. It&#8217;s also an example that can not be solved with raw processor power but  accesses memory.</p>
<p>First, care must be taken where the random number comes from. Even a sequential solution using ForkJoins <a href="http://gee.cs.oswego.edu/dl/jsr166/dist/jsr166ydocs/jsr166y/ThreadLocalRandom.html">ThreadLocalRandom</a> was about twice as fast than one with Math.random(). It&#8217;s also more comfortable to use.</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">    <span style="color: #000066; font-weight: bold;">int</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> result <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #000066; font-weight: bold;">int</span><span style="color: #009900;">&#91;</span>ARR_SIZE<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span> <span style="color: #000066; font-weight: bold;">int</span> i <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> i <span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span> result.<span style="color: #006633;">length</span><span style="color: #339933;">;</span> i<span style="color: #339933;">++</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      result<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> ThreadLocalRandom.<span style="color: #006633;">current</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">nextInt</span><span style="color: #009900;">&#40;</span> result.<span style="color: #006633;">length</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span></pre></div></div>

<p>ForkJoin provides a class named <code>ForkJoinPool</code> as executor service for tasks. The constructor can be configured with the parallelism (number of threads) to be used. The default constructor takes the number of available processors as returned by <code>Runtime.availableProcessors()</code>. The pool is then given tasks for execution.</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">    ForkJoinPool pool <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> ForkJoinPool<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    pool.<span style="color: #006633;">invoke</span><span style="color: #009900;">&#40;</span> <span style="color: #000000; font-weight: bold;">new</span> ArrayGenerator<span style="color: #009900;">&#40;</span> result, <span style="color: #cc66cc;">0</span>, result.<span style="color: #006633;">length</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>The <code>ArrayGenerator</code> is a <a href="http://gee.cs.oswego.edu/dl/jsr166/dist/jsr166ydocs/jsr166y/RecursiveAction.html">RecursiveAction</a>. The RecursiveAction differs from the RecursiveTask mainly in the return value of the <code>compute()</code> method. It&#8217;s implementation is a straightforward recursive algorithm. First, there is an exit condition that solves the remaining problem sequentially. If that is not hit yet, the remaining problem is divided for two other RecursiveActions. Those are given to <code>invokeAll</code>, which blocks execution in this task until all subtasks are executed. In my experiments, the definition of the exit condition didn&#8217;t matter as long as all cores where busy at least once.</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> ArrayGenerator <span style="color: #000000; font-weight: bold;">extends</span> RecursiveAction <span style="color: #009900;">&#123;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">int</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> nums<span style="color: #339933;">;</span>
  <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">final</span> <span style="color: #000066; font-weight: bold;">int</span> start, end<span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">public</span> ArrayGenerator<span style="color: #009900;">&#40;</span> <span style="color: #000066; font-weight: bold;">int</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> nums, <span style="color: #000066; font-weight: bold;">int</span> start, <span style="color: #000066; font-weight: bold;">int</span> end <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">nums</span> <span style="color: #339933;">=</span> nums<span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">start</span> <span style="color: #339933;">=</span> start<span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">end</span> <span style="color: #339933;">=</span> end<span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  @Override
  <span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000066; font-weight: bold;">void</span> compute<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span> arrayIsSmallEnough<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      assignSequential<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;">else</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #000066; font-weight: bold;">int</span> middle <span style="color: #339933;">=</span> start <span style="color: #339933;">+</span> <span style="color: #009900;">&#40;</span>end <span style="color: #339933;">-</span> start<span style="color: #009900;">&#41;</span><span style="color: #339933;">/</span><span style="color: #cc66cc;">2</span><span style="color: #339933;">;</span>
      ArrayGenerator left <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> ArrayGenerator<span style="color: #009900;">&#40;</span>nums, start, middle<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      ArrayGenerator right <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> ArrayGenerator<span style="color: #009900;">&#40;</span>nums, middle, end<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      invokeAll<span style="color: #009900;">&#40;</span> left, right <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span>
 ...
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>On my machine with 2 cores I achieved a speedup of 1.24 over the sequential solution. While that&#8217;s not as good as I hoped it still is a significant improvement that has the chance to move my clicks back down into the green area. I suspect that more cores could achieve a better speedup, so there is free lunch again once I design my program for concurrent execution.</p>
<p>Programming with this framework seems easy enough to me to see it adopted widely. However, we must rethink our problems and search for chances to <a href="http://www.ddj.com/hpc-high-performance-computing/201804248">parallelize</a>.<br />
I implemented the same thing with ThreadPoolExecutors and Futures. While the execution time did not differ there, it took me 3 times as long to implement it.</p>
]]></content:encoded>
			<wfw:commentRss>http://eclipsesource.com/blogs/2009/10/23/take-actions-against-sluggish-desktop-applications/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>OSGi Import Package and Split Package Woes</title>
		<link>http://eclipsesource.com/blogs/2009/07/14/why-i-cant-recommend-using-import-package/</link>
		<comments>http://eclipsesource.com/blogs/2009/07/14/why-i-cant-recommend-using-import-package/#comments</comments>
		<pubDate>Tue, 14 Jul 2009 15:09:44 +0000</pubDate>
		<dc:creator>Matthias Kempka</dc:creator>
				<category><![CDATA[news]]></category>

		<guid isPermaLink="false">http://eclipsesource.com/blogs/?p=2409</guid>
		<description><![CDATA[Since OSGi developers gained influence in the Eclipse development and trainings discussion&#8230; many words have been said in favour of declaring dependencies via Import-Package instead of Require-Bundle.
The concept of Import-Package is quite appealing. In today&#8217;s world, Java itself doesn&#8217;t have a concept for modules so we depend on OSGi for modularity. Actual dependencies on the [...]]]></description>
			<content:encoded><![CDATA[<p>Since <a href="http://www.osgi.org">OSGi</a> developers gained influence in the Eclipse development and trainings discussion&#8230; many words have been said in favour of declaring dependencies via <code>Import-Package</code> instead of <code>Require-Bundle</code>.</p>
<p>The concept of <code>Import-Package</code> is quite appealing. In today&#8217;s world, Java itself doesn&#8217;t have a concept for modules so we depend on OSGi for modularity. Actual dependencies on the Java side are specified on the class and package level. So it feels more natural to specify what you need via <code>Import-Package</code> instead of where you want something from via <code>Require-Bundle</code>.</p>
<p>As an experienced Eclipse developer dealing with many large projects&#8230; I&#8217;ve lost some enthusiasm for <code>Import-Package</code>. All those different bundles and their dependencies are difficult enough to grasp for newcomers. <code>Require-Bundle</code> has better tooling support in Eclipse and less complexity in general&#8230; so I recommend to use <code>Require-Bundle</code> unless someone needs the improved flexibility of <code>Import-Package</code>.</p>
<p>What&#8217;s the reason for my attitude?</p>
<p>Recently I spent some time with a <a href="http://eclipsesource.com/blogs/2009/07/06/single-sourcing-webinar-rcp-and-rap/">single-sourcing</a> a <a href="http://www.eclipse.org/rap">RAP</a>/<a href="http://www.eclipse.org/rcp">RCP</a> project. Having different target platforms for the same bundles is a perfect example where you need the flexibility of <code>Import-Package</code>. Flexibility is good, right? So I went ahead and declared all dependencies as <code>Import-Package</code>.</p>
<p>Now imagine you have declared an <code>Import-Package</code> to the <code>org.eclipse.ui</code> bundle, being sure that org.eclipse.ui is exported in your target.</p>
<p>Everything is fine, right? So far so good in the typical Eclipse RCP case.</p>
<p>However, it&#8217;s not so fine if you try it with RAP although you&#8217;ll find that bundle <code>org.eclipse.rap.ui.workbench</code> exports the <code>org.eclipse.ui</code> package.</p>
<p>So the situation is:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">my.bundle imports org.eclipse.ui
org.eclipse.rap.ui.workbench exports org.eclipse.ui</pre></div></div>

<p>However, your bundle just won’t be resolved due to a missing <code>Import-Package</code> constraint on <code>org.eclipse.ui</code>.</p>
<p>The diagnostics in Equinox don’t help much either&#8230; it just tells you exactly the above imports and exports. I don&#8217;t know if there are better tools out there to diagnose issues.</p>
<p>The reason for this behavior is a concept in Java called <strong>split packages</strong>. It allows the same package to be declared across several bundles&#8230; giving each split a special name. So it’s something like a sub-package concept for packages. Although it is discouraged in the OSGi specification&#8230; it is used by the Eclipse workbench and other areas where there has been a lot of refactoring and <code>Require-Bundle</code> usage.</p>
<p>The correct import declaration in my.bundle would be</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">Import-Package: org.eclipse.ui; ui.workbench=&quot;split&quot;</pre></div></div>

<p>Why does it work in the RCP target case? </p>
<p>It wouldn’t if your target platform contains RCP only. However, most RCP applications have the bundle <code>org.eclipse.ui.ide</code> in their target platform which exports another split of the <code>org.eclipse.ui package</code>. OSGi only resolves split packages if at least two exported split packages can be found.</p>
<p>Knowing this&#8230; I now can safely use <code>Import-Package</code> for my single-sourced applications. However, I don’t see a way how I possibly could recommend this to students in my training courses or new people to OSGi in general. I’d need to tell them “Look, <code>Require-Bundle</code> is something that has been used in Eclipse for awhile, mostly for legacy reasons. We don’t recommend its use any more. <code>Import-Package</code> is better if you want looser coupling between bundles. However, be aware of the pain split packages can cause.&#8221;</p>
<p>I guess my gripe is that split packages make things complicated and we need better tooling to support them.</p>
<p>How are other people handling split packages in the wild?</p>
]]></content:encoded>
			<wfw:commentRss>http://eclipsesource.com/blogs/2009/07/14/why-i-cant-recommend-using-import-package/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>Nifty Progress Reporting in RCP Applications</title>
		<link>http://eclipsesource.com/blogs/2009/03/18/nifty-progress-report-in-rcp-applications/</link>
		<comments>http://eclipsesource.com/blogs/2009/03/18/nifty-progress-report-in-rcp-applications/#comments</comments>
		<pubDate>Wed, 18 Mar 2009 09:25:09 +0000</pubDate>
		<dc:creator>Matthias Kempka</dc:creator>
				<category><![CDATA[eclipse]]></category>
		<category><![CDATA[syndicate]]></category>

		<guid isPermaLink="false">http://eclipsesource.com/blogs/?p=935</guid>
		<description><![CDATA[I don&#8217;t (always) like the ways Eclipse provides me to do long running operations. So I created another way with a nicer UI.
With the Jobs framework the Eclipse IDE provides some means for long running operations. The Jobs framework is able to run tasks in a parallel fashion and queue the rest, while providing user [...]]]></description>
			<content:encoded><![CDATA[<p>I don&#8217;t (always) like the ways Eclipse provides me to do long running operations. So I created another way with a nicer UI.</p>
<p>With the Jobs framework the Eclipse IDE provides some means for long running operations. The Jobs framework is able to run tasks in a parallel fashion and queue the rest, while providing user feedback with progress monitors. Other RCP applications have different needs when doing long running operations.</p>
<p>Specifically the Job frameworks UI feedback is not always what an RCP application wants. Sometimes I find that I&#8217;d rather prevent the user from clicking in the UI than queue more jobs. This happens for example if the user action triggers a network access that might take a while. There is no point in accepting the same user action again. So I want to provide a nice feedback mechanism to the user that their click is being processed.</p>
<p>Eclipse provides a progress monitor dialog. It&#8217;s a modal dialog that shows a process to the user and prevents her from clicking in the workbench. Personally, I don&#8217;t think it&#8217;s very appealing. Also, it&#8217;s not what I want&#8230; while I want some view being blocked often other views should stay operable.</p>
<p><img class="size-full wp-image-940 alignright" title="swtscreensnapz035" src="http://eclipsesource.com/blogs/wp-content/uploads/2009/03/swtscreensnapz035.png" alt="swtscreensnapz035 Nifty Progress Reporting in RCP Applications" width="265" height="253" /></p>
<p>I don&#8217;t know anything that means my use case from Eclipse so I created a few classes myself that take care of a presentable way to block workbench parts. Basically it&#8217;s a transparent shell that lays itself over a given control and displays a SWT ProgressIndicator widget. It responds to the controls re-size, move and disposal events&#8230; and looks quite neat! Way better than the progress modal dialog, and it leaves it up to the programmer which part of the UI should be blocked.</p>
<p>From the programmers point of view, I took the approach we find in Eclipse all the time: The programmer has to implement some &#8220;I..Runner&#8221; interface that is custom to my API.<br />
It contains a run method that takes an IProgressMonitor and is called outside the UI thread.<br />
My aim was to make the different steps during and after the long running operation as clear as possible to the programmer and reduce their need for inner classes. Unlike the Eclipse API I don&#8217;t think that it&#8217;s the users responsibility to sync back into the UI thread. This use case is common and creates unnecessary bloat in the source code. Therefore I provide 2 methods that are called within the UI thread after the operation is done, one for doing the actual feedback for the user and one for exception handling (if necessary).</p>
<pre class="brush: java">
public interface IResponsiveRunner {

/**
* called from without the UI Thread
*/
public abstract void runOutsideUIThread( final IProgressMonitor monitor ) throws Exception;

/**
* called after {@link #runOutsideUIThread(IProgressMonitor)} from within the UI Thread
*/
public abstract void uiFeedbackAfterRun();

/**
* Called within the UI thread. This method is called if an error occurs during execute before
* {@link #uiFeedbackAfterRun()} is called.
* @param caught
*/
public abstract void handleException( final Exception caught );
}
</pre>
<p>This is what a programmer has to implement. Starting the nifty progress report is very similar to using a progress monitor dialog, instantiate and run:</p>
<pre class="brush: java">
new NiftyProgress( myResponsiveRunner, new TransparentUIBlocker( control ) ).run();
</pre>
<p>The TransparentUIBlocker is the class that does the actual blocking. It&#8217;s passed in under a generic IUIBlocker interface that might have other implementations.</p>
<p>So, as a programmer, you provide an implementation of the IResponsiveRunner and point to a control that should be blocked, and you&#8217;re done. Nifty feedback to the user.</p>
<p>I <a rel="attachment wp-att-947" href="http://eclipsesource.com/blogs/2009/03/18/nifty-progress-report-in-rcp-applications/niftyprogress/">attached a zip</a> with plug-in projects with the classes and a small application that makes use of them. Use it, it&#8217;s EPL.</p>
<p>Oh, and if someone can tell me how to get notified if a view is hidden behind another one in a view stack, please do.</p>
]]></content:encoded>
			<wfw:commentRss>http://eclipsesource.com/blogs/2009/03/18/nifty-progress-report-in-rcp-applications/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Very basic dependencies</title>
		<link>http://eclipsesource.com/blogs/2009/02/02/very-basic-dependencies/</link>
		<comments>http://eclipsesource.com/blogs/2009/02/02/very-basic-dependencies/#comments</comments>
		<pubDate>Mon, 02 Feb 2009 11:01:24 +0000</pubDate>
		<dc:creator>Matthias Kempka</dc:creator>
				<category><![CDATA[eclipse]]></category>
		<category><![CDATA[syndicate]]></category>
		<category><![CDATA[swt]]></category>

		<guid isPermaLink="false">http://eclipsesource.com/blogs/?p=296</guid>
		<description><![CDATA[We recently moved our continuous integration builds to a new server. The builds are set up self-contained or have only little dependencies to files outside their workspace. So it shouldn&#8217;t be a big deal: Just set up the new projects in your CI server and copy over the settings from the old projects, right?
And if you [...]]]></description>
			<content:encoded><![CDATA[<p>We recently moved our continuous integration builds to a new server. The builds are set up self-contained or have only little dependencies to files outside their workspace. So it shouldn&#8217;t be a big deal: Just set up the new projects in your CI server and copy over the settings from the old projects, right?</p>
<p>And if you then get an error that even Google knows only 2 pages of useless results about, you start scratching your head. At least I did after I got this one:</p>
<pre class="brush: java">
java.lang.UnsatisfiedLinkError: no swt-pi-gtk-3346 or swt-pi-gtk in swt.library.path, java.library.path or the jar file
</pre>
<p>It gets a bit more mysterious when you start looking for the swt-pi-gtk libraries, locate them in one of the SWT fragments, and you make sure that all your &#8220;-os&#8221; &#8220;-ws&#8221; and &#8220;-arch&#8221; options are set correctly.</p>
<p>To make the long story short, the solution was to install GTK on the new server&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://eclipsesource.com/blogs/2009/02/02/very-basic-dependencies/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>First blog entry: Hello world</title>
		<link>http://eclipsesource.com/blogs/2009/01/12/first-blog-entry-hello-world/</link>
		<comments>http://eclipsesource.com/blogs/2009/01/12/first-blog-entry-hello-world/#comments</comments>
		<pubDate>Mon, 12 Jan 2009 10:26:36 +0000</pubDate>
		<dc:creator>Matthias Kempka</dc:creator>
				<category><![CDATA[news]]></category>
		<category><![CDATA[syndicate]]></category>

		<guid isPermaLink="false">http://eclipsesource.com/blogs/?p=195</guid>
		<description><![CDATA[This semester my wife gives a lecture in theoretical computer science at the KIT (Karlsruhe Institute of Technology). The current topic is decidability and therefor the students learn about the halting problem. The whole topic is rather dry and good examples for illustration are always welcome.
One example I liked is the question whether a program [...]]]></description>
			<content:encoded><![CDATA[<p>This semester my wife gives a lecture in theoretical computer science at the KIT (Karlsruhe Institute of Technology). The current topic is decidability and therefor the students learn about the <a href="http://en.wikipedia.org/wiki/Halting_Problem">halting problem</a>. The whole topic is rather dry and good examples for illustration are always welcome.</p>
<p>One example I liked is the question whether a program is a virus or not. As a proof, you could reduce the halting problem to this problem, but it is far better illustrated by giving a self-referencing program (the formal proof then would be based on <a href="http://en.wikipedia.org/wiki/Diagonal_lemma">diagonalization</a>):</p>
<p>Let <code>P</code> be the program that decides whether <code>A</code> is a virus. Then you could define your virus <code>A</code> as:</p>
<pre>if P(A) then exit;
else infect();</pre>
<p>Great, isn&#8217;t it? The virus knows the virus-detector <code>P</code> and doesn&#8217;t behave as a virus if <code>P</code> can identify it as a virus. If not, it&#8217;s evil. q.e.d.</p>
<p>That&#8217;s the theory. Let&#8217;s have a practical look at it.</p>
<p>First of all, it seems that the virus author is a pretty bad program designer &#8211; we usually try to avoid circular dependencies. But, being pragmatic I&#8217;m willing to compromise where it is necessary and in this case I must (unless I want to reduce the halting problem).</p>
<p>What seems more awkward to me is that the virus depends on <code>P</code> to being a behavioral analysis. Antivirus programs actually do behavioural analysis to detect viruses. And although I can&#8217;t find a link of proof between all the antivirus ads in Google I remember at least one headline where a root kit detected antivirus software and clouded itself against it.<br />
But Antivirus programs also do statical analysis. In statical analysis the code isn&#8217;t run but only looked at. And any <code>P</code> that does statical analysis would find <code>infect()</code> (hopefully, if the heuristics work) and thus mark the self-clouding virus as virus anyway.</p>
<p>Of course this does not invalidate the proof that I hinted to above. I really like it as example for decidability. It works if you define &#8220;virus&#8221; as a program with <em>malicious behaviour</em>.<br />
It&#8217;s sad that in practice we can&#8217;t always restrict our environment as we need it &#8211; unless we just write a &#8220;Hello World&#8221;.</p>
]]></content:encoded>
			<wfw:commentRss>http://eclipsesource.com/blogs/2009/01/12/first-blog-entry-hello-world/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
