<?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; Ralf Sternberg</title>
	<atom:link href="http://eclipsesource.com/blogs/author/rsternberg/feed/" rel="self" type="application/rss+xml" />
	<link>http://eclipsesource.com/blogs</link>
	<description>Eclipse Equinox OSGi</description>
	<lastBuildDate>Fri, 18 May 2012 15:00:41 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>The new Application API in RAP</title>
		<link>http://eclipsesource.com/blogs/2012/05/09/the-new-application-api-in-rap/</link>
		<comments>http://eclipsesource.com/blogs/2012/05/09/the-new-application-api-in-rap/#comments</comments>
		<pubDate>Wed, 09 May 2012 12:58:56 +0000</pubDate>
		<dc:creator>Ralf Sternberg</dc:creator>
				<category><![CDATA[eclipse]]></category>
		<category><![CDATA[news]]></category>
		<category><![CDATA[syndicate]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[juno]]></category>
		<category><![CDATA[new & noteworthy]]></category>
		<category><![CDATA[OSGi]]></category>
		<category><![CDATA[rap]]></category>

		<guid isPermaLink="false">http://eclipsesource.com/blogs/?p=7640</guid>
		<description><![CDATA[RAP 1.5 includes a new API to define and start RAP applications programmatically (up to RAP 1.4, this was only possible using Eclipse extensions or web.xml properties). With this new API, RAP can also be used for leightweight applications based on OSGi, but without the entire Eclipse stack, even with other OSGi containers like Apache [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://eclipse.org/rap/downloads/1.5/">RAP 1.5</a> includes a new API to define and start RAP applications programmatically (up to RAP 1.4, this was only possible using Eclipse extensions or web.xml properties). With this new API, RAP can also be used for leightweight applications based on OSGi, but without the entire Eclipse stack, even with other OSGi containers like <a href="http://felix.apache.org/">Apache Felix</a>. Also traditional web applications, that use RWT as a library without OSGi, benefit from the new API.</p>
<p>This API contains a couple of interfaces that we had trouble to find suitable names for. If you&#8217;ve used this API already you know that there were two interfaces side-by-side in the same package with almost the same name: <em>ApplicationConfigurator</em> and <em>ApplicationConfiguration</em>. Even though these names seemed to be correct, it <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=369942">turned out</a> that they were hard to tell apart, and if mixed up in a service declaration, the application did not start, without any warning.</p>
<p>So we reviewed the case and eventually came up with better names for the interfaces without changing the structure. Let me explain the new API and our reasoning behind it.</p>
<h2>Implementing an ApplicationConfiguration</h2>
<p>A RAP application consists of various parts, such as entrypoints, URL mappings, themes, service handlers, etc. All these parts constitute an <em>ApplicationConfiguration</em>. The configuration is like the blueprint for an application. Based on an ApplicationConfiguration, the framework can create and start an application instance. There can be more than one application instances at runtime, e.g. running on different network ports or different servlet contexts.</p>
<p>Hence, when you write a RAP application, you have to provide an <em>ApplicationConfiguration</em>.</p>
<p>An <em>ApplicationConfiguration</em> is used to configure an application before it is started. For this step, RAP follows a callback approach to leave the responsibility for creating and starting the application with the framework. Therefore, the configuration must actively configure the application. To do so, it has one method <em>configure( Application )</em>. The framework provides a reference to the created <em>Application</em> as a parameter to this method. Here&#8217;s how a simple implementation looks like:</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> SimpleConfiguration <span style="color: #000000; font-weight: bold;">implements</span> ApplicationConfiguration <span style="color: #009900;">&#123;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> configure<span style="color: #009900;">&#40;</span> Application application <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    application.<span style="color: #006633;">addEntryPoint</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;/simple&quot;</span>, SimpleEntryPoint.<span style="color: #000000; font-weight: bold;">class</span>, <span style="color: #000066; font-weight: bold;">null</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    application.<span style="color: #006633;">addEntryPoint</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;/other&quot;</span>, AnotherEntryPoint.<span style="color: #000000; font-weight: bold;">class</span>, <span style="color: #000066; font-weight: bold;">null</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<h2>Registering the ApplicationConfiguration</h2>
<p>When using OSGi, the <em>ApplicationConfiguration</em> can be registered as a service. I&#8217;d recommend using OSGi declarative services (DS) like this:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;scr:component</span> <span style="color: #000066;">xmlns:scr</span>=<span style="color: #ff0000;">&quot;http://www.osgi.org/xmlns/scr/v1.1.0&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;implementation</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;com.example.SimpleConfiguration&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;service<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;provide</span> <span style="color: #000066;">interface</span>=<span style="color: #ff0000;">&quot;org.eclipse.rwt.application.ApplicationConfiguration&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/service<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/scr:component<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>The bundle <em>org.eclipse.rap.rwt.osgi</em> will automatically start this application on every available HttpService. When using Equinox, don&#8217;t forget to also include the <em>org.eclipse.equinox.ds</em> bundle. You can find an example of a simple RAP application using DS on <a href="https://github.com/ralfstx/rap-helpers/tree/master/example.rwt.simple">github</a>.</p>
<p>When using RWT as a library in a traditional web application, i.e. without OSGi, you can register your <em>ApplicationConfiguration</em> in the <em>web.xml</em> by adding a <em>context-param</em> with the fully qualified class name of the implementation:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;context-param<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;param-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>org.eclipse.rap.applicationConfiguration<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/param-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;param-value<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>com.example.ExampleConfiguration<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/param-value<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/context-param<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>You can always look up the param-name in the constant <em>ApplicationConfiguration#CONFIGURATION_PARAM</em>. The RAP FAQ has a <a href="http://wiki.eclipse.org/RAP/FAQ#How_do_I_develop_an_RWT_standalone_application_with_RAP_.3E.3D_1.5">complete example</a>.</p>
<h2>Starting an Application</h2>
<p>When an ApplicationConfiguration has been registered as described above, the application is automatically started by the framework. Alternatively, it can also be started explicitly using an <em>ApplicationRunner</em>:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">ApplicationConfiguration configuration <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> SimpleConfiguration<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
ApplicationRunner runner <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> ApplicationRunner<span style="color: #009900;">&#40;</span> configuration, servletContext <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
runner.<span style="color: #006633;">start</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>There&#8217;s a <a href="http://martinfowler.com/bliki/TwoHardThings.html">saying</a> that there were only two hard things in computer science, cache invalidation and naming things. I don&#8217;t happen to know what&#8217;s so tricky about cache invalidation <img src='http://eclipsesource.com/blogs/wp-includes/images/smilies/icon_wink.gif' alt="icon wink The new Application API in RAP" class='wp-smiley' title="The new Application API in RAP" />  But I can hardly remember any <em>technical</em> problem that caused me as much of a headache as these few names did. I hope that after so many discussions, this new API will prove to be simple to understand and to use.</p>
<p>Thanks to <a href="http://www.codeaffine.com/author/fappel/">Frank</a>, <a href="http://www.codeaffine.com/author/rherrmann/">Rüdiger</a>, <a href="http://eclipsesource.com/blogs/author/hstaudacher/">Holger</a> and <a href="http://eclipsesource.com/blogs/author/jordi/">Jordi</a> for great discussions and especially to Frank for contributing this new API to RAP!</p>
<p>The changes are part of RAP 1.5M7, published this Friday, May 11.</p>
]]></content:encoded>
			<wfw:commentRss>http://eclipsesource.com/blogs/2012/05/09/the-new-application-api-in-rap/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>M6 brings markup text support to RAP</title>
		<link>http://eclipsesource.com/blogs/2012/03/23/m6-brings-markup-text-support-to-rap/</link>
		<comments>http://eclipsesource.com/blogs/2012/03/23/m6-brings-markup-text-support-to-rap/#comments</comments>
		<pubDate>Fri, 23 Mar 2012 11:47:46 +0000</pubDate>
		<dc:creator>Ralf Sternberg</dc:creator>
				<category><![CDATA[news]]></category>
		<category><![CDATA[syndicate]]></category>
		<category><![CDATA[juno]]></category>
		<category><![CDATA[milestone]]></category>
		<category><![CDATA[new and noteworthy]]></category>
		<category><![CDATA[rap]]></category>

		<guid isPermaLink="false">http://eclipsesource.com/blogs/?p=7337</guid>
		<description><![CDATA[The RAP 1.5 M6 milestone build is packed with new features, especially for Trees and Tables. But most notably, you can now use HTML markup in Tables, Trees, and also in Labels: Just enable the markup support for a certain widget (see below), then you can make its text bold, italic, yellow or … no, [...]]]></description>
			<content:encoded><![CDATA[<p>The RAP 1.5 M6 milestone build is packed with new features, especially for Trees and Tables. But most notably, you can now use HTML markup in Tables, Trees, and also in Labels:</p>
<p><a href="http://eclipsesource.com/blogs/wp-content/uploads/2012/03/MarkupInTable.png"><img src="http://eclipsesource.com/blogs/wp-content/uploads/2012/03/MarkupInTable.png" alt="MarkupInTable M6 brings markup text support to RAP" title="Markup in a RAP Table" width="510" height="196" class="aligncenter size-full wp-image-7351" /></a></p>
<p>Just enable the markup support for a certain widget (see below), then you can make its text <strong>bold</strong>, <em>italic</em>, <span style="background:gold">yellow</span> or … no, not blinking! Actually, RAP will validate the markup and allows only a selection of tags (no <code>&lt;script&gt;</code> tags, please!). But since the <code>&lt;img&gt;</code> tag is in that list, you can add a smiley instead <img src='http://eclipsesource.com/blogs/wp-includes/images/smilies/icon_wink.gif' alt="icon wink M6 brings markup text support to RAP" class='wp-smiley' title="M6 brings markup text support to RAP" /> .</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">Table table <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Table<span style="color: #009900;">&#40;</span> parent, SWT.<span style="color: #006633;">BORDER</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
table.<span style="color: #006633;">setData</span><span style="color: #009900;">&#40;</span> RWT.<span style="color: #006633;">MARKUP_ENABLED</span>, <span style="color: #003399;">Boolean</span>.<span style="color: #000066; font-weight: bold;">TRUE</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
TableItem item <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> TableItem<span style="color: #009900;">&#40;</span> table, SWT.<span style="color: #006633;">NONE</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
item.<span style="color: #006633;">setText</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;Some &lt;em&gt;text&lt;/em&gt; with &lt;strong&gt;markup&lt;strong&gt;&quot;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>This also means that you don&#8217;t have to break your neck anymore just to add an HTML link to your RAP UI. You can now place real links in any Label or CLabel:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #003399;">Label</span> label <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">Label</span><span style="color: #009900;">&#40;</span> parent, SWT.<span style="color: #006633;">NONE</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
label.<span style="color: #006633;">setData</span><span style="color: #009900;">&#40;</span> RWT.<span style="color: #006633;">MARKUP_ENABLED</span>, <span style="color: #003399;">Boolean</span>.<span style="color: #000066; font-weight: bold;">TRUE</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
label.<span style="color: #006633;">setText</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;&lt;a href=<span style="color: #000099; font-weight: bold;">\&quot;</span>http://eclipse.org/rap<span style="color: #000099; font-weight: bold;">\&quot;</span> target=<span style="color: #000099; font-weight: bold;">\&quot;</span>_blank<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;RAP project page&lt;a&gt;&quot;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Don&#8217;t like the <code>setData()</code> programming? We don&#8217;t like it either. But for now, it&#8217;s the simplest way to expose additional functionality without changing the SWT API. For RAP 2.0, we plan to come up with some better API for our extensions.</p>
<p>Try out the markup support in our updated <a href="http://rap.eclipsesource.com/rapdemo/examples#rich-label">online demo</a>! BTW, did you notice that this is a deep link into the demo application? Yes, there was a <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=294709">bug</a> preventing them from working in RAP for long, and it&#8217;s now finally fixed! You can now use the BrowserHistory to navigate to a certain point in your application right on startup. Here&#8217;s the link to an example page that shows <a href="http://rap.eclipsesource.com/rapdemo/examples#table-markup">markup in a Table</a>.</p>
<p>And there are more Table and Tree enhancements, such as the <em>fixed columns</em> support that lets you exclude one or more colums from horizontal scrolling. Check out the full list of changes in the <a href="http://eclipse.org/rap/noteworthy/1.5/news_M6.php">New &amp; Noteworthy</a>. <a href="http://eclipse.org/rap/downloads/"></p>
<p>Get it</a> while it&#8217;s hot, this milestone is a must have <img src='http://eclipsesource.com/blogs/wp-includes/images/smilies/icon_wink.gif' alt="icon wink M6 brings markup text support to RAP" class='wp-smiley' title="M6 brings markup text support to RAP" /> </p>
]]></content:encoded>
			<wfw:commentRss>http://eclipsesource.com/blogs/2012/03/23/m6-brings-markup-text-support-to-rap/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Javascript validation with JSHint in Eclipse</title>
		<link>http://eclipsesource.com/blogs/2012/01/26/javascript-validation-with-jshint-eclipse/</link>
		<comments>http://eclipsesource.com/blogs/2012/01/26/javascript-validation-with-jshint-eclipse/#comments</comments>
		<pubDate>Wed, 25 Jan 2012 22:07:00 +0000</pubDate>
		<dc:creator>Ralf Sternberg</dc:creator>
				<category><![CDATA[eclipse]]></category>
		<category><![CDATA[news]]></category>
		<category><![CDATA[syndicate]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://eclipsesource.com/blogs/?p=6965</guid>
		<description><![CDATA[Besides all the Java code in the RAP project, we also have more than 250 JavaScript files which total up to 75k lines of code. For such an amount of code, you should have some kind of code analysis that detects common coding problems like unintentional global variables. We use the JSEclipse plug-in for JavaScript [...]]]></description>
			<content:encoded><![CDATA[<p>Besides all the Java code in the <a href="http://eclipse.org/rap">RAP</a> project, we also have more than 250 JavaScript files which total up to 75k lines of code. For such an amount of code, you should have some kind of code analysis that detects common coding problems like unintentional global variables. We use the JSEclipse plug-in for JavaScript editing which detects some, but not many JavaScript problems.</p>
<p>A while ago, we&#8217;ve tried to use <a href="http://jslint.com/">JSLint</a>, a tool written by JavaScript guru Douglas Crockford. Unfortunately, this tools produces several thousand warnings on our code base, many of them were not really problems but debatable coding style issues and there was no way to turn them off. JSLint&#8217;s lack of customizability recently lead to a <a href="http://anton.kovalyov.net/2011/02/20/why-i-forked-jslint-to-jshint/">fork</a> named <a href="http://www.jshint.com/">JSHint</a> that is going to provide more flexible <a href="http://www.jshint.com/options/">configuration options</a>.</p>
<p>Like JSLint, JSHint is written in JavaScript, but can be run on the command line using tools like <a href="http://www.mozilla.org/rhino/">Rhino</a> or JavaScriptCore. I tried JSHint on our codebase with good results using a shell script that runs it on top of Rhino. Unfortunately, checking all our 250+ *.js files keeps my machine busy for 5 minutes and 40 seconds and effectively turns it into a fan heater. This is not because JSHint itself is so demanding, but because for every file, a JVM has to be started, Rhino has to be loaded, then Rhino has to parse and load the JSHint JavaScript library, and then finally, jshint can parse and validate the source file.</p>
<p>Encouraged by the good results I tried to find a solution that doesn&#8217;t have this overhead. And as an Eclipse hacker and user, I certainly wanted to integrate the tool into my daily working environment. The result is a simple, yet efficient <a href="http://github.eclipsesource.com/jshint-eclipse/">JSHint Eclipse integration</a> that validates the same bunch of *.js files in less than 15 seconds.</p>
<p><a href="http://eclipsesource.com/blogs/wp-content/uploads/2012/01/jshint-eclipse-screenshot.png"><img class="aligncenter wp-image-6969" title="jshint-eclipse" src="http://eclipsesource.com/blogs/wp-content/uploads/2012/01/jshint-eclipse-screenshot.png" alt="jshint eclipse screenshot Javascript validation with JSHint in Eclipse" width="600" height="430" /></a></p>
<p>This speedup could be achieved by exploiting the way Eclipse builds projects: It uses the same builder instance to visit all files of the project recursively. That makes it possible to load and configure the JSHint library only once for the entire project and reuse it for all files being checked. Of course, validating all files of a project is only necessary for a full rebuild. During normal work, single files are being validated instantly when they have changed.</p>
<p>Although the configuration options are still somewhat basic, this integration proved to be very helpful already. I thought that it may be useful for others as well and decided to build and publish a first version. It&#8217;s available on the <a href="http://github.eclipsesource.com/jshint-eclipse/">jshint-eclipse page</a>. There&#8217;s an update site that let&#8217;s you install the plug-in right into your Eclipse IDE. If you find the plug-in useful, have ideas for improvements, find a problem or want to contribute, I&#8217;m happy to hear about it. To report problems, please use the <a href="https://github.com/eclipsesource/jshint-eclipse/issues">github issue tracker</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://eclipsesource.com/blogs/2012/01/26/javascript-validation-with-jshint-eclipse/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Eclipse Juno M4: RAP speaks JSON</title>
		<link>http://eclipsesource.com/blogs/2011/12/16/eclipse-juno-m4-rap-speaks-json/</link>
		<comments>http://eclipsesource.com/blogs/2011/12/16/eclipse-juno-m4-rap-speaks-json/#comments</comments>
		<pubDate>Fri, 16 Dec 2011 16:32:19 +0000</pubDate>
		<dc:creator>Ralf Sternberg</dc:creator>
				<category><![CDATA[eclipse]]></category>
		<category><![CDATA[news]]></category>
		<category><![CDATA[syndicate]]></category>
		<category><![CDATA[juno]]></category>
		<category><![CDATA[new and noteworthy]]></category>
		<category><![CDATA[protocol]]></category>
		<category><![CDATA[rap]]></category>

		<guid isPermaLink="false">http://eclipsesource.com/blogs/?p=6825</guid>
		<description><![CDATA[In the RAP framework, the widgets in a website are remotely controlled by the web server. The server does this by sending messages to the client in response to Ajax requests. Until now, those messages used to contain proprietary JavaScript that has been evaluated by the browser. Apart from the drawbacks of using eval to [...]]]></description>
			<content:encoded><![CDATA[<p>In the <a href="http://eclipse.org/rap">RAP</a> framework, the widgets in a website are remotely controlled by the web server. The server does this by sending messages to the client in response to Ajax requests. Until now, those messages used to contain proprietary JavaScript that has been evaluated by the browser. Apart from the drawbacks of using <em>eval</em> to process server responses, this tightly couples RAP to its default browser client. The messages were so specific that only this client could understand them.</p>
<p>One of our goals for RAP 1.5 is to open the framework for alternative client implementations. After all, the messages from the server contain precise rendering commands that are not at all specific to JavaScript. Commands like &#8220;create a button with text &#8216;<code>Ok</code>&#8216;, set its size to <code>190x25px</code>, and place it at pos <code>(23,42)</code>&#8221; or &#8220;change the text color of the label with id &#8216;<code>w47</code>&#8216; to &#8216;<code>#ff0000</code>&#8216;&#8221; can be rendered by any client that is able to create and manipulate widgets. It doesn&#8217;t have to be a JavaScript client, also clients written in other languages like Java or Objective C can implement it. Clients can render widgets with any UI technology, be it SVG or even a mobile device&#8217;s native widget set.</p>
<p>To allow for those cases, we exchanged the communication format with a simple <a href="http://wiki.eclipse.org/RAP/Protocol">predefined format</a> based on <a href="http://json.org/">JSON</a>. With the <a href="http://eclipse.org/rap/noteworthy/1.5/news_M4.php">M4 build published today</a>, all responses from a RAP server are now plain JSON. This also makes the debugging much easier, since developer tools like <a href="http://getfirebug.com">Firebug</a> display the structure of a message.</p>
<p><a href="http://eclipsesource.com/blogs/wp-content/uploads/2011/12/RAP-Firebug-JSON.png"><img class="aligncenter size-full wp-image-6828" title="RAP Session in Firebug (JSON)" src="http://eclipsesource.com/blogs/wp-content/uploads/2011/12/RAP-Firebug-JSON.png" alt="RAP Firebug JSON Eclipse Juno M4: RAP speaks JSON" width="600" height="301" /></a></p>
<p>When <a href="http://eclipsesource.com/blogs/tag/protocol/">designing the protocol</a>, we took great care not to limit the exchange format to widgets. Instead, we created a generic synchronization protocol for any kind of objects. Objects are identified with a unique id, and every operation is related to a target object that is referenced by its unique id. There are different types of operations: one to create an object, one to destroy it, one to change some properties on an object, etc. Every message from the server contains a list of operations, besides some meta information.</p>
<p>You&#8217;ve guessed that we already have some prototypes for alternative RAP clients in progress. We&#8217;ll write about them soon&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://eclipsesource.com/blogs/2011/12/16/eclipse-juno-m4-rap-speaks-json/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Meet the RAP team at EclipseCon Europe 2011</title>
		<link>http://eclipsesource.com/blogs/2011/10/26/meet-the-rap-team-at-eclipsecon-europe-2011/</link>
		<comments>http://eclipsesource.com/blogs/2011/10/26/meet-the-rap-team-at-eclipsecon-europe-2011/#comments</comments>
		<pubDate>Wed, 26 Oct 2011 10:12:24 +0000</pubDate>
		<dc:creator>Ralf Sternberg</dc:creator>
				<category><![CDATA[news]]></category>

		<guid isPermaLink="false">http://eclipsesource.com/blogs/?p=6603</guid>
		<description><![CDATA[If you&#8217;re interested in the latest news on RAP, consider joining us at EclipseCon Europe next week in Ludwigsburg. There are quite a number of RAP talks this year: On Thursday morning, Paul Petershagen of Vitaphone, a global provider of solutions in the telemedicine sector, will share their experience with a large RAP/RCP single-sourcing project. [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re interested in the latest news on RAP, consider joining us at <a href="http://eclipsecon.org/">EclipseCon Europe</a> next week in Ludwigsburg. There are quite a number of RAP talks this year:</p>
<p>On <a href="http://eclipsecon.org/sessions/eclipse-telemedicine-and-health-care-%E2%80%93-success-story-rcp-and-rap">Thursday morning</a>, Paul Petershagen of <a href="http://www.vitaphone.com/">Vitaphone</a>, a global provider of solutions in the telemedicine sector, will share their experience with a large RAP/RCP single-sourcing project. This is an good example of the power of single-sourcing. Paul also has some insights and figures from the project manager&#8217;s perspective.</p>
<p><a href="http://eclipsecon.org/sessions/dynamic-web-applications-osgi-and-rap">Later that day</a>, Frank Appel, one of our project pioneers, and me will show how RAP now supports the development of lightweight, modular, and dynamic web applications based on OSGi. This talk is 30 minutes so will not go into too much technical detail &#8211; instead, we&#8217;ll  show some cool examples and explain the new possibilities.</p>
<p>For those who want to understand the technical side better and try out the new features right away, we offer a 1.5 hours <a href="http://eclipsecon.org/sessions/lightweight-dynamic-webapps-made-easy-rap-and-osgi-presented-eclipsesource">hands-on tutorial on Friday</a>. In this tutorial, we&#8217;ll show how to create and structure your RAP project, and also how to build and deploy it using tycho. Frank, Rüdiger, Holger, and me will be around so you will have first-class support. By the way, did you know that RAP finally <a href="http://wiki.eclipse.org/RAP/RWT_Cluster">supports clustering</a>? If you have specific questions about this feature, Friday is your chance to meet Rüdiger, who has been working on this stuff over the last months.</p>
<p>And, last but not least, we are happy that another Eclipse project has decided to build on RAP: the <a href="http://www.eclipse.org/scout/">Scout</a> project provides a framework for rapid development of complete enterprise applications. With the upcoming Juno release, Scout will provide a RAP integration. Project leads Matthias Zimmermann and Andreas Hoegger will present &#8220;the best of both worlds&#8221; <a href="http://eclipsecon.org/sessions/eclipse-scout-features-rap-best-both-worlds">on Thursday afternoon</a>.</p>
<p>You will always find one of us at the EclipseSource booth. I hope to meet you in Ludwigsburg!</p>
]]></content:encoded>
			<wfw:commentRss>http://eclipsesource.com/blogs/2011/10/26/meet-the-rap-team-at-eclipsecon-europe-2011/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Lightweight OSGi Applications using RAP&#8217;s Widget Toolkit</title>
		<link>http://eclipsesource.com/blogs/2011/08/29/lightweight-osgi-applications-using-raps-widget-toolkit/</link>
		<comments>http://eclipsesource.com/blogs/2011/08/29/lightweight-osgi-applications-using-raps-widget-toolkit/#comments</comments>
		<pubDate>Mon, 29 Aug 2011 20:04:06 +0000</pubDate>
		<dc:creator>Ralf Sternberg</dc:creator>
				<category><![CDATA[eclipse]]></category>
		<category><![CDATA[OSGi]]></category>
		<category><![CDATA[syndicate]]></category>
		<category><![CDATA[milestone]]></category>
		<category><![CDATA[new and noteworthy]]></category>
		<category><![CDATA[rap]]></category>

		<guid isPermaLink="false">http://eclipsesource.com/blogs/?p=6394</guid>
		<description><![CDATA[Update 2: The new interfaces have been renamed again in RAP 1.5M7. Please refer to this post for the details and check out the updated code example. Update: APIs have changed a bit meanwhile, so I updated the code below accordingly. Entry points are now registered by path, and JEE_COMPLATIBILTIY has become the default mode, [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Update 2:</strong> The new interfaces have been renamed again in RAP 1.5M7. Please refer to <a href="http://eclipsesource.com/blogs/2012/05/09/the-new-application-api-in-rap/">this post</a> for the details and check out the updated <a href="https://github.com/ralfstx/rap-helpers/tree/master/example.rwt.simple">code example</a>.</p>
<p><strong>Update:</strong> APIs have changed a bit meanwhile, so I updated the code below accordingly. Entry points are now registered by path, and JEE_COMPLATIBILTIY has become the default mode, which makes the main loop obsolete in this kind of applications.</p>
<p>RAP is well known as an &#8220;RCP for the web browser&#8221;, including workbench, extension points, and all that stuff. Indeed, one of the greatest features of RAP is its ability to reuse RCP code in web applications. But did you know that you can also use RAP&#8217;s widget toolkit (RWT) to create simple web UIs for your applications, without the heavy weight Eclipse UI stack?</p>
<p>With RAP 1.5, you can now simply include RWT in any OSGi application. You only need two bundles: <code>org.eclipse.rap.rwt</code> (the RAP widget toolkit itself) and <code>org.eclipse.rap.rwt.osgi</code> which integrates RWT with the OSGi HTTP service. There are no tie-ins with Equinox anymore, thus RAP also works with other OSGi containers.</p>
<p>To create a UI with RWT, you have to implement the interface <code>IEntryPoint</code>, here&#8217;s a simple example:</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: #000066; font-weight: bold;">int</span> createUI<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #666666; font-style: italic;">// Create a maximized top-level shell without trimmings that represents the main &quot;page&quot;</span>
    Display display <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Display<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    Shell page <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Shell<span style="color: #009900;">&#40;</span> display, SWT.<span style="color: #006633;">NO_TRIM</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    page.<span style="color: #006633;">setMaximized</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>
    page.<span style="color: #006633;">setLayout</span><span style="color: #009900;">&#40;</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">GridLayout</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">// Create contents of main shell</span>
    <span style="color: #003399;">Label</span> label <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">Label</span><span style="color: #009900;">&#40;</span> page, SWT.<span style="color: #006633;">NONE</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    label.<span style="color: #006633;">setText</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;Hello&quot;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #003399;">Button</span> button <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">Button</span><span style="color: #009900;">&#40;</span> page, SWT.<span style="color: #006633;">PUSH</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    button.<span style="color: #006633;">setText</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;World&quot;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">// Open the top-level shell and run the main loop to process events</span>
    page.<span style="color: #006633;">layout</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    page.<span style="color: #006633;">open</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span></pre></div></div>

<p>Now what&#8217;s new is that, instead of registering this entry point with an extension point, you can now implement the new <code>ApplicationConfigurator</code> interface like this:</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: #000066; font-weight: bold;">void</span> configure<span style="color: #009900;">&#40;</span> <span style="color: #003399;">Context</span> context <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    context.<span style="color: #006633;">addEntryPoint</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;/simple&quot;</span>, SimpleEntryPoint.<span style="color: #000000; font-weight: bold;">class</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    context.<span style="color: #006633;">addBranding</span><span style="color: #009900;">&#40;</span> <span style="color: #000000; font-weight: bold;">new</span> AbstractBranding<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      @Override
      <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> getServletName<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #0000ff;">&quot;simple&quot;</span><span style="color: #339933;">;</span>
      <span style="color: #009900;">&#125;</span>
      @Override
      <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> getTitle<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #0000ff;">&quot;Simple RWT Example&quot;</span><span style="color: #339933;">;</span>
      <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span></pre></div></div>

<p>When this implementation is registered as an OSGi service, you can access the UI with a web browser:<br />
<a href="http://eclipsesource.com/blogs/wp-content/uploads/2011/08/RWTSimple.png"><br />
<img src="http://eclipsesource.com/blogs/wp-content/uploads/2011/08/RWTSimple.png" alt="RWTSimple Lightweight OSGi Applications using RAPs Widget Toolkit" title="RWT Simple Example" width="550" height="251" class="aligncenter size-full wp-image-6399" /></a><br />
You can check out the example project <code>example.rwt.simple</code> from my <a href="https://github.com/ralfstx/rap-helpers">rap-helpers repository on github</a>. Please note that for this example to run you need declarative services in your target platform, which are not included in the RAP 1.5M1 target but in the latest nightly build. Also be aware that the new API is still provisional and may change again until the final release.</p>
<p>Kudos to Frank Appel, who contributed the new OSGi integration. He has a more detailed introduction to the new OSGi integration and examples for configuration in <a href="http://www.codeaffine.com/2011/08/26/raprwt-osgi-integration/">his blog</a>. BTW, Frank and me plan to demo the possibilities of this approach in our talk <a href="http://www.eclipsecon.org/sessions/dynamic-web-applications-osgi-and-rap">Dynamic web applications with OSGi and RAP</a> at the EclipseCon Europe &#8211; vote for it if you&#8217;re interested!</p>
]]></content:encoded>
			<wfw:commentRss>http://eclipsesource.com/blogs/2011/08/29/lightweight-osgi-applications-using-raps-widget-toolkit/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Accessing a huge data set with the web browser</title>
		<link>http://eclipsesource.com/blogs/2011/08/15/accessing-a-huge-data-set-with-the-web-browser/</link>
		<comments>http://eclipsesource.com/blogs/2011/08/15/accessing-a-huge-data-set-with-the-web-browser/#comments</comments>
		<pubDate>Mon, 15 Aug 2011 07:19:52 +0000</pubDate>
		<dc:creator>Ralf Sternberg</dc:creator>
				<category><![CDATA[eclipse]]></category>
		<category><![CDATA[news]]></category>
		<category><![CDATA[syndicate]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[new and noteworthy]]></category>
		<category><![CDATA[rap]]></category>

		<guid isPermaLink="false">http://eclipsesource.com/blogs/?p=6351</guid>
		<description><![CDATA[The Enron Corporation was the American energy company that was involved in accounting fraud which led to the Enron scandal in 2001. During the investigation, large parts of the company&#8217;s email conversations were published. The result is that a huge, real-life data set including more than half a million emails from 150 Enron executives came [...]]]></description>
			<content:encoded><![CDATA[<p>The Enron Corporation was the American energy company that was involved in accounting fraud which led to the <a href="http://en.wikipedia.org/wiki/Enron_scandal">Enron scandal</a> in 2001. During the investigation, large parts of the company&#8217;s email conversations <a href="http://www.salon.com/news/feature/2003/10/14/enron/index.html">were published</a>. The result is that a <a href="http://www.cs.cmu.edu/~enron/">huge, real-life data set</a> including more than half a million emails from 150 Enron executives came into the public domain.</p>
<p>I thought that this data would be a good example to show the ability of the new Tree widget in RAP to display huge datasets.</p>
<p><a href="http://eclipsesource.com/blogs/wp-content/uploads/2011/08/Screenshot.png"><img class="aligncenter size-full wp-image-6354" title="A lazy TreeViewer in RAP" src="http://eclipsesource.com/blogs/wp-content/uploads/2011/08/Screenshot.png" alt="Screenshot Accessing a huge data set with the web browser" width="555" height="342" /></a></p>
<p>It&#8217;s clear that you cannot create half a million UI elements in a browser without running out of memory. Neither can you load the entire dataset (&gt; 2GB on disk) into memory on the server. You need a mechanism to load and display data on demand.</p>
<p>As of this week, the <strong>RWT Tree widget has full SWT.VIRTUAL support</strong>, i.e. it is capable of creating Tree items only at the moment they become visible. This feature is used by the JFace TreeViewer to request data from a lazy content provider on demand.</p>
<p>So, in order to make a complex data set accessible with a web UI, you just need to write an ILazyTreeContentProvider implementation. That&#8217;s about one screen of Java code, mostly copied from a <a href="http://wiki.eclipse.org/index.php/JFaceSnippets#Snippet047VirtualLazyTreeViewer">JFace snippet</a>. That&#8217;s all.</p>
<p>Check out the example on our <a href="http://rap.eclipsesource.com">online demo</a> (navigate to the tab called <em>Complex Data</em>). The source code of this demo page is available on <a href="https://github.com/ralfstx/rap-demo-additions">github</a>.</p>
<p>Full SWT.VIRTUAL support for the Tree widget is available in <a href="http://eclipse.org/rap/source/">CVS</a> and will be part of RAP 1.5M1.</p>
]]></content:encoded>
			<wfw:commentRss>http://eclipsesource.com/blogs/2011/08/15/accessing-a-huge-data-set-with-the-web-browser/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Uploading files with RAP 1.4</title>
		<link>http://eclipsesource.com/blogs/2011/06/23/uploading-files-with-rap-14/</link>
		<comments>http://eclipsesource.com/blogs/2011/06/23/uploading-files-with-rap-14/#comments</comments>
		<pubDate>Thu, 23 Jun 2011 10:19:34 +0000</pubDate>
		<dc:creator>Ralf Sternberg</dc:creator>
				<category><![CDATA[news]]></category>
		<category><![CDATA[syndicate]]></category>
		<category><![CDATA[indigo]]></category>
		<category><![CDATA[new and noteworthy]]></category>
		<category><![CDATA[rap]]></category>
		<category><![CDATA[Single Sourcing]]></category>

		<guid isPermaLink="false">http://eclipsesource.com/blogs/?p=6147</guid>
		<description><![CDATA[One of the new things in RAP 1.4 is the FileUpload widget in RWT, that replaces the old Upload widget from the sandbox. And there&#8217;s some more new upload stuff in the RAP Incubator. Here&#8217;s how to use the new features to upload files with RAP 1.4. The FileUpload is a new widget that wraps [...]]]></description>
			<content:encoded><![CDATA[<p>One of the new things in RAP 1.4 is the <em>FileUpload</em> widget in RWT, that replaces the old <em>Upload</em> widget from the sandbox. And there&#8217;s some more new upload stuff in the RAP Incubator. Here&#8217;s how to use the new features to upload files with RAP 1.4.</p>
<p>The FileUpload is a new widget that wraps the HTML file selection &lt;input&gt; tag. It looks like a button, and when it&#8217;s pressed, a native file dialog opens up that lets users select a file from their local file system. On file selection, a SelectionEvent will be fired. You can then programmatically upload the selected file to an http server using FileUpload.submit( URL ).</p>
<p><a href="http://eclipsesource.com/blogs/wp-content/uploads/2011/06/FileUpload.png"><img class="aligncenter size-full wp-image-6203" title="FileUpload widget" src="http://eclipsesource.com/blogs/wp-content/uploads/2011/06/FileUpload.png" alt="FileUpload Uploading files with RAP 1.4" width="90" height="33" /></a></p>
<p>In order to receive and store the uploaded files on the server, you also need a server-side component. We created such an upload server component in the RAP Incubator. It&#8217;s called FileUploadHandler and it uses the Apache fileupload component internally. It&#8217;s included in the bundle org.eclipse.rap.rwt.supplemental.fileupload. This handler accepts file uploads to a certain URL (FileUploadHandler.getUploadUrl()) and delegates the data to a FileUploadReceiver. You can either use the provided DiskFileUploadReceiver or create your own receiver to do whatever you like with the uploaded data: put it into a database, or simple analyze the data and discard it.</p>
<p>Sounds complicated? Well, there&#8217;s a <strong>much easier way</strong> to upload files with RAP 1.4! We&#8217;ve encapsulated the entire upload process in an implementation of the SWT FileDialog, which is also available in the incubator.</p>
<p style="text-align: center;"><a href="http://eclipsesource.com/blogs/wp-content/uploads/2011/06/FileDialog1.png"><img class="aligncenter size-full wp-image-6210" title="FileDialog" src="http://eclipsesource.com/blogs/wp-content/uploads/2011/06/FileDialog1.png" alt="FileDialog1 Uploading files with RAP 1.4" width="460" height="240" /></a></p>
<p>To make it easy to use, we now provide an update site for the Incubator. To use the FileDialog in your application, all you have to do is to:</p>
<ol>
<li>include the bundles from the RAP Incubator repository http://download.eclipse.org/rt/rap/1.4/incubator/ in your RAP 1.4 target platform, and</li>
<li>add a bundle dependency to org.eclipse.rap.rwt.supplemental.filedialog to your project (yes, you have to use Require-Bundle here because this bundle contributes a class to the org.eclipse.swt.widgets package, effectively creating a <em>split-package</em>).</li>
</ol>
<p>That&#8217;s all. Now you can use the FileDialog just like in SWT:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">  <span style="color: #003399;">FileDialog</span> fileDialog <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">FileDialog</span><span style="color: #009900;">&#40;</span> shell, SWT.<span style="color: #006633;">TITLE</span> <span style="color: #339933;">|</span> SWT.<span style="color: #006633;">MULTI</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  fileDialog.<span style="color: #006633;">setText</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;Upload Files&quot;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;?</span>
  fileDialog.<span style="color: #006633;">setAutoUpload</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> <span style="color: #666666; font-style: italic;">// This API will change, see below!</span>
  fileDialog.<span style="color: #006633;">open</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #003399;">String</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> fileNames <span style="color: #339933;">=</span> fileDialog.<span style="color: #006633;">getFileNames</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>After uploading, the dialog closes and the variable fileNames contains the absolute file names of the uploaded files on the server&#8217;s file system. There&#8217;s an auto-upload feature that is really nice (I think it should be the default) &#8211; with autoUpload on, the upload starts immediately after file selection. A user can still press Cancel to prevent the application from using the uploaded files.</p>
<p><strong>Note:</strong> Please note that this stuff is in the incubator and not part of the 1.4 release. The API and implementation may (and will) have to change and mature over time. However, if you use the latest version from 1.4/incubator site, you&#8217;ll always get a file dialog that will work with RAP 1.4. The server-side upload receiver and the required Apache bundles are also included.</p>
<p>We hope you enjoy these new features. Please try them out, tell us what you think, open bugs for the new stuff, and help us improving them.</p>
<p>Kudos to our new RAP committers Austin Riddle and Cole Markham who created this great new feature!</p>
<p><strong>Update:</strong> I mistakenly left out the &#8220;.rwt.&#8221; from the bundle namespace in the original post, the bundle names are fixed now in the text.</p>
<p><strong>Update:</strong> The 1.4 incubator repository has been updated with a newer version of the file dialog that is compatible with RAP 1.4. This update fixes the problem with missing file names mentioned in the comments.</p>
]]></content:encoded>
			<wfw:commentRss>http://eclipsesource.com/blogs/2011/06/23/uploading-files-with-rap-14/feed/</wfw:commentRss>
		<slash:comments>47</slash:comments>
		</item>
		<item>
		<title>Key Bindings in RAP</title>
		<link>http://eclipsesource.com/blogs/2011/04/27/key-bindings-in-rap/</link>
		<comments>http://eclipsesource.com/blogs/2011/04/27/key-bindings-in-rap/#comments</comments>
		<pubDate>Wed, 27 Apr 2011 08:07:39 +0000</pubDate>
		<dc:creator>Ralf Sternberg</dc:creator>
				<category><![CDATA[eclipse]]></category>
		<category><![CDATA[news]]></category>
		<category><![CDATA[syndicate]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[indigo]]></category>
		<category><![CDATA[rap]]></category>

		<guid isPermaLink="false">http://eclipsesource.com/blogs/?p=5745</guid>
		<description><![CDATA[Support for key bindings (bug 282449) has been one of the most requested features for RAP. So I&#8217;m happy to say that since 1.4 M5, RAP implements the JFace key bindings API, provides the org.eclipse.ui.bindings extension point, and enables most of the default workbench key bindings. As a result, you can now use most* of the [...]]]></description>
			<content:encoded><![CDATA[<p>Support for key bindings (<del><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=282449">bug 282449</a></del>) has been one of the most requested features for RAP. So I&#8217;m happy to say that since 1.4 M5, RAP implements the JFace key bindings API, provides the <code>org.eclipse.ui.bindings</code> extension point, and enables most of the default workbench key bindings. As a result, you can now use most* of the key shortcuts of your application also in the browser–if your application uses the workbench. But many use RAP without using the workbench. So how can you enable key bindings in a plain RWT application?</p>
<p>In M7, we now introduce a simple way of doing this. Let&#8217;s first have a look on how you would implement a key binding in SWT. You would have to register a global listener for key events on the display like this:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">display.<span style="color: #006633;">addFilter</span><span style="color: #009900;">&#40;</span> SWT.<span style="color: #006633;">KeyDown</span>, <span style="color: #000000; font-weight: bold;">new</span> Listener<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> handleEvent<span style="color: #009900;">&#40;</span> <span style="color: #003399;">Event</span> event <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> event.<span style="color: #006633;">stateMask</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">0</span> <span style="color: #339933;">&amp;&amp;</span> event.<span style="color: #006633;">keyCode</span> <span style="color: #339933;">==</span> SWT.<span style="color: #006633;">ESCAPE</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #666666; font-style: italic;">// handle escape key</span>
    <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Well, you can now use the same code in RWT.</p>
<p>But there&#8217;s one more thing to it: RWT is a client-server architecture and we don&#8217;t want the browser client to send a request for each and every key stroke. The server should only be notified when the user presses one of the key sequences that we are really interested in. Therefore, we have to inform the client, which key sequences should be <q>active</q>.  This information can now be attached to the display using <code>Display.setData()</code> with the new constant <code>RWT.ACTIVE_KEYS</code> as property key. The value of this property must be an array of strings, each one representing a single active key sequence. The syntax is the same that you know from key binding extensions for the workbench.  So if you want to enable some simple key bindings like, for example, &#8220;c&#8221; for compose and &#8220;x&#8221; for delete, and maybe some more advanced key sequences like &#8220;Ctrl+F11&#8243; for power-users, you could write something like this:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">display.<span style="color: #006633;">setData</span><span style="color: #009900;">&#40;</span> RWT.<span style="color: #006633;">ACTIVE_KEYS</span>, <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">String</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span> <span style="color: #0000ff;">&quot;C&quot;</span>, <span style="color: #0000ff;">&quot;X&quot;</span>, <span style="color: #0000ff;">&quot;CTRL+F11&quot;</span> <span style="color: #009900;">&#125;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
display.<span style="color: #006633;">addFilter</span><span style="color: #009900;">&#40;</span> SWT.<span style="color: #006633;">KeyDown</span>, <span style="color: #000000; font-weight: bold;">new</span> Listener<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> handleEvent<span style="color: #009900;">&#40;</span> <span style="color: #003399;">Event</span> event <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> event.<span style="color: #006633;">stateMask</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">0</span> <span style="color: #339933;">&amp;&amp;</span> event.<span style="color: #006633;">character</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'C'</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      handleCompose<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: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span> event.<span style="color: #006633;">stateMask</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">0</span> <span style="color: #339933;">&amp;&amp;</span> event.<span style="color: #006633;">character</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'X'</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      handleDelete<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: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span> event.<span style="color: #006633;">stateMask</span> <span style="color: #339933;">==</span> SWT.<span style="color: #006633;">CTRL</span> <span style="color: #339933;">&amp;&amp;</span> event.<span style="color: #006633;">keyCode</span> <span style="color: #339933;">==</span> SWT.<span style="color: #006633;">F11</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      doSomeAdvancedStuff<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Only the first line is RAP-specific. So for a single-sourcing RWT/SWT application, you only have to care about the constant. I&#8217;m sure you have an idea how to do that. M7 will be available on May 7–easy to remember.</p>
<p><small>*) Some shortcuts may be reserved by some browsers and cannot be used. Other shortcuts will override browser actions, like Ctrl-N (new window) Ctrl-T (new tab) etc. You also may not like to disable C&amp;P in form fields by adding key bindings for Ctrl-C etc. So you have to choose your web key bindings wisely&#8230; Ah, and sequences of key strokes like Ctrl+X T are not yet supported.</small></p>
]]></content:encoded>
			<wfw:commentRss>http://eclipsesource.com/blogs/2011/04/27/key-bindings-in-rap/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>RAP 1.4 M3 supports JQuery, reduced client size</title>
		<link>http://eclipsesource.com/blogs/2010/11/13/rap-1-4-m3-supports-jquery-reduced-client-size/</link>
		<comments>http://eclipsesource.com/blogs/2010/11/13/rap-1-4-m3-supports-jquery-reduced-client-size/#comments</comments>
		<pubDate>Sat, 13 Nov 2010 18:58:55 +0000</pubDate>
		<dc:creator>Ralf Sternberg</dc:creator>
				<category><![CDATA[eclipse]]></category>
		<category><![CDATA[news]]></category>
		<category><![CDATA[syndicate]]></category>
		<category><![CDATA[indigo]]></category>
		<category><![CDATA[rap]]></category>

		<guid isPermaLink="false">http://eclipsesource.com/blogs/?p=4925</guid>
		<description><![CDATA[Another milestone build on the way to RAP 1.4 is available: RAP 1.4 M3. In this milestone, we conentrated on optimizations to the Javascript code that we deliver to the client browser. We managed to reduce the size of this code by ~8%, making RAP apps load a litte bit faster again. More optimizations will [...]]]></description>
			<content:encoded><![CDATA[<p>Another milestone build on the way to RAP 1.4 is available: <a href="http://www.eclipse.org/rap/downloads/">RAP 1.4 M3</a>.</p>
<p>In this milestone, we conentrated on optimizations to the Javascript code that we deliver to the client browser. We managed to <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=327542">reduce the size</a> of this code by ~8%, making RAP apps load a litte bit faster again. More optimizations will follow.</p>
<p>As a nice side effect of using a <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=327451">new Javascript compressor</a>, RAP does not interfere with JQuery anymore. That means that you can now <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=319964">use JQuery in your RAP applications</a>, if you like.</p>
<p>In the next milestone, scheduled for Dec 17, you can expect updated JFace and Workbench bundles as well as key bindings support.</p>
]]></content:encoded>
			<wfw:commentRss>http://eclipsesource.com/blogs/2010/11/13/rap-1-4-m3-supports-jquery-reduced-client-size/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

