Cédric Bosdonnat - Eclipsehttps://bosdonnat.fr/2008-05-14T22:16:00+02:00A geek's perspectiveEclipse RCP and AJAX2008-05-14T22:16:00+02:002008-05-14T22:16:00+02:00Cédric Bosdonnattag:bosdonnat.fr,2008-05-14:/eclipse-rcp-and-ajax.html<p>Some time ago, I've discovered an Eclipse project which sounds
interesting to me. This project aims at providing an AJAX runtime target
for Eclipse RCP applications. I didn't have more time but to play a
little with the public demos. Thus I still wondered what is the gap for
an …</p><p>Some time ago, I've discovered an Eclipse project which sounds
interesting to me. This project aims at providing an AJAX runtime target
for Eclipse RCP applications. I didn't have more time but to play a
little with the public demos. Thus I still wondered what is the gap for
an Eclipse RCP applications developper before starting to create a RAP
application.</p>
<p>Today I had some time to have a look at the sources of a RAP application
project. There is quite nothing more to do if you are already
programming Eclipse RCP applications as the differences are:</p>
<ul>
<li>Adding the <code>org.eclipse.rap.ui</code> plugin to the dependencies.</li>
<li>Importing the <code>javax.servlet</code> and <code>javax.servlet.http</code> packages</li>
<li>Add an <code>org.eclipse.rap.ui.entrypoint</code> extension to define the RAP
application entry point</li>
</ul>
<p>To internationalization of a RAP application works also differently from
the standard Eclipse internationalization. This is described in the RAP
on-line help: internationalizing a RAP application shouldn't be a huge
problem.</p>
<p>A RAP application can even be packaged in a WAR file as any other web
application. There is no wizard to perform this, but a sample Eclipse
feature projects with Ant build scripts are available on the Eclipse
CVS. There is also generic Equinox documentation on that topic at
<a href="http://www.eclipse.org/equinox/server/http_in_container.php">http://www.eclipse.org/equinox/server/http_in_container.php</a>.</p>
<p>Thus creating a standard Web application by using the JFace and SWT APIs
is quite easy. When combined with <a href="http://www.springframework.org/osgi">Spring-OSGi</a>, let us imagine
creating powerful and sexy Web applications.</p>
<p>The only thing I still would like to see before being a RAP fan is a
benchmark of an application used by hundreds or thousands of users. Does
it make a difference with toolkits like <a href="http://code.google.com/webtoolkit/">GWT</a> or <a href="http://developer.yahoo.com/yui/">YUI</a>? Can I use
RAP for business applications used every day by a whole company? </p>The Gecko and the Gull2007-05-04T08:22:00+02:002007-05-04T08:22:00+02:00Cédric Bosdonnattag:bosdonnat.fr,2007-05-04:/the-gecko-and-the-gull.html<p>Is it a unknown fable from La Fontaine? Not really, in fact it
has more to do about OpenOffice.org and Mozilla. I was trying to tamper
with some web pages and I wanted to check whether we could integrate
easily a small web-browser inside OpenOffice.org.</p>
<p>Hopefully, there is …</p><p>Is it a unknown fable from La Fontaine? Not really, in fact it
has more to do about OpenOffice.org and Mozilla. I was trying to tamper
with some web pages and I wanted to check whether we could integrate
easily a small web-browser inside OpenOffice.org.</p>
<p>Hopefully, there is an interesting feature coming up with Eclipse 3.3
which helps a lot: <a href="http://download.eclipse.org/eclipse/downloads/drops/S-3.3M6-200703231616/eclipse-news-M6.html">SWT provides the ability to create a Browser</a>
composite which runs the <a href="http://en.wikipedia.org/wiki/XULRunner">xulrunner</a> (<a href="ftp://ftp.mozilla.org/pub/mozilla.org/xulrunner/releases/1.8.1.3/contrib/">downloads</a>). This means that
we could perfectly imagine a small Java extension to OpenOffice.org
which provides a UNO service to show any XUL or HTML page.</p>
<p>Here is a small snippet I created to test this on windows:</p>
<div class="highlight"><pre><span></span><code><span class="n">Display</span> <span class="n">display</span> <span class="o">=</span> <span class="n">Display</span><span class="p">.</span><span class="na">getDefault</span><span class="p">();</span>
<span class="kd">final</span> <span class="n">Shell</span> <span class="n">shell</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Shell</span><span class="p">(</span><span class="n">display</span><span class="p">);</span>
<span class="n">shell</span><span class="p">.</span><span class="na">setText</span><span class="p">(</span><span class="s">"My OOo Browser"</span><span class="p">);</span>
<span class="n">shell</span><span class="p">.</span><span class="na">setSize</span><span class="p">(</span><span class="mi">400</span><span class="p">,</span> <span class="mi">300</span><span class="p">);</span>
<span class="n">shell</span><span class="p">.</span><span class="na">setLayout</span><span class="p">(</span><span class="k">new</span> <span class="n">GridLayout</span><span class="p">());</span>
<span class="n">System</span><span class="p">.</span><span class="na">setProperty</span><span class="p">(</span><span class="s">"org.eclipse.swt.browser.XULRunnerPath"</span><span class="p">,</span>
<span class="s">"C:\\Documents and Settings\\Cbosdonnat\\Mes documents\\xulrunner"</span><span class="p">);</span>
<span class="n">Browser</span> <span class="n">browser</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Browser</span><span class="p">(</span><span class="n">shell</span><span class="p">,</span> <span class="n">SWT</span><span class="p">.</span><span class="na">MOZILLA</span><span class="p">);</span>
<span class="n">browser</span><span class="p">.</span><span class="na">setLayoutData</span><span class="p">(</span><span class="k">new</span> <span class="n">GridData</span><span class="p">(</span><span class="n">GridData</span><span class="p">.</span><span class="na">FILL_BOTH</span><span class="p">));</span>
<span class="n">browser</span><span class="p">.</span><span class="na">setUrl</span><span class="p">(</span><span class="s">"http://fr.openoffice.org"</span><span class="p">);</span>
<span class="n">shell</span><span class="p">.</span><span class="na">open</span><span class="p">();</span>
<span class="k">while</span> <span class="p">(</span><span class="o">!</span><span class="n">shell</span><span class="p">.</span><span class="na">isDisposed</span> <span class="p">())</span> <span class="p">{</span>
<span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="n">display</span><span class="p">.</span><span class="na">readAndDispatch</span> <span class="p">())</span> <span class="n">display</span><span class="p">.</span><span class="na">sleep</span> <span class="p">();</span>
<span class="p">}</span>
<span class="n">display</span><span class="p">.</span><span class="na">dispose</span> <span class="p">();</span>
</code></pre></div>
<p>I let you imagine the kind of interesting applications we could do using
this... Of course the same principle is working on Linux and I would
like to test it on MacOS, but I let you translate the above code for
it. </p>