<?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</title>
	<atom:link href="http://eclipsesource.com/blogs/category/syndicate/feed/?author_name=mpost" rel="self" type="application/rss+xml" />
	<link>http://eclipsesource.com/blogs</link>
	<description>Eclipse Equinox OSGi</description>
	<lastBuildDate>Tue, 21 May 2013 09:56:42 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Launch of Eclipse 4.2.2</title>
		<link>http://eclipsesource.com/blogs/2013/03/07/launch-of-eclipse-4-2-2/</link>
		<comments>http://eclipsesource.com/blogs/2013/03/07/launch-of-eclipse-4-2-2/#comments</comments>
		<pubDate>Thu, 07 Mar 2013 11:06:12 +0000</pubDate>
		<dc:creator>Moritz Post</dc:creator>
				<category><![CDATA[EclipseSource News]]></category>
		<category><![CDATA[Editors choice]]></category>
		<category><![CDATA[Planet Eclipse]]></category>
		<category><![CDATA[eclipse]]></category>

		<guid isPermaLink="false">http://eclipsesource.com/blogs/?p=14823</guid>
		<description><![CDATA[The second service release for Eclipse 4.2 has been launched. Grab the latest download here or update your Eclipse IDE via &#8220;Help -&#62; Check for Updates&#8221;. The new release brings the expected bug fixes and a couple of minor but useful tweaks. Personal favorite: The git staging view has regular buttons for &#8220;Commit&#8221; and &#8220;Commit and Push&#8221;.]]></description>
			<content:encoded><![CDATA[<p><a href="http://eclipsesource.com/blogs/wp-content/uploads/2012/06/splash.png"><img class="size-medium wp-image-8601 alignleft" alt="splash 300x200 Launch of Eclipse 4.2.2" src="http://eclipsesource.com/blogs/wp-content/uploads/2012/06/splash-300x200.png" width="300" height="200" title="Launch of Eclipse 4.2.2" /></a></p>
<p>The second service release for Eclipse 4.2 has been launched. Grab the latest download <a href="http://www.eclipse.org/downloads/">here</a> or update your Eclipse IDE via<br />
&#8220;Help -&gt; Check for Updates&#8221;.</p>
<p>The new release brings the expected bug fixes and a couple of minor but useful tweaks.</p>
<p>Personal favorite: The git staging view has regular buttons for &#8220;Commit&#8221; and &#8220;Commit and Push&#8221;.</p>
<p><br/><div style="display: inline-block"><a href="https://twitter.com/intent/tweet?source=webclient&amp;text=Launch+of+Eclipse+4.2.2&amp;via=eclipsesource&amp;url=http://eclipsesource.com/blogs/2013/03/07/launch-of-eclipse-4-2-2/" target="_blank" title="Share on Twitter" style="margin-right: 5px;"><img title="Twitter" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/twitter.png" alt="Twitter"/></a><a href="https://plus.google.com/share?url=http://eclipsesource.com/blogs/2013/03/07/launch-of-eclipse-4-2-2/" target="_blank" title="+1" style="margin-right: 5px;"><img title="Google+" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/google_plus.png" alt="Google+"/></a><a href="http://www.linkedin.com/cws/share?url=http://eclipsesource.com/blogs/2013/03/07/launch-of-eclipse-4-2-2/" target="_blank" title="Share on LinkedIn" style="margin-right: 5px;"><img title="LinkedIn" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/linkedin.png" alt="LinkedIn"/></a><a href="https://www.facebook.com/sharer/sharer.php?u=http://eclipsesource.com/blogs/2013/03/07/launch-of-eclipse-4-2-2/&amp;t=Launch+of+Eclipse+4.2.2" target="_blank" title="Facebook" style="margin-right: 5px;"><img title="Facebook" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/facebook.png" alt="Facebook"/></a></div><br/><a href="http://eclipsesource.com/blogs/2013/03/07/launch-of-eclipse-4-2-2/#comments">Leave a Comment</a>. Tagged with <a href='http://eclipsesource.com/blogs/tag/eclipse/' title='eclipse Tag'>eclipse</a>, <a href='http://eclipsesource.com/blogs/tag/eclipse/' title='eclipse Tag'>eclipse</a></p>]]></content:encoded>
			<wfw:commentRss>http://eclipsesource.com/blogs/2013/03/07/launch-of-eclipse-4-2-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Serious unit testing on Android</title>
		<link>http://eclipsesource.com/blogs/2012/06/15/serious-unit-testing-on-android/</link>
		<comments>http://eclipsesource.com/blogs/2012/06/15/serious-unit-testing-on-android/#comments</comments>
		<pubDate>Fri, 15 Jun 2012 10:05:10 +0000</pubDate>
		<dc:creator>Moritz Post</dc:creator>
				<category><![CDATA[Planet Eclipse]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[Mockito]]></category>

		<guid isPermaLink="false">http://eclipsesource.com/blogs/?p=7770</guid>
		<description><![CDATA[It is not a secret that we are big fans of Mockito at EclipseSource. Our Java mocking framework of choice has helped us in many projects to stay on the test driven development path. Luckily we are also able to apply these same principles when developing Java code on Android. Although Mockito is great for <a href="http://eclipsesource.com/blogs/2012/06/15/serious-unit-testing-on-android/" style="text-decoration: none;">[...]</a>]]></description>
			<content:encoded><![CDATA[<p>It is <a href="http://eclipsesource.com/blogs/2011/09/19/effective-mockito-part-1/">not</a> <a href="http://eclipsesource.com/blogs/2011/09/29/effective-mockito-part-2/">a</a> <a href="http://eclipsesource.com/blogs/2011/10/13/effective-mockito-part-3/">secret </a>that we are <a href="http://eclipsesource.com/blogs/2011/10/17/effective-mockito-part-4/">big</a> <a href="http://eclipsesource.com/blogs/2011/11/16/effective-mockito-part-5/">fans</a> of <a href="http://code.google.com/p/mockito/">Mockito</a> at EclipseSource. Our Java mocking framework of choice has helped us in many projects to stay on the test driven development path. Luckily we are also able to apply these same principles when developing Java code on Android.</p>
<p>Although Mockito is great for mocking Java classes, it would sometimes be very cumbersome to mock entire parts of the Android UI framework. This is the place where we resort to another testing framework called <a href="http://pivotal.github.com/robolectric/">Robolectric</a>, which can be easily combined with Mockito to provide stub implementations of nearly all Android classes.</p>
<p><a href="http://eclipsesource.com/blogs/wp-content/uploads/2012/06/android-testing-love1.png"><img class="aligncenter size-full wp-image-7771" title="android-testing-love" src="http://eclipsesource.com/blogs/wp-content/uploads/2012/06/android-testing-love1.png" alt="android testing love1 Serious unit testing on Android" width="600" height="127" /></a></p>
<p>Robolectric provides concrete implementations for Android classes in the form of shadow objects. When running your test code you don&#8217;t execute the Android code but run against the shadow classes. Because you are executing regular Javacode, you don&#8217;t have to run the tests on an Android device but can execute the tests in a regular Java VM.</p>
<p>A Robolectric shadow class allows you to easily make assumptions about its current state because it can expose more of its internals than an Android class would. Here is a quick example to assert if an OnTouchListener has been attached to a View:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="java" style="font-family:monospace;">@Test
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> shouldHaveOnTouchListener<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #003399;">View</span> view <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">View</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> Activity<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  OnTouchListener listener <span style="color: #339933;">=</span> Mockito.<span style="color: #006633;">mock</span><span style="color: #009900;">&#40;</span>OnTouchListener.<span style="color: #000000; font-weight: bold;">class</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  view.<span style="color: #006633;">setOnTouchListener</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  ShadowView shadowView <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>ShadowView<span style="color: #009900;">&#41;</span>Robolectric.<span style="color: #006633;">shadowOf</span><span style="color: #009900;">&#40;</span>view<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  assertEquals<span style="color: #009900;">&#40;</span>listener, shadowView.<span style="color: #006633;">getOnTouchListener</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Don´t forget to put the @RunWith(RobolectricTestRunner.class) annotation in the test class. It is also worth noting that the new Activity() we are creating is, in fact, a ShadowActivity.</p>
<p>The assertion could not have been done without the ShadowView since Android does not have a getter for the OnTouchListener. Of course we could have mocked the View object with Mockito but that is not always possible, e.g. when the view has been inflated from a layout or has been created in some other place.</p>
<p>Sometimes even Robolectric falls short on the elements you can assert. In that case you can easily extend an existing shadow object to provide implementation details that suit your test case. Let&#8217;s say we want to assert that TextView.setIncludeFontPadding() has been called. Android does not provide a getter for that property and Robolectric does not implement the method so the call is simply swallowed. This is where we implement our own Shadow class:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="java" style="font-family:monospace;">@<span style="color: #000000; font-weight: bold;">Implements</span><span style="color: #009900;">&#40;</span>TextView.<span style="color: #000000; font-weight: bold;">class</span><span style="color: #009900;">&#41;</span>
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> CustomShadowTextView <span style="color: #000000; font-weight: bold;">extends</span> ShadowTextView <span style="color: #009900;">&#123;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">boolean</span> includepad <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">true</span><span style="color: #339933;">;</span>
&nbsp;
  @Implementation
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> setIncludeFontPadding<span style="color: #009900;">&#40;</span> <span style="color: #000066; font-weight: bold;">boolean</span> includepad <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;">includepad</span> <span style="color: #339933;">=</span> includepad<span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">boolean</span> getIncludeFontPadding<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">return</span> includepad<span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Once we have defined the shadow object we can use it in our test case. Whenever our code tries to instantiate a TextView it is now providing an implementation of CustomShadowTextView. The following snippet shows how to set our custom shadow view:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="java" style="font-family:monospace;">@Test
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> shouldIncludeFontPadding<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  Robolectric.<span style="color: #006633;">bindShadowClass</span><span style="color: #009900;">&#40;</span>CustomShadowTextView.<span style="color: #000000; font-weight: bold;">class</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  TextView view <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> TextView<span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> Activity<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  view.<span style="color: #006633;">setIncludeFontPadding</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>
&nbsp;
  CustomShadowTextView shadowView <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>CustomShadowTextView<span style="color: #009900;">&#41;</span>Robolectric.<span style="color: #006633;">shadowOf</span><span style="color: #009900;">&#40;</span>view<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  assertTrue<span style="color: #009900;">&#40;</span>shadowView.<span style="color: #006633;">getIncludeFontPadding</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>There are some shortcomings with the way Robolectric is able to reference Android resources. Although it is generally possible to find all kinds of images, Robolectric does have problems when referencing theme and style attributes. In that case we often resort to testing specific custom shadow objects that hardwire the desired behavior. In addition, some Android classes do not have a corresponding shadow class. A good example is the Typeface class. In that case you have to compile Robolectric manually and add a Robolectric.shadowOf(typeface) method.</p>
<p>In general we find the features provided by a combination of Mockito and Robolectric to be more than sufficient and whole-heartedly recommend the setup to anyone serious about unit testing. The speed at which you can write and execute tests is an important factor that will allow you to iterate on your test code quickly and in a meaningful way.</p>
<p><br/><div style="display: inline-block"><a href="https://twitter.com/intent/tweet?source=webclient&amp;text=Serious+unit+testing+on+Android&amp;via=eclipsesource&amp;url=http://eclipsesource.com/blogs/2012/06/15/serious-unit-testing-on-android/" target="_blank" title="Share on Twitter" style="margin-right: 5px;"><img title="Twitter" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/twitter.png" alt="Twitter"/></a><a href="https://plus.google.com/share?url=http://eclipsesource.com/blogs/2012/06/15/serious-unit-testing-on-android/" target="_blank" title="+1" style="margin-right: 5px;"><img title="Google+" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/google_plus.png" alt="Google+"/></a><a href="http://www.linkedin.com/cws/share?url=http://eclipsesource.com/blogs/2012/06/15/serious-unit-testing-on-android/" target="_blank" title="Share on LinkedIn" style="margin-right: 5px;"><img title="LinkedIn" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/linkedin.png" alt="LinkedIn"/></a><a href="https://www.facebook.com/sharer/sharer.php?u=http://eclipsesource.com/blogs/2012/06/15/serious-unit-testing-on-android/&amp;t=Serious+unit+testing+on+Android" target="_blank" title="Facebook" style="margin-right: 5px;"><img title="Facebook" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/facebook.png" alt="Facebook"/></a></div><br/>Comments are off for this post.. Tagged with <a href='http://eclipsesource.com/blogs/tag/android/' title='android Tag'>android</a>, <a href='http://eclipsesource.com/blogs/tag/mockito/' title='Mockito Tag'>Mockito</a>, <a href='http://eclipsesource.com/blogs/tag/android/' title='android Tag'>android</a>, <a href='http://eclipsesource.com/blogs/tag/mockito/' title='Mockito Tag'>Mockito</a></p>]]></content:encoded>
			<wfw:commentRss>http://eclipsesource.com/blogs/2012/06/15/serious-unit-testing-on-android/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RAP mobile 0.5.7 &#8211; New and Noteworthy</title>
		<link>http://eclipsesource.com/blogs/2012/05/02/rap-mobile-0-5-7-new-and-noteworthy/</link>
		<comments>http://eclipsesource.com/blogs/2012/05/02/rap-mobile-0-5-7-new-and-noteworthy/#comments</comments>
		<pubDate>Wed, 02 May 2012 16:03:12 +0000</pubDate>
		<dc:creator>Moritz Post</dc:creator>
				<category><![CDATA[EclipseSource News]]></category>
		<category><![CDATA[Planet Eclipse]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[canvas]]></category>
		<category><![CDATA[iOS]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[rap]]></category>
		<category><![CDATA[rap mobile]]></category>
		<category><![CDATA[Tabris]]></category>

		<guid isPermaLink="false">http://eclipsesource.com/blogs/?p=7581</guid>
		<description><![CDATA[Once again we are releasing a new version of RAP mobile. This latest release 0.5.7 brings with it a very cool new feature that we call the &#8220;Client Canvas&#8221;. This extension of the classic SWT Canvas allows you to draw freehand on your screen with your stylus or even your finger. Additional Features and API <a href="http://eclipsesource.com/blogs/2012/05/02/rap-mobile-0-5-7-new-and-noteworthy/" style="text-decoration: none;">[...]</a>]]></description>
			<content:encoded><![CDATA[<p>Once again we are releasing a new version of <a href="http://rapmobile.eclipsesource.com/">RAP mobile</a>. This latest release 0.5.7 brings with it a very cool new feature that we call the &#8220;Client Canvas&#8221;. This extension of the classic SWT Canvas allows you to draw freehand on your screen with your stylus or even your finger.</p>
<h2>Additional Features and API</h2>
<h3>Client Canvas</h3>
<p>The client canvas provides you with basic freehand drawing options, allowing you to sketch with your stylus or your finger.  Like a regular drawing program, you can choose your color, brush size and opacity. And, you can step through the history of your drawings to undo/redo certain steps. To implement this feature we built upon the SWT Canvas object that allows us to change the pen properties via the established Canvas API. To get started with drawing you&#8217;ll just need to instantiate the <code>com.eclipsesource.rap.mobile.widgets.ClientCanvas</code> instead of the regular SWT Canvas. To demonstrate the Client Canvas we have <a href="https://github.com/eclipsesource/rap-mobile-demos/blob/master/com.eclipsesource.rap.mobile.demos/src/com/eclipsesource/rap/mobile/demos/entrypoints/DrawDemo.java">created a sample</a> where you try out a little draw-by-numbers.</p>
<div align="center"><a href="http://eclipsesource.com/blogs/wp-content/uploads/2012/05/client-canvas.png"><img class="alignnone  wp-image-7583" title="client-canvas" src="http://eclipsesource.com/blogs/wp-content/uploads/2012/05/client-canvas.png" alt="client canvas RAP mobile 0.5.7   New and Noteworthy" width="277" height="173" /></a> <a href="http://eclipsesource.com/blogs/wp-content/uploads/2012/05/photo-1.png"><img class="alignnone  wp-image-7584" title="photo (1)" src="http://eclipsesource.com/blogs/wp-content/uploads/2012/05/photo-1.png" alt="photo 1 RAP mobile 0.5.7   New and Noteworthy" width="225" height="173" /></a></div>
<h2>Android</h2>
<h3>Browser</h3>
<p><a href="http://eclipsesource.com/blogs/wp-content/uploads/2012/05/browser-android.png"><img class="alignright  wp-image-7596" title="browser-android" src="http://eclipsesource.com/blogs/wp-content/uploads/2012/05/browser-android.png" alt="browser android RAP mobile 0.5.7   New and Noteworthy" width="229" height="133" /></a>The RAP mobile Android client is catching up with iOS on browser support. We now support the SWT Browser widget, allowing you to show full websites or custom HTML snippets inside your RAP mobile application. We also support the <code>Browser.evaluate()</code> and <code>Browser.execute()</code> methods to execute javascript in the browser on the Android device and to make it possible to send execution results back to server. The screenshot to the right shows examples that display a full website, an HTML snippet and the execution of a custom javascript function.</p>
<h3>Support for various SWT Shell style flags</h3>
<p>SWT offers many ways to customize the appearance of a shell via the style flags passed to the Shell constructor. These flags are also important to create SWT Dialogs. We now support the additional SWT shell styles TITLE, BORDER and *_MODAL. The following screenshots demonstrate the various style combinations.</p>
<div align="center"><a href="http://eclipsesource.com/blogs/wp-content/uploads/2012/05/dialogWithTitleAndIcon.png"><img class="alignnone  wp-image-7619" title="dialogWithTitleAndIcon" src="http://eclipsesource.com/blogs/wp-content/uploads/2012/05/dialogWithTitleAndIcon.png" alt="dialogWithTitleAndIcon RAP mobile 0.5.7   New and Noteworthy" width="112" height="106" /></a> <a href="http://eclipsesource.com/blogs/wp-content/uploads/2012/05/dialogWithTitle.png"><img class="alignnone  wp-image-7618" title="dialogWithTitle" src="http://eclipsesource.com/blogs/wp-content/uploads/2012/05/dialogWithTitle.png" alt="dialogWithTitle RAP mobile 0.5.7   New and Noteworthy" width="109" height="106" /></a> <a href="http://eclipsesource.com/blogs/wp-content/uploads/2012/05/dialogWithoutTitle.png"><img class="alignnone  wp-image-7617" title="dialogWithoutTitle" src="http://eclipsesource.com/blogs/wp-content/uploads/2012/05/dialogWithoutTitle.png" alt="dialogWithoutTitle RAP mobile 0.5.7   New and Noteworthy" width="162" height="106" /></a> <a href="http://eclipsesource.com/blogs/wp-content/uploads/2012/05/dialogDefault.png"><img class="alignnone  wp-image-7616" title="dialogDefault" src="http://eclipsesource.com/blogs/wp-content/uploads/2012/05/dialogDefault.png" alt="dialogDefault RAP mobile 0.5.7   New and Noteworthy" width="258" height="106" /></a></div>
<h3>Bugfixes</h3>
<p>We are constantly working towards a high level of stability and solid performance, and in this release, we squashed some bugs which deserve special mention:</p>
<ul>
<li>Fixed an issue where selecting elements inside a vertical ScrolledComposite was not possible</li>
<li>The GraphicalContext used android APIs not available on the supported basline version android 2.1 (API level 7).</li>
</ul>
<h2>iOS</h2>
<p>You&#8217;re probably already enjoying the browser support on our RAP mobile iOS client, and can now also take the Client Canvas for a test drive.  Two other things that you might notice in this release are a new UI hint to show how to enter the developer SystemMenu and improvements to modalShell rendering and animation.</p>
<p><br/><div style="display: inline-block"><a href="https://twitter.com/intent/tweet?source=webclient&amp;text=RAP+mobile+0.5.7+%26%238211%3B+New+and+Noteworthy&amp;via=eclipsesource&amp;url=http://eclipsesource.com/blogs/2012/05/02/rap-mobile-0-5-7-new-and-noteworthy/" target="_blank" title="Share on Twitter" style="margin-right: 5px;"><img title="Twitter" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/twitter.png" alt="Twitter"/></a><a href="https://plus.google.com/share?url=http://eclipsesource.com/blogs/2012/05/02/rap-mobile-0-5-7-new-and-noteworthy/" target="_blank" title="+1" style="margin-right: 5px;"><img title="Google+" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/google_plus.png" alt="Google+"/></a><a href="http://www.linkedin.com/cws/share?url=http://eclipsesource.com/blogs/2012/05/02/rap-mobile-0-5-7-new-and-noteworthy/" target="_blank" title="Share on LinkedIn" style="margin-right: 5px;"><img title="LinkedIn" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/linkedin.png" alt="LinkedIn"/></a><a href="https://www.facebook.com/sharer/sharer.php?u=http://eclipsesource.com/blogs/2012/05/02/rap-mobile-0-5-7-new-and-noteworthy/&amp;t=RAP+mobile+0.5.7+%26%238211%3B+New+and+Noteworthy" target="_blank" title="Facebook" style="margin-right: 5px;"><img title="Facebook" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/facebook.png" alt="Facebook"/></a></div><br/>Comments are off for this post.. Tagged with <a href='http://eclipsesource.com/blogs/tag/android/' title='android Tag'>android</a>, <a href='http://eclipsesource.com/blogs/tag/canvas/' title='canvas Tag'>canvas</a>, <a href='http://eclipsesource.com/blogs/tag/ios/' title='iOS Tag'>iOS</a>, <a href='http://eclipsesource.com/blogs/tag/mobile/' title='mobile Tag'>mobile</a>, <a href='http://eclipsesource.com/blogs/tag/rap/' title='rap Tag'>rap</a>, <a href='http://eclipsesource.com/blogs/tag/rap-mobile/' title='rap mobile Tag'>rap mobile</a>, <a href='http://eclipsesource.com/blogs/tag/tabris/' title='Tabris Tag'>Tabris</a>, <a href='http://eclipsesource.com/blogs/tag/android/' title='android Tag'>android</a>, <a href='http://eclipsesource.com/blogs/tag/canvas/' title='canvas Tag'>canvas</a>, <a href='http://eclipsesource.com/blogs/tag/ios/' title='iOS Tag'>iOS</a>, <a href='http://eclipsesource.com/blogs/tag/mobile/' title='mobile Tag'>mobile</a>, <a href='http://eclipsesource.com/blogs/tag/rap/' title='rap Tag'>rap</a>, <a href='http://eclipsesource.com/blogs/tag/rap-mobile/' title='rap mobile Tag'>rap mobile</a>, <a href='http://eclipsesource.com/blogs/tag/tabris/' title='Tabris Tag'>Tabris</a></p>]]></content:encoded>
			<wfw:commentRss>http://eclipsesource.com/blogs/2012/05/02/rap-mobile-0-5-7-new-and-noteworthy/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>RAP Mobile for Android 0.5.3 &#8211; New and Noteworthy</title>
		<link>http://eclipsesource.com/blogs/2012/02/27/rap-mobile-for-android-0-5-3-new-and-noteworthy/</link>
		<comments>http://eclipsesource.com/blogs/2012/02/27/rap-mobile-for-android-0-5-3-new-and-noteworthy/#comments</comments>
		<pubDate>Mon, 27 Feb 2012 16:16:33 +0000</pubDate>
		<dc:creator>Moritz Post</dc:creator>
				<category><![CDATA[EclipseSource News]]></category>
		<category><![CDATA[Planet Eclipse]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[new and noteworthy]]></category>
		<category><![CDATA[rap]]></category>
		<category><![CDATA[rap mobile]]></category>
		<category><![CDATA[Tabris]]></category>

		<guid isPermaLink="false">http://eclipsesource.com/blogs/?p=7086</guid>
		<description><![CDATA[The latest Android client for RAP mobile (v0.5.3) is now available. We are always looking for feedback so we urge you to take part in our developer preview program to experience the client firsthand. Besides the usual bugfixes, performance and stability improvements, the 0.5.3 release brings some often requested features to an Android handset near you. For <a href="http://eclipsesource.com/blogs/2012/02/27/rap-mobile-for-android-0-5-3-new-and-noteworthy/" style="text-decoration: none;">[...]</a>]]></description>
			<content:encoded><![CDATA[<p>The latest Android client for RAP mobile (v0.5.3) is now available. We are always looking for feedback so we urge you to <a href="http://rapmobile.eclipsesource.com/developers/">take part</a> in our developer preview program to experience the client firsthand.</p>
<p>Besides the usual bugfixes, performance and stability improvements, the 0.5.3 release brings some often requested features to an Android handset near you.</p>
<p>For more information visit: <a href="http://rapmobile.eclipsesource.com/">http://rapmobile.eclipsesource.com</a></p>
<p><a href="http://eclipsesource.com/blogs/wp-content/uploads/2012/02/virtual-tree.png"><img class="size-medium wp-image-7103 alignright" style="border-style: initial; border-color: initial;" title="Virtual Tree" src="http://eclipsesource.com/blogs/wp-content/uploads/2012/02/virtual-tree-202x300.png" alt="virtual tree 202x300 RAP Mobile for Android 0.5.3   New and Noteworthy" width="124" height="182" /></a></p>
<h3>The Tree widget supports the SWT.VIRTUAL style flag</h3>
<p>The support of the SWT.VIRTUAL style flag allows you to easily scroll through huge amounts of data. While you are scrolling through tree content, the data to be displayed is automatically loaded on demand in the background. Intelligent pre-caching makes it possible to have content visible even when scrolling very quickly. If the complete data cannot be delivered quickly enough, you are still able to scroll through the available content while the data is fetched in the background.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><img class="alignleft size-medium wp-image-7112" style="border-style: initial; border-color: initial;" title="buttons" src="http://eclipsesource.com/blogs/wp-content/uploads/2012/02/buttons-252x300.png" alt="buttons 252x300 RAP Mobile for Android 0.5.3   New and Noteworthy" width="153" height="182" /></p>
<h3>Buttons can be colorized programmatically</h3>
<p>We refined the support for background colors on buttons. You can now call <code>button.setBackground(redColor)</code> to change the background color of the button. The change in color applies not only to the default state but to all button states such as pressed, disabled, focused etc.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<h3>Opening and closing shells is animated</h3>
<p>In the Android client we map an SWT shell to behave similarly to an Android activity. Multiple activities can be stacked on top of each other and the user is able to switch between them with the back button on the device. The creation and destruction of an activity is animated according to the current device. We play these very same animations on shells when they are created or closed. On a Samsung Galaxy S2 (Android 2.3.x) a fly-in animation is performed whereas on a Samsung Galaxy Nexus (Android 4.0.x) a fade/scale animation is applied.</p>
<h3>Text widget tooltip is displayed in text field</h3>
<p><a href="http://eclipsesource.com/blogs/wp-content/uploads/2012/02/image03.png"><img class="alignright size-medium wp-image-7117" title="image03" src="http://eclipsesource.com/blogs/wp-content/uploads/2012/02/image03-300x101.png" alt="image03 300x101 RAP Mobile for Android 0.5.3   New and Noteworthy" width="182" height="62" /></a><br />
If a tooltip is set on a Text widget we now display the tip inside the Android EditText. You can use this to add hints for completing fields.</p>
<h3>Font probing on startup is implemented</h3>
<p>When starting a new RAP session we measure the probe strings sent from the server. These probe strings allow the server to categorize the clients according to their text sizes. The server can use cached string sizes so that it doesn’t have to request that the client re-measure strings cached in a previous session.</p>
<h3>UI updates are accumulated to execute in one operation</h3>
<p>When a server response triggers UI changes, we now gather all these changes and execute them altogether. Previously, we applied the UI changes on the fly which resulted in incremental changes to the UI. The new approach creates a more native-like experience as the UI changes state in one operation.</p>
<h3><a name="h.sqop3tz8ndf6"></a>Client sends a customized HTTP User-Agent string</h3>
<p>The RAP mobile Android client sends a customized User-Agent string. It contains the Android version, information about the device and the RAPmobile client version. Example: <code>Android/4.0.2,14 (samsung; Galaxy Nexus) RAPmobile/0.5.3</code></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><br/><div style="display: inline-block"><a href="https://twitter.com/intent/tweet?source=webclient&amp;text=RAP+Mobile+for+Android+0.5.3+%26%238211%3B+New+and+Noteworthy&amp;via=eclipsesource&amp;url=http://eclipsesource.com/blogs/2012/02/27/rap-mobile-for-android-0-5-3-new-and-noteworthy/" target="_blank" title="Share on Twitter" style="margin-right: 5px;"><img title="Twitter" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/twitter.png" alt="Twitter"/></a><a href="https://plus.google.com/share?url=http://eclipsesource.com/blogs/2012/02/27/rap-mobile-for-android-0-5-3-new-and-noteworthy/" target="_blank" title="+1" style="margin-right: 5px;"><img title="Google+" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/google_plus.png" alt="Google+"/></a><a href="http://www.linkedin.com/cws/share?url=http://eclipsesource.com/blogs/2012/02/27/rap-mobile-for-android-0-5-3-new-and-noteworthy/" target="_blank" title="Share on LinkedIn" style="margin-right: 5px;"><img title="LinkedIn" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/linkedin.png" alt="LinkedIn"/></a><a href="https://www.facebook.com/sharer/sharer.php?u=http://eclipsesource.com/blogs/2012/02/27/rap-mobile-for-android-0-5-3-new-and-noteworthy/&amp;t=RAP+Mobile+for+Android+0.5.3+%26%238211%3B+New+and+Noteworthy" target="_blank" title="Facebook" style="margin-right: 5px;"><img title="Facebook" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/facebook.png" alt="Facebook"/></a></div><br/>Comments are off for this post.. Tagged with <a href='http://eclipsesource.com/blogs/tag/android/' title='android Tag'>android</a>, <a href='http://eclipsesource.com/blogs/tag/mobile/' title='mobile Tag'>mobile</a>, <a href='http://eclipsesource.com/blogs/tag/new-and-noteworthy/' title='new and noteworthy Tag'>new and noteworthy</a>, <a href='http://eclipsesource.com/blogs/tag/rap/' title='rap Tag'>rap</a>, <a href='http://eclipsesource.com/blogs/tag/rap-mobile/' title='rap mobile Tag'>rap mobile</a>, <a href='http://eclipsesource.com/blogs/tag/tabris/' title='Tabris Tag'>Tabris</a>, <a href='http://eclipsesource.com/blogs/tag/android/' title='android Tag'>android</a>, <a href='http://eclipsesource.com/blogs/tag/mobile/' title='mobile Tag'>mobile</a>, <a href='http://eclipsesource.com/blogs/tag/new-and-noteworthy/' title='new and noteworthy Tag'>new and noteworthy</a>, <a href='http://eclipsesource.com/blogs/tag/rap/' title='rap Tag'>rap</a>, <a href='http://eclipsesource.com/blogs/tag/rap-mobile/' title='rap mobile Tag'>rap mobile</a>, <a href='http://eclipsesource.com/blogs/tag/tabris/' title='Tabris Tag'>Tabris</a></p>]]></content:encoded>
			<wfw:commentRss>http://eclipsesource.com/blogs/2012/02/27/rap-mobile-for-android-0-5-3-new-and-noteworthy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RAP mobile on Android: Themes and Skins</title>
		<link>http://eclipsesource.com/blogs/2012/02/16/rap-mobile-on-android-themes-and-skins/</link>
		<comments>http://eclipsesource.com/blogs/2012/02/16/rap-mobile-on-android-themes-and-skins/#comments</comments>
		<pubDate>Thu, 16 Feb 2012 10:54:59 +0000</pubDate>
		<dc:creator>Moritz Post</dc:creator>
				<category><![CDATA[Planet Eclipse]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[rap mobile]]></category>
		<category><![CDATA[Tabris]]></category>

		<guid isPermaLink="false">http://eclipsesource.com/blogs/?p=7040</guid>
		<description><![CDATA[This blog post marks the start of an ongoing series that will highlight some of the top features of RAP mobile from an Android developer’s perspective. To kick things off we’ll look at the most visible feature: the application&#8217;s UI. When dealing with Android development we are faced with an endless array of devices from <a href="http://eclipsesource.com/blogs/2012/02/16/rap-mobile-on-android-themes-and-skins/" style="text-decoration: none;">[...]</a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://rapmobile.eclipsesource.com/"><img class="alignleft size-full wp-image-7047" style="margin: 12px;" title="RAP mobile" src="http://eclipsesource.com/blogs/wp-content/uploads/2012/02/rap-mobile-one-col.png" alt="rap mobile one col RAP mobile on Android: Themes and Skins" width="158" height="76" /></a>This blog post marks the start of an ongoing series that will highlight some of the top features of <a href="http://rapmobile.eclipsesource.com/">RAP mobile</a> from an Android developer’s perspective. To kick things off we’ll look at the most visible feature: the application&#8217;s UI.</p>
<p>When dealing with Android development we are faced with an endless<a href="http://www.androidphonesarena.com/2011-android-phones.php"> array of devices</a> from many different manufacturers. Inherently that is a good thing as there is most likely a device tailored for everyone’s needs. From a developer’s point of view this diversity in devices can be challenging.</p>
<p>In order to differentiate a device from the competition, manufacturers create custom UI modifications in the form of skins. Although these skins can, in fact, enhance the user experience, it means they can also come with a different UI look and feel on every device. The same application can look vastly different on a device from manufacturer A or B. The developer has to go to some lengths to ensure that his intended UI looks the same across all devices.</p>
<p>When developing an application with the <a href="http://rapmobile.eclipsesource.com/">RAP mobile</a> framework, we have already done the hard work for you and provide a consistent look and feel across all Android devices. There is no need to implement custom theming if you don’t need it. Your application will look the same on every device. Of course, you can also tailor the look specifically to your application.</p>
<p style="text-align: center;"><a href="http://eclipsesource.com/blogs/wp-content/uploads/2012/02/rap-mobile-various-devices.jpg"><img class="aligncenter size-large wp-image-7041" title="rap-mobile-various-devices" src="http://eclipsesource.com/blogs/wp-content/uploads/2012/02/rap-mobile-various-devices-1024x629.jpg" alt="rap mobile various devices 1024x629 RAP mobile on Android: Themes and Skins" width="573" height="352" /></a></p>
<p>An application developed with RAP mobile is based on a port of the new <a href="https://www.google.com/search?q=android+holo+theme&amp;hl=en&amp;prmd=imvnsa&amp;source=lnms&amp;tbm=isch&amp;ei=L_w8T_GeMsXBtAbGyOzuBA&amp;sa=X&amp;oi=mode_link&amp;ct=mode&amp;cd=2&amp;sqi=2&amp;ved=0CBYQ_AUoAQ&amp;biw=1333&amp;bih=753">Android 4.0 Holo</a> theme. Your application will already look like the latest Android version even when running on older devices without Android 4.0. We support every machine that runs Android 2.1 or higher.</p>
<p>In the screenshot above you see an HTC Magic (Android 2.2.1), HTC Desire (2.2), Samsung Galaxy S2 (Android 2.3.6) and Galaxy Nexus (Android 4.0.2) &#8211; many different forms and sizes with one consistent look.</p>
<p>Not only do you get a modern look for all your applications, you also get a couple of benefits on the application developer side.</p>
<ul>
<li>For starters you can choose to base your application on a dark or light Holo theme. This means that you don’t have to customize everything when opting for a darker look.</li>
<li>Android provides four different “buckets” of screen density. Every graphical element in the default Holo theme is already available in these target densities. When providing application-specific graphics we automatically scale them for you based on the target density.</li>
<li>Because the application runs server side and we do have knowledge about the theme the client uses, we can easily make assumptions about the size of a widget without actually measuring anything on the client.</li>
</ul>
<p>In the future we will create more documentation and blog posts with sample code that will show you how you can leverage these features in your projects.</p>
<p>With Android 4.0, Google is forcing manufacturers to <a href="http://android-developers.blogspot.com/2012/01/holo-everywhere.html">bundle the new Holo theme</a> on their devices. This is an excellent step towards having a common base UI but currently things are still troublesome as we are dealing with older devices that make up 98% of the market. <a href="http://rapmobile.eclipsesource.com/">RAP mobile</a> allows you to have a good looking base theme today, without having to wait for the industry to move to Android 4.0.</p>
<p><br/><div style="display: inline-block"><a href="https://twitter.com/intent/tweet?source=webclient&amp;text=RAP+mobile+on+Android%3A+Themes+and+Skins&amp;via=eclipsesource&amp;url=http://eclipsesource.com/blogs/2012/02/16/rap-mobile-on-android-themes-and-skins/" target="_blank" title="Share on Twitter" style="margin-right: 5px;"><img title="Twitter" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/twitter.png" alt="Twitter"/></a><a href="https://plus.google.com/share?url=http://eclipsesource.com/blogs/2012/02/16/rap-mobile-on-android-themes-and-skins/" target="_blank" title="+1" style="margin-right: 5px;"><img title="Google+" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/google_plus.png" alt="Google+"/></a><a href="http://www.linkedin.com/cws/share?url=http://eclipsesource.com/blogs/2012/02/16/rap-mobile-on-android-themes-and-skins/" target="_blank" title="Share on LinkedIn" style="margin-right: 5px;"><img title="LinkedIn" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/linkedin.png" alt="LinkedIn"/></a><a href="https://www.facebook.com/sharer/sharer.php?u=http://eclipsesource.com/blogs/2012/02/16/rap-mobile-on-android-themes-and-skins/&amp;t=RAP+mobile+on+Android%3A+Themes+and+Skins" target="_blank" title="Facebook" style="margin-right: 5px;"><img title="Facebook" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/facebook.png" alt="Facebook"/></a></div><br/>Comments are off for this post.. Tagged with <a href='http://eclipsesource.com/blogs/tag/android/' title='android Tag'>android</a>, <a href='http://eclipsesource.com/blogs/tag/mobile/' title='mobile Tag'>mobile</a>, <a href='http://eclipsesource.com/blogs/tag/rap-mobile/' title='rap mobile Tag'>rap mobile</a>, <a href='http://eclipsesource.com/blogs/tag/tabris/' title='Tabris Tag'>Tabris</a>, <a href='http://eclipsesource.com/blogs/tag/android/' title='android Tag'>android</a>, <a href='http://eclipsesource.com/blogs/tag/mobile/' title='mobile Tag'>mobile</a>, <a href='http://eclipsesource.com/blogs/tag/rap-mobile/' title='rap mobile Tag'>rap mobile</a>, <a href='http://eclipsesource.com/blogs/tag/tabris/' title='Tabris Tag'>Tabris</a></p>]]></content:encoded>
			<wfw:commentRss>http://eclipsesource.com/blogs/2012/02/16/rap-mobile-on-android-themes-and-skins/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Agile Thoughts (Part I)</title>
		<link>http://eclipsesource.com/blogs/2010/02/12/agile-thoughts-part-i/</link>
		<comments>http://eclipsesource.com/blogs/2010/02/12/agile-thoughts-part-i/#comments</comments>
		<pubDate>Fri, 12 Feb 2010 16:39:44 +0000</pubDate>
		<dc:creator>Moritz Post</dc:creator>
				<category><![CDATA[Planet Eclipse]]></category>
		<category><![CDATA[Agile]]></category>

		<guid isPermaLink="false">http://eclipsesource.com/blogs/?p=3790</guid>
		<description><![CDATA[In the last few weeks i was confronted with several projects and developers, who were trying to incorporate the scrum process into their project environment. The following remarks will pinpoint some of the problems and challenges several of the projects had and what a possible solution might look like (your mileage may vary). Upfront i <a href="http://eclipsesource.com/blogs/2010/02/12/agile-thoughts-part-i/" style="text-decoration: none;">[...]</a>]]></description>
			<content:encoded><![CDATA[<p>In the last few weeks i was confronted with several projects and  developers, who were trying to incorporate the scrum process into their  project environment. The following remarks will pinpoint some of the  problems and challenges several of the projects had and what a possible solution might look like (your mileage may vary).</p>
<p>Upfront i  have to say, that i am a strong believer in scrum and its gains. This  opinion originates from the fact, that i have worked in scrum projects  which turned out very well. Why did they work well? Because they applied  scrum! <img src='http://eclipsesource.com/blogs/wp-includes/images/smilies/icon_wink.gif' alt="icon wink Agile Thoughts (Part I)" class='wp-smiley' title="Agile Thoughts (Part I)" /> </p>
<h2>The Fundamentals</h2>
<p>We all know the sentence &#8220;yeah, we are an agile  team&#8221;. And next they present you their fixed road map with milestones  etc. The opposite is the &#8220;no planning agility&#8221;. We just fiddle along on a  daily basis. That is not agile either.</p>
<p>I think the sweetspot is  where scrum enters the stage. The product backlog dictates your workload and the  sprint backlog defines your daily work. What&#8217;s the gain? Transparency  and flexibility. The two virtuoso every one wants, most people claim and  the fewest projects actually have. Lets see what these two words  actually mean.</p>
<p><strong>Transparency </strong>- Like a glass window transparency  has two sides. When looking at the team we want to know what the team is  actually working on and what their progress state is. The scrum wall  with its small tasks and the sprint burndown is the place to find these  information. When looking at the product owner, it is his job to provide  a well formed backlog. Well formed means stories with clear scope and manageable volume. From both perspectives you have the ability to  intervene when necessary.</p>
<p><strong>Flexibility </strong>- Flexibility allows to  refocus the course of the development efforts while being way under way.  Only after you have finished the current sprint you plan the next one  with the stories you need the most. After your project time  has elapsed you can be certain that everything that is in your project  right now is what you really need. No extras. Just the right features.  Admittedly we could miss a few features but that would simply require  more man power or more time. Most importantly: the scope is spot on  because of constant corrections of the project plan.</p>
<p>So that is  great theory. Now on to the problems&#8230;</p>
<p>Oh wait. This blog post is getting to long and i have to many points on my list. So lets take a break here and discuss the above until part II is ready.</p>
<p>Are you applying scrum? What are the biggest gains for you?</p>
<p><br/><div style="display: inline-block"><a href="https://twitter.com/intent/tweet?source=webclient&amp;text=Agile+Thoughts+%28Part+I%29&amp;via=eclipsesource&amp;url=http://eclipsesource.com/blogs/2010/02/12/agile-thoughts-part-i/" target="_blank" title="Share on Twitter" style="margin-right: 5px;"><img title="Twitter" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/twitter.png" alt="Twitter"/></a><a href="https://plus.google.com/share?url=http://eclipsesource.com/blogs/2010/02/12/agile-thoughts-part-i/" target="_blank" title="+1" style="margin-right: 5px;"><img title="Google+" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/google_plus.png" alt="Google+"/></a><a href="http://www.linkedin.com/cws/share?url=http://eclipsesource.com/blogs/2010/02/12/agile-thoughts-part-i/" target="_blank" title="Share on LinkedIn" style="margin-right: 5px;"><img title="LinkedIn" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/linkedin.png" alt="LinkedIn"/></a><a href="https://www.facebook.com/sharer/sharer.php?u=http://eclipsesource.com/blogs/2010/02/12/agile-thoughts-part-i/&amp;t=Agile+Thoughts+%28Part+I%29" target="_blank" title="Facebook" style="margin-right: 5px;"><img title="Facebook" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/facebook.png" alt="Facebook"/></a></div><br/>Comments are off for this post.. Tagged with <a href='http://eclipsesource.com/blogs/tag/agile/' title='Agile Tag'>Agile</a>, <a href='http://eclipsesource.com/blogs/tag/agile/' title='Agile Tag'>Agile</a></p>]]></content:encoded>
			<wfw:commentRss>http://eclipsesource.com/blogs/2010/02/12/agile-thoughts-part-i/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Extending Google Wave</title>
		<link>http://eclipsesource.com/blogs/2009/11/02/extending-google-wave/</link>
		<comments>http://eclipsesource.com/blogs/2009/11/02/extending-google-wave/#comments</comments>
		<pubDate>Mon, 02 Nov 2009 14:22:27 +0000</pubDate>
		<dc:creator>Moritz Post</dc:creator>
				<category><![CDATA[Planet Eclipse]]></category>
		<category><![CDATA[wave]]></category>

		<guid isPermaLink="false">http://eclipsesource.com/blogs/?p=3315</guid>
		<description><![CDATA[A few days ago i gave Google Wave a spin. I was already quite familiar with the conversation features and thought it was time to extend the wave by some custom functionality. I therefore created a robot extension to enrich a wave conversation with some additional functionality. The idea was to fetch details about an <a href="http://eclipsesource.com/blogs/2009/11/02/extending-google-wave/" style="text-decoration: none;">[...]</a>]]></description>
			<content:encoded><![CDATA[<p>A few days ago i gave Google <a href="http://wave.google.com/">Wave</a> a spin. I was already quite familiar with the conversation features and thought it was time to extend the wave by some custom functionality. I therefore created a robot extension to enrich a wave conversation with some additional functionality. The idea was to fetch details about an eclipse bugzilla bug when a bug is referenced in a wave conversation. To see how that works check out the <a href="http://download.eclipsesource.com/~mpost/wave/buggy.htm">screencast</a> below (click the image).</p>
<p style="text-align: center;"><a href="http://download.eclipsesource.com/~mpost/wave/buggy.htm"><img class="aligncenter size-full wp-image-3316" title="buggy" src="http://eclipsesource.com/blogs/wp-content/uploads/2009/11/buggy.jpg" alt="buggy Extending Google Wave" width="589" height="459" /></a></p>
<p>The development of the robot was rather straight forward. The robot itself is deployed on the google <a href="http://appengine.google.com/">appengine</a> and communicates with the wave via HTTP REST calls and uses JSON as its language dialect. The communication was encapsulated in a <a href="http://code.google.com/p/wave-robot-java-client/">client library</a> which did have some bugs though. Working with the app engine was a joy i must add. Deployment and management of the application was quite cool. Fetching the bugzilla data was also easy as it is able to spill out bug details in <a href="https://bugs.eclipse.org/bugs/?id=30&amp;ctype=xml">XML format</a>.</p>
<p>All in all i am very excited to see how easy it is to provide additional wave capabilities and am hopping that the wave will make its way into every days life. Also the appengine gets a thumbs up from me (at least for such simple tasks as this wave robot). You can fetch the source of the robot project <a href="http://eclipsesource.com/mpost/buggy/buggy-0.0.1.zip">here</a>.</p>
<p><br/><div style="display: inline-block"><a href="https://twitter.com/intent/tweet?source=webclient&amp;text=Extending+Google+Wave&amp;via=eclipsesource&amp;url=http://eclipsesource.com/blogs/2009/11/02/extending-google-wave/" target="_blank" title="Share on Twitter" style="margin-right: 5px;"><img title="Twitter" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/twitter.png" alt="Twitter"/></a><a href="https://plus.google.com/share?url=http://eclipsesource.com/blogs/2009/11/02/extending-google-wave/" target="_blank" title="+1" style="margin-right: 5px;"><img title="Google+" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/google_plus.png" alt="Google+"/></a><a href="http://www.linkedin.com/cws/share?url=http://eclipsesource.com/blogs/2009/11/02/extending-google-wave/" target="_blank" title="Share on LinkedIn" style="margin-right: 5px;"><img title="LinkedIn" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/linkedin.png" alt="LinkedIn"/></a><a href="https://www.facebook.com/sharer/sharer.php?u=http://eclipsesource.com/blogs/2009/11/02/extending-google-wave/&amp;t=Extending+Google+Wave" target="_blank" title="Facebook" style="margin-right: 5px;"><img title="Facebook" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/facebook.png" alt="Facebook"/></a></div><br/>Comments are off for this post.. Tagged with <a href='http://eclipsesource.com/blogs/tag/wave/' title='wave Tag'>wave</a>, <a href='http://eclipsesource.com/blogs/tag/wave/' title='wave Tag'>wave</a></p>]]></content:encoded>
			<wfw:commentRss>http://eclipsesource.com/blogs/2009/11/02/extending-google-wave/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Tip: Validation with a MultiValidator</title>
		<link>http://eclipsesource.com/blogs/2009/02/27/databinding-crossvalidation-with-a-multivalidator/</link>
		<comments>http://eclipsesource.com/blogs/2009/02/27/databinding-crossvalidation-with-a-multivalidator/#comments</comments>
		<pubDate>Fri, 27 Feb 2009 12:40:27 +0000</pubDate>
		<dc:creator>Moritz Post</dc:creator>
				<category><![CDATA[Planet Eclipse]]></category>
		<category><![CDATA[databinding]]></category>
		<category><![CDATA[jface]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://eclipsesource.com/blogs/?p=321</guid>
		<description><![CDATA[In the last blog entry regarding databinding, we learned how to create a custom observable for a DateTime widget. Starting with Eclipse 3.5 there is a new approach to creating custom observables as described by Matthew Hall in the comments to that post. Which ever way you choose, we will now use the observable to <a href="http://eclipsesource.com/blogs/2009/02/27/databinding-crossvalidation-with-a-multivalidator/" style="text-decoration: none;">[...]</a>]]></description>
			<content:encoded><![CDATA[<p>In the <a title="EclipseSource Blog: A Custom Observable for a Widget" href="http://eclipsesource.com/blogs/2009/02/03/databinding-a-custom-observable-for-your-widget/">last blog entry regarding databinding</a>, we learned how to create a custom observable for a <em>DateTime</em> widget. Starting with Eclipse 3.5 there is a new approach to creating custom observables as described by Matthew Hall in the comments to that post. Which ever way you choose, we will now use the observable to showcase another cool databinding feature: Crossvalidation. Crossvalidation was introduced with Eclipse 3.4 and describes the process of validating one <em>IObservable</em> based on the value or state of another <em>IObservable</em>. A classic example is the input  of a date ranges where the start of the period can not be after the end of the period.</p>
<p><a href="http://eclipsesource.com/blogs/wp-content/uploads/2009/02/databinding-cross-validation.png"><img src="http://eclipsesource.com/blogs/wp-content/uploads/2009/02/databinding-cross-validation-300x91.png" alt="databinding cross validation 300x91 Tip: Validation with a MultiValidator" title="Databinding Cross Validation" width="300" height="91" class="alignnone size-medium wp-image-324" /></a></p>
<p>As we can see on the screenshot above, the status message informs us of a violated validation constrain. So, how is such  kind of crosscutting validation achieved? First of we need some kind of model, to hold the start and end value. Next we need the two DateTime widgets and the corresponding <em>DateTimeObservableValue</em>. The observables can than be tied to the bean model, holding the start and end values. In order to create a crosscutting validation for the dates, we introduce a custom <em>PeriodValidator</em> extending a <em>MultiValidator</em>, which is in fact an implementation of a <em>ValidationStatusProvider</em>.The <em>MultiValidator</em> lets us implement a <em>validate()</em> method, returning an <em>IStatus</em> corresponding to our validation results. Since we are implicitly implementing a <em>ValidationStatusProvider</em>, the state of our validation can be bound to any party interested in the validation result. Here is the implementation of the <em>PeriodValidator</em>, comparing the start and end date (ignore the shortcomings of the <em>Date</em> class):</p>
<pre class="brush: java">
public class PeriodValidator extends MultiValidator {

private final IObservableValue start;
private final IObservableValue end;

public PeriodValidator(final IObservableValue start, final IObservableValue end) {
this.start = start;
this.end = end;
}

@Override
protected IStatus validate() {
Date startDate = (Date) this.start.getValue();
Date endDate = (Date) this.end.getValue();
IStatus status = ValidationStatus.ok();

if ((this.start != null) &amp;&amp; (this.end != null)) {
     if (startDate.after(endDate)) {
          status = ValidationStatus.error(”The start date has to be before the end date.”);
     }
}
return status;
}
}
</pre>
<p>As we can see, there is not much magic going on in the <em>PeriodValidator</em>. Lets have a look at the broader context, in which this <em>MultiValidator</em> is applied. The following code demonstrates the overall setup of the databinding. Note how the validation status (wrapped in an <em>IObservableValue</em>) is obtained from the <em>PeriodValidator</em> and bound to the status <em>Text</em> widget.</p>
<pre class="brush: java">
private void createDatabinding() {

DateTimeObservableValue startObservable = new DateTimeObservableValue(this.dateTimeStart);
DateTimeObservableValue endObservable = new DateTimeObservableValue(this.dateTimeEnd);
DataBindingContext context = new DataBindingContext();

// bind start and end
UpdateValueStrategy modelToTarget = new UpdateValueStrategy(
UpdateValueStrategy.POLICY_UPDATE);
UpdateValueStrategy targetToModel = new UpdateValueStrategy(
UpdateValueStrategy.POLICY_UPDATE);
context.bindValue(
     startObservable, 
     BeansObservables.observeValue(this.period,Period.PROP_START), targetToModel, modelToTarget);

context.bindValue(endObservable, 
     BeansObservables.observeValue(this.period, Period.PROP_END), targetToModel, modelToTarget);

// bind status
PeriodValidator periodValidator = new PeriodValidator(startObservable, endObservable);
modelToTarget = new UpdateValueStrategy(UpdateValueStrategy.POLICY_UPDATE);
modelToTarget.setConverter(new Converter(IStatus.class, String.class) {

public Object convert(final Object arg) {

if (arg instanceof IStatus) {
     IStatus status = (IStatus) arg;
     return status.getMessage();
}

return null;
}
});

targetToModel = new UpdateValueStrategy(UpdateValueStrategy.POLICY_UPDATE);
context.bindValue(
     SWTObservables.observeText(this.status), 
     periodValidator.getValidationStatus(), targetToModel, modelToTarget);
}

</pre>
<p>The validation status of the period validator is updated everytime any of the DateTime widgets is changed. In turn the validation message is updated to reflect the validation state.</p>
<p>You can download the the entire project containing the sample snippets <a href="http://eclipsesource.com/blogs/wp-content/uploads/2009/02/orgeclipsesourcedatabindingmultivalidation.zip">here</a>.</p>
<p>Also note that you will need to adjust the elements on the classpath. See the .project file for the required libs.</p>
<p>I hope you found these hints valuable and am looking forward to your comments and suggestions.</p>
<p><br/><div style="display: inline-block"><a href="https://twitter.com/intent/tweet?source=webclient&amp;text=Tip%3A+Validation+with+a+MultiValidator&amp;via=eclipsesource&amp;url=http://eclipsesource.com/blogs/2009/02/27/databinding-crossvalidation-with-a-multivalidator/" target="_blank" title="Share on Twitter" style="margin-right: 5px;"><img title="Twitter" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/twitter.png" alt="Twitter"/></a><a href="https://plus.google.com/share?url=http://eclipsesource.com/blogs/2009/02/27/databinding-crossvalidation-with-a-multivalidator/" target="_blank" title="+1" style="margin-right: 5px;"><img title="Google+" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/google_plus.png" alt="Google+"/></a><a href="http://www.linkedin.com/cws/share?url=http://eclipsesource.com/blogs/2009/02/27/databinding-crossvalidation-with-a-multivalidator/" target="_blank" title="Share on LinkedIn" style="margin-right: 5px;"><img title="LinkedIn" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/linkedin.png" alt="LinkedIn"/></a><a href="https://www.facebook.com/sharer/sharer.php?u=http://eclipsesource.com/blogs/2009/02/27/databinding-crossvalidation-with-a-multivalidator/&amp;t=Tip%3A+Validation+with+a+MultiValidator" target="_blank" title="Facebook" style="margin-right: 5px;"><img title="Facebook" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/facebook.png" alt="Facebook"/></a></div><br/>Comments are off for this post.. Tagged with <a href='http://eclipsesource.com/blogs/tag/databinding/' title='databinding Tag'>databinding</a>, <a href='http://eclipsesource.com/blogs/tag/jface/' title='jface Tag'>jface</a>, <a href='http://eclipsesource.com/blogs/tag/tips/' title='tips Tag'>tips</a>, <a href='http://eclipsesource.com/blogs/tag/databinding/' title='databinding Tag'>databinding</a>, <a href='http://eclipsesource.com/blogs/tag/jface/' title='jface Tag'>jface</a>, <a href='http://eclipsesource.com/blogs/tag/tips/' title='tips Tag'>tips</a></p>]]></content:encoded>
			<wfw:commentRss>http://eclipsesource.com/blogs/2009/02/27/databinding-crossvalidation-with-a-multivalidator/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Databinding: A Custom Observable for a Widget</title>
		<link>http://eclipsesource.com/blogs/2009/02/03/databinding-a-custom-observable-for-your-widget/</link>
		<comments>http://eclipsesource.com/blogs/2009/02/03/databinding-a-custom-observable-for-your-widget/#comments</comments>
		<pubDate>Tue, 03 Feb 2009 15:41:20 +0000</pubDate>
		<dc:creator>Moritz Post</dc:creator>
				<category><![CDATA[Planet Eclipse]]></category>
		<category><![CDATA[databinding]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[jface]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://eclipsesource.com/blogs/?p=289</guid>
		<description><![CDATA[The introduction of the databinding framework in Eclipse 3.3 is with no doubt one of the most useful tools in the hands of the form developer. The ability to transform and validate user input in such a flexible and reusable way is a great enhancement. But where there is light, there is shadow. Sometimes there <a href="http://eclipsesource.com/blogs/2009/02/03/databinding-a-custom-observable-for-your-widget/" style="text-decoration: none;">[...]</a>]]></description>
			<content:encoded><![CDATA[<p>The introduction of the <a href="http://wiki.eclipse.org/index.php/JFace_Data_Binding">databinding framework</a> in Eclipse 3.3 is with no doubt one of the most useful tools in the hands of the form developer. The ability to transform and validate user input in such a flexible and reusable way is a great enhancement. But where there is light, there is shadow. Sometimes there is just no <em>IObservable </em>available for your target or model object. This blog entry will demonstrate how easy it can be to create a custom <em>IObservable </em>for a DateTime widget.</p>
<p>The <em>DateTime </em>widget represents one value: a <em>java.util.Date</em>. This <em>Date </em>object is the one we want to get and set on the target (target being the UI widget). Therefore we wrap the <em>DateTime </em>in an <em>IObservableValue </em>by extending the <em>AbstractObservableValue</em> class. Essentially an <em>IObservable*</em> offers methods to get and set data, to determine the type of data and to register listeners to be notified of changes. The following code demonstrates a skeleton implementation of an <em>IObservableValue</em>.</p>
<pre class="brush: java">
public class DateTimeObservableValue extends AbstractObservableValue {

  private final DateTime dateTime;
  Listener listener = new Listener() { ... };

  public DateTimeObservableValue(final DateTime dateTime) {
    this.dateTime = dateTime;
    this.dateTime.addSelectionListener(this.listener);
  }

  @Override
  protected Object doGetValue() {
    // the utility method creates a Date from the DateTime
    return dateTimeToDate();
  }

  @Override
    protected void doSetValue(final Object value) {
      if (value instanceof Date) {
        // the utility method sets the date on the DateTime
        dateToDateTime((Date) value);
      }
  }

  @Override
    public Object getValueType() {
    return Date.class;
  }

  @Override
    public synchronized void dispose() {
    this.dateTime.removeSelectionListener(this.listener);
    super.dispose();
  }
}
</pre>
<p>The implementation details are not very special. The <em>getValueType() </em>method has to return the type represented by this <em>IObservableValue</em> (which is the type <em>Date</em>). The do methods set and get the <em>Date </em>value. Since the observable has to propagate changes in the <em>DateTime</em> widget as soon as they ocurre, we attach a listener on the <em>DateTime </em>widget to inform any registered <em>IValueChangeListener </em>of the event. The listener implementation looks like the following:</p>
<pre class="brush: java">
Listener listener = new Listener() {

  @Override
  public void handleEvent(final Event event) {
    Date newValue = dateTimeToDate();

    if (!newValue.equals(DateTimeObservableValue.this.oldValue)) {
      fireValueChange(Diffs.createValueDiff(DateTimeObservableValue.this.oldValue, newValue));
      DateTimeObservableValue.this.oldValue = newValue;
    }
  }
};
</pre>
<p>In the <em>DateTime</em> listener we inform any interested <em>IValueChangeListener</em> of our <em>DateTimeObservableValue</em>. In order to avoid unnecessary propagation of update events in the databinding context, we compare the last set <em>Date</em> in the <em>IObservableValue</em> with the new value. Next we create a <em>ValueDiff</em> from our new date value and fire the the value change event. The advantage of listening to the changes in the DateTime widget, is that we are able to fire events which are either invoked by the user changing the DateTime widget or by programmatic changes of the <em>IObservableValue</em>s wrapped <em>Date</em>.</p>
<p>You can download the full listing of the observable class here: <a href='http://eclipsesource.com/blogs/2009/02/03/databinding-a-custom-observable-for-your-widget/datetimeobservablevalue/' rel='attachment wp-att-332'>DateTimeObservableValue.zip</a></p>
<p>As we can see, it is quite easy to write a custom observable for any kind of widget or datastructure, represented by a single value&#8230;  So, how do you embed your data in custom observables? Any obstacles you had to overcome? Problems you faced? Share them with us. <img src='http://eclipsesource.com/blogs/wp-includes/images/smilies/icon_smile.gif' alt="icon smile Databinding: A Custom Observable for a Widget" class='wp-smiley' title="Databinding: A Custom Observable for a Widget" /> </p>
<p><br/><div style="display: inline-block"><a href="https://twitter.com/intent/tweet?source=webclient&amp;text=Databinding%3A+A+Custom+Observable+for+a+Widget&amp;via=eclipsesource&amp;url=http://eclipsesource.com/blogs/2009/02/03/databinding-a-custom-observable-for-your-widget/" target="_blank" title="Share on Twitter" style="margin-right: 5px;"><img title="Twitter" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/twitter.png" alt="Twitter"/></a><a href="https://plus.google.com/share?url=http://eclipsesource.com/blogs/2009/02/03/databinding-a-custom-observable-for-your-widget/" target="_blank" title="+1" style="margin-right: 5px;"><img title="Google+" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/google_plus.png" alt="Google+"/></a><a href="http://www.linkedin.com/cws/share?url=http://eclipsesource.com/blogs/2009/02/03/databinding-a-custom-observable-for-your-widget/" target="_blank" title="Share on LinkedIn" style="margin-right: 5px;"><img title="LinkedIn" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/linkedin.png" alt="LinkedIn"/></a><a href="https://www.facebook.com/sharer/sharer.php?u=http://eclipsesource.com/blogs/2009/02/03/databinding-a-custom-observable-for-your-widget/&amp;t=Databinding%3A+A+Custom+Observable+for+a+Widget" target="_blank" title="Facebook" style="margin-right: 5px;"><img title="Facebook" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/facebook.png" alt="Facebook"/></a></div><br/>Comments are off for this post.. Tagged with <a href='http://eclipsesource.com/blogs/tag/databinding/' title='databinding Tag'>databinding</a>, <a href='http://eclipsesource.com/blogs/tag/eclipse/' title='eclipse Tag'>eclipse</a>, <a href='http://eclipsesource.com/blogs/tag/jface/' title='jface Tag'>jface</a>, <a href='http://eclipsesource.com/blogs/tag/tips/' title='tips Tag'>tips</a>, <a href='http://eclipsesource.com/blogs/tag/databinding/' title='databinding Tag'>databinding</a>, <a href='http://eclipsesource.com/blogs/tag/eclipse/' title='eclipse Tag'>eclipse</a>, <a href='http://eclipsesource.com/blogs/tag/jface/' title='jface Tag'>jface</a>, <a href='http://eclipsesource.com/blogs/tag/tips/' title='tips Tag'>tips</a></p>]]></content:encoded>
			<wfw:commentRss>http://eclipsesource.com/blogs/2009/02/03/databinding-a-custom-observable-for-your-widget/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Toggling a Command contribution</title>
		<link>http://eclipsesource.com/blogs/2009/01/15/toggling-a-command-contribution/</link>
		<comments>http://eclipsesource.com/blogs/2009/01/15/toggling-a-command-contribution/#comments</comments>
		<pubDate>Thu, 15 Jan 2009 09:40:16 +0000</pubDate>
		<dc:creator>Moritz Post</dc:creator>
				<category><![CDATA[Planet Eclipse]]></category>
		<category><![CDATA[commands]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://eclipsesource.com/blogs/?p=212</guid>
		<description><![CDATA[Every once in a while something just doesn&#8217;t happen to be as intiutive as you would have liked it to be. Lately I was trying to contribute a simple command based toggle button to the workbench. Although it is simple to actually provide the menu contribution and to put the button in visual &#8220;toggle&#8221; mode, <a href="http://eclipsesource.com/blogs/2009/01/15/toggling-a-command-contribution/" style="text-decoration: none;">[...]</a>]]></description>
			<content:encoded><![CDATA[<p>Every once in a while something just doesn&#8217;t happen to be as intiutive as you would have liked it to be. Lately I was trying to contribute a simple command based toggle button to the workbench. Although it is simple to actually provide the menu contribution and to put the button in visual &#8220;toggle&#8221; mode, it was so straight forward to actually obtain the state of the button in the UI.</p>
<p>To make the menu contribution show up as a toggleable button you have to provide the <em>style</em> value &#8220;toggle&#8221; on your commands menu contribution:</p>
<pre class="brush: java">&lt;extension point=&quot;org.eclipse.ui.menus&quot;&gt;
  &lt;menuContribution locationURI=&quot;...&quot;&gt;
    &lt;command commandId=&quot;org.eclipse.example.command.toggle&quot;
              style=&quot;toggle&quot; /&gt;
  &lt;/menuContribution&gt;
&lt;/extension&gt;</pre>
<p>Next we have too keep track of our actual toggle state. Since it is possible to have multiple menu contributions for the same command, we have to keep track of the state in a central place. Imagine a toggle button triggerable from the main menu and a views toolbar. The state of these buttons are keept in sync by storing the state directly in the command.  The key to this is the <em>org.eclipse.jface.commands.ToggleState</em>. This implementation of <em>org.eclipse.core.commands.State</em> is a wrapper for a <em>boolean</em>. To attach such a <em>State </em>object to a command, it is provided during the command declaration:</p>
<pre class="brush: java">&lt;command id=&quot;org.eclipse.example.command.toggle&quot;
         name=&quot;Toggle Me&quot;&gt;
  &lt;state class=&quot;org.eclipse.jface.commands.ToggleState&quot;
         id=&quot;org.eclipse.example.command.toggleState&quot; /&gt;
&lt;/command&gt;</pre>
<p>The <em>state</em> element takes the <em>ToggleState</em> class as a state provider and attaches itself to the command. The id of the state has to be unique to identfy the state. With the state attached to our command, how can we access it? In the <em>Handler</em>, reacting to the invocation of the menu contribution, we have to access the current state keept in the ToggleState. The following code demonstrates just that:</p>
<pre class="brush: java">ICommandService service =
(ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class);
Command command = service.getCommand(&quot;org.eclipse.example.command.toggle&quot;);
State state = command.getState(&quot;org.eclipse.example.command.toggleState&quot;);
state.setValue(!(Boolean) state.getValue());</pre>
<p>We obtain our command from the <em>ICommandService </em>and ask it for our toggleState stored within the command. Next we just flip the boolean as to create the new state. Now we can just do whatever we want to do in our <em>Handler</em> using the new state. Great, isn&#8217;t it? Of course the <em>ToggleState</em> is only one possible implementation of <em>State</em>. One could also imagine multiple states, radio states, text states etc. Also the <em>State</em> class has a specialization (<em>PersistableState</em>), which can be persisted to the preferences as to keep track of the (toggle) states of your buttons.</p>
<p>But there is thing left to do: what happens to this other button which is also a menu contribution for our command? We need to toggle the pressed state of it, as to reflect the state of the first button. To do so, a <em>Handler</em> has to implement <em>IElementUpdater </em>providing the method updateElements(&#8230;). It gets an UIElement as a parementer, which can be used to trigger the toggle state:</p>
<pre class="brush: java">public void updateElement(UIElement element, Map paramters) {
  element.setChecked(isSelected);
}</pre>
<p>To broadcast the refresh event to all menu contributions we use the <em>ICommandService</em> in our Handlers:</p>
<pre class="brush: java">commandService.refreshElements(executionEvent.getCommand().getId(), null);</pre>
<p>I hope you find the information here valuable and i am looking forward to your comments.</p>
<p><br/><div style="display: inline-block"><a href="https://twitter.com/intent/tweet?source=webclient&amp;text=Toggling+a+Command+contribution&amp;via=eclipsesource&amp;url=http://eclipsesource.com/blogs/2009/01/15/toggling-a-command-contribution/" target="_blank" title="Share on Twitter" style="margin-right: 5px;"><img title="Twitter" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/twitter.png" alt="Twitter"/></a><a href="https://plus.google.com/share?url=http://eclipsesource.com/blogs/2009/01/15/toggling-a-command-contribution/" target="_blank" title="+1" style="margin-right: 5px;"><img title="Google+" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/google_plus.png" alt="Google+"/></a><a href="http://www.linkedin.com/cws/share?url=http://eclipsesource.com/blogs/2009/01/15/toggling-a-command-contribution/" target="_blank" title="Share on LinkedIn" style="margin-right: 5px;"><img title="LinkedIn" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/linkedin.png" alt="LinkedIn"/></a><a href="https://www.facebook.com/sharer/sharer.php?u=http://eclipsesource.com/blogs/2009/01/15/toggling-a-command-contribution/&amp;t=Toggling+a+Command+contribution" target="_blank" title="Facebook" style="margin-right: 5px;"><img title="Facebook" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/facebook.png" alt="Facebook"/></a></div><br/>Comments are off for this post.. Tagged with <a href='http://eclipsesource.com/blogs/tag/commands/' title='commands Tag'>commands</a>, <a href='http://eclipsesource.com/blogs/tag/tips/' title='tips Tag'>tips</a>, <a href='http://eclipsesource.com/blogs/tag/commands/' title='commands Tag'>commands</a>, <a href='http://eclipsesource.com/blogs/tag/tips/' title='tips Tag'>tips</a></p>]]></content:encoded>
			<wfw:commentRss>http://eclipsesource.com/blogs/2009/01/15/toggling-a-command-contribution/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
	</channel>
</rss>
