RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX


Eclipse RCP Meets Spring: A Perfect Thick-Client Match

Eclipse Rich Client Platform (RCP) is fast becoming the framework of choice for building thick client applications. Get a step-by-step guide to leveraging Eclipse RCP with Spring.

ven though Web 2.0 and rich Internet applications (RIAs) are all the rage these days, building a rich Web front end for your stakeholders is not the answer when thick-client functionality is what you really need. I stated as much in my previous article, "Building a Java App Server Foundation for Thick-Client Deployment," which showed how to leverage a traditional Java Web server architecture to easily deploy thick clients.

But if you indeed eschew the RIA craze and opt for a practical thick-client solution, where do you go from here? Answer: You choose a Rich Client Platform (RCP) that will handle much of the work for you. Essentially, the RCP concept brings a framework to the world of Java desktop applications. The J2EE/Java EE world has long had the luxury of frameworks on which to standardize its best practices (see Spring, Struts, WebWork, etc.). Now, the Java desktop world is benefiting from that experience.

A RCP provides a skeleton/shell of an application, along with a module-based API that enables you to build your own application on top of this shell. The RCP does all the plumbing, such as creating a good design for adding menus, toolbars, different views, etc., so you don't have to reinvent the wheel. After all, why roll your own framework when you don't have to?

This article takes you step by step through building a thick client interface to connect to the server built in the previous article. You will build the thick client on top of the Eclipse Rich Client Platform and then integrate Eclipse RCP with Spring.

What You Need
Eclipse 3.1.2
MyEclipse 4.1.1
Java SE 5 (and a working knowledge thereof)
A Servlet Container or J2EE server (This tutorial uses Tomcat 5.5+)
Spring 1.2+ (and a working knowledge thereof)
The source code for the example

So Why Eclipse RCP?

Well, in case you are new to Java or have been asleep for a very long time, the popularity of Eclipse is at an all time high. While popularity alone doesn't guarantee success, millions of users, a very active community, a strong reputation, and the backing of IBM can't hurt. Additionally, with a number of applications continually being built on top of Eclipse RCP, it's fairly safe to assume that it's been tested far more extensively than any hand-rolled framework.

So let's get started then.

Create a New Eclipse Plug-In Project
Take the following steps to create a new Eclipse plug-in project for your rich client application:
  1. Create a new Plug-in project in Eclipse. Name the project EclipseTradeClient. Target this plug-in for Eclipse version 3.1, and make sure that Create an OSGi bundle manifest is checked (see Figure 1). Click Next.

    Click to enlarge

    Figure 1. New Plug-in Project
  2. On the Plug-in Content screen, keep the defaults but make sure to choose Yes, you would like to create a rich client application (see Figure 2). Click Next.

    Click to enlarge

    Figure 2. Choose to Create a Rich Client Application
  3. For templates, select RCP application with a view, and click Next.
  4. Fill in the RCP Application properties shown in Figure 3 and click Finish. You will be prompted to go to the Plug-in Development perspective. Click Yes.

    Click to enlarge

    Figure 3. Final Screen of the RCP Plug-In Project Wizard
  5. You have now created your project. Open plugin.xml, if you haven't already. You will see the screen shown in Figure 4.

    Click to enlarge

    Figure 4. Overview of Plugin.XML

    If you are new to Eclipse plug-ins, you'll find that you use the bottom tabs of plugin.xml frequently. As you can see from the Overview tab, you can run/debug your Eclipse rich client application.

  6. Expand the EclipseTradeClient/src/eclipseTradeClient package to look at the classes that Eclipse's RCP wizard created for you. In the Eclipse editor, click the All Extensions tab and expand each of the top-level nodes like Figure 5.

    Click to enlarge

    Figure 5. Eclipse-Generated Classes and All Extensions

    Notice the extension entries for your Application class, Perspective class, and View class. Since Eclipse's Rich Client Platform revolves around the plugin.xml file, you can add new components simply by adding them through the Extensions tab -> Add... button. (See Sidebar 2. Eclipse-Generated Classes for a listing of the classes Eclipse provides for you.)

Close Icon
Thanks for your registration, follow us on our social networks to keep up-to-date