rich client 2.0

Developing Data Centric RCP Applications Part IV – Reuse of IDE features


13. March 2008
Tom Seidel @ 18:58

Let’s see, has anybody ever delved into what RCP application actually means? In most cases you might find a rather cut-down definition reduced to its Components. This impression is bolstered by the naming conventions of Eclipse Bundles and Features, for instance Eclipse SDK ships with a feature named org.eclipse.rcp, suggesting that it serves to define the RCP’s scope. Defining the RCP by means of the installed bundles simply goes beyond my understanding. Personally, I think the graphic in the Eclipse help pages is better for demonstrating the Eclipse Component Model. In my opinion there is no difference in quality between an Eclipse SDK application and an Eclipse RCP Mail Template application. These components, specifically the Workspace model and the features that come with the org.eclipse.ui.ide package (whatever the Id is meant to imply ;-) , can easily be integrated in a more ‘minimalist’ RCP application. When you are dealing with larger business applications, there is simply no way you can avoid using these Eclipse Platform or Eclipse Tools bundles. This seems a good time to demonstrate how to put these components to work for you in a context that is completely different from the usual JDT environment.

Installing the Workspace Model

As already mentioned in my last posting we are building an application that uses OSGi bundles to distribute information, i.e. read-only information. The requirement in most cases, however, is to be able to supplement this information. Our example application allows users to append further documents to an information unit defined by an Extension Point. These are saved to the workspace and linked to the information units using the Eclipse Adapter mechanism.

These are the revelant points to consider here:

  1. Finished implementations of file operations and their integration in the Eclipse Framework
  2. Support for asynchronity and parallelism
  3. Listener for file operations, project builder
  4. EFS support for alternative file systems
part4_adapter.png
Data model and adaption to Workspace model

Markers

Markers are useful extensions that come in handy to persistently associate meta data with resources, such as files contained in the Workspace. You can find this feature in the org.eclipse.ui.ide plugin. Markers are even more helpful when it comes to storing meta data that cannot be represented in the EMF model. In our example application, markers are created while we overwrite attached documents, and these markers are mapped to the pertaining data model and displayed.
Decorators are used to superimpose the markers on the rendered objects of item providers generated by EMF Edit. The only drawback is that in addition to the EMF notification mechanism, you also have to implement an IResourceChangeListener, which updates the revelant model object in the viewer when the marker is created.

part4_marker.png
EMF data are mapped to resources and markers (visualized with a tooltip)

These markers don’t differ from the more common markers such as the compilation warning marker – as you may see if you compare them with those in the Warning View that Eclipse SDK developers are familiar with.

part4_warnings.png
Warning View: Often seen in the Eclipse SDK

More Contributions

Another great advantage is that other typical platform plugins can contribute functions by registering the Adapter functions in the context of my application-specific object. A typical example is the org.eclipse.compare plugin which makes available application-specific EMF generated data objects for the adapted objects via a context menu.

part4_contribution.png
Context menu for contributions from other bundles

This contribution of additional function by other plugins – a major attribute of the Eclipse platform – can clearly spoil the desired effect in reduced user interfaces. Essentially, you might have bundles contributing entries, which you want to suppress. How to implement this function interception by writing so-called Transformer Hooks will be explained in a later posting.

Outlook

In my next posting I will be primarily taking a closer look at data management at runtime. A prominent issue will be the synchronization of online data that cannot be distributed as OSGi packages. I will also talk about the Update Manager and – server-side - Extensions. By the way, feedback about the points mentioned here is always more than welcome.

Download

Download the CVS Team Project-Set

4 Comments »

  1. Tom let me say that this is one of the greatest tutorials for RCP I’ve ever read. Did you thought about proposing your source code to EEP?

    Comment by Tom Schindl — 14. March 2008 @ 12:18

  2. Thank you very much Tom. In general I would be glad if there is a request for EEP. The code is still in a very early stage, I have to cleanup many things. I’ll post a message to the EEP Newsgroup if I have finished this series.

    Comment by Tom Seidel — 15. March 2008 @ 00:33

  3. Hi Tom!

    Great tutorial indeed, but what Eclipse version are you using to develop it? I’ve tryed with the Eclipse RCP and Eclipse J2EE packages and have lots of errors about “org.eclipse.ui.internal.ide.xxxx” packages.

    Can you tell me what Eclipse package is needed (and extra packages if needed)

    Thanks

    Comment by haxier — 30. April 2008 @ 23:30

  4. Haxier,

    The source was written with 3.4M5, didn’t test it with 3.3 or 3.4M6. I’ll test it in the next days with M6. All you need is RCP, EMF (plus EMFQuery).

    Cheerz

    Comment by Tom Seidel — 30. April 2008 @ 23:41

RSS feed for comments on this post. TrackBack URI

Leave a comment

Powered by WordPress