Using Eclipse Ganymede to Develop for the Desktop, Web and Mobile

Using Eclipse Ganymede to Develop for the Desktop, Web and Mobile

Using Eclipse Ganymede to develop for the desktop, Web and mobile devices, Part 2: Developing for the Rich Client Platform, the Ganymede way RAP: The new way to the Web Skill Level: Intermediate Suresh Krishna ([email protected]) Software Developer Freelance Developer Trebor Fenstermaker ([email protected]) Software Consultant Sunnyside Avenue Software, LLC 09 Sep 2008 The Ganymede release of the Eclipse IDE includes 24 separate projects, covering a wide range of technologies. Many of these projects are mature, and this release provides incremental improvements to those. But Ganymede also includes a number of new projects that introduce new technologies to the Eclipse platform. In this three-part "Using Eclipse Ganymede to develop for the desktop, Web and mobile devices" tutorial series, we will cover the following new Ganymede features: RCP, RAP, and eRCP, which allow you to develop software for the desktop, Web, and mobile platforms, respectively, with one common code base; Subversion for version control; and p2 for update and installation. Here in Part 2, we will take the personal organizer developed in Part 1 and modify it to use the new Rich Ajax Platform (RAP) to package and distribute the application on the Web. Section 1. Before you start Developing for the Rich Client Platform, the Ganymede way © Copyright IBM Corporation 1994, 2008. All rights reserved. Page 1 of 57 developerWorks® ibm.com/developerWorks This tutorial is for any Eclipse developer who wants to learn how to take code written using the mature Rich Client Platform (RCP) and modify it to use the new Rich Ajax Platform (RAP) to allow for a rich-client experience distributed over the Web. You should have an understanding of the Eclipse platform and some familiarity with the idea of Rich Internet Applications (RIAs). Also, you should have knowledge of how to configure a servlet container and deploy applications on it. About this series Part 1 provides an introduction to the new features of the RCP, the new Subversion Eclipse integration, and the p2 packaging and distribution system. Part 2 introduces the Rich Ajax Platform (RAP) to write applications for the Web. And Part 3 discusses how to use the embedded Rich Client Platform (eRCP) to develop an application for a mobile device. About this tutorial The Ganymede release of the Eclipse IDE bundles more than 20 new and existing projects under the Eclipse umbrella. In Part 1 of this three-part series, you looked at some features added to make development easier, including support for Subversion and a new distribution model for plug-ins called p2. You also saw some incremental improvements in the mature Rich Client Platform (RCP) by developing a simple personal task organizer plug-in application, then storing it in Subversion and deploying it via p2. Another exciting addition to Ganymede is the inclusion of the Rich Application Platform (RAP). RAP is a way to build rich client applications — stateful GUI applications similar to those developed for a desktop — and deploy them for use on the Web. RAP brings the Eclipse programming model to the Web, allowing you to reuse much of your existing RCP code when building RAP-based applications. This is done using Ajax, but Eclipse makes it simple to build on the knowledge you already have of developing desktop applications with the RCP. To demonstrate, you will modify the personal organizer developed in Part 1 to use RAP. Topics include: • How to download and install the RAP environment to Eclipse • How to migrate your existing RCP code to RAP • How to factor your code for the Web • How to package and deploy your code to a Web server Developing for the Rich Client Platform, the Ganymede way Page 2 of 57 © Copyright IBM Corporation 1994, 2008. All rights reserved. ibm.com/developerWorks developerWorks® System requirements Eclipse Ganymede Find Eclipse Ganymede at the Eclipse Foundation. Java 2 Standard Edition The Java™ 2 Standard Edition V5 or greater is available from Sun Microsystems. Eclipse RAP The Eclipse RAP plug-in is available in the Eclipse Foundation RAP section at Eclipse.org. Apache Tomcat For deploying the finished RAP application to a stand-alone servlet container, this tutorial uses Apache Tomcat. Download the latest stable version. Section 2. Getting started with RAP Before you can start developing with RAP, you need to download it from the Eclipse Web site and set up your target platform to use it. Developing with RAP RAP allows you to build Ajax-enabled Web applications using the Eclipse development model. If you're already familiar with developing desktop applications with the Eclipse RCP, you have the expertise to develop with RAP. In fact, much of the code written for an RCP application can be reused for RAP. This means you can use the full power of Java technology and the Eclipse APIs to develop Web-based applications. Your users can then experience a full GUI application with no page refreshes, like a typical Web application, but they can do so without having to download and install your application on their desktop. RAP achieves this by providing a special implementation of the Standard Widget Toolkit (SWT), JFace, and Workbench, and, as such, is actually a subset of RCP. Because the base architecture of the RCP and RAP are similar (see Figure 1), plug-in reuse is possible with minimal changes in the source code. RAP applications are accessed via standard browsers in the same way RCP applications are executed on the desktop environment. This is achieved by the RAP Widget Toolkit (RWT), a replacement for SWT used in RCP. Developing for the Rich Client Platform, the Ganymede way © Copyright IBM Corporation 1994, 2008. All rights reserved. Page 3 of 57 developerWorks® ibm.com/developerWorks Browser-side widget rendering is done with the qooxdoo Ajax library (see Resources). qooxdoo is a comprehensive Ajax framework leveraging the object-oriented JavaScript that enables users to build cross-browser applications. RAP abstracts the details about the JavaScript, allowing you to work with the Java APIs to build the Rich Internet Applications (RIAs). Custom widget developers need to have JavaScript, qooxdoo, and RAP knowledge. Client-side development allows for the embedding of client-side technologies like other JavaScript frameworks, Flash, and applets. Figure 1. Comparing RAP and RCP architectures Downloading RAP Because RAP is an RCP subset, it cannot co-exist in the same Eclipse instance as RCP; you must download and install the RAP environment for Eclipse separately. Point your browser to www.eclipse.org/rap/downloads (see Figure 2). Note: If you would like to migrate the RCP source code to RAP, a target platform download for RAP is recommended. This enables the existing RCP code to get compiled and run against the target RAP code. If you intend to develop new Web applications using RAP and would like to have the development platform, it's recommended to get the RAP SDK from the p2 update mechanism, covered in Part 1. Figure 2. The Eclipse RAP home page Developing for the Rich Client Platform, the Ganymede way Page 4 of 57 © Copyright IBM Corporation 1994, 2008. All rights reserved. ibm.com/developerWorks developerWorks® Select the V1.1rRelease with the words "target platform" in the filename and choose an appropriate mirror. Figure 3. The Eclipse RAP download page Download the ZIP file to a temporary directory on your local hard drive, one that is accessible to your Eclipse installation. Once transferred, unzip it in that temp Developing for the Rich Client Platform, the Ganymede way © Copyright IBM Corporation 1994, 2008. All rights reserved. Page 5 of 57 developerWorks® ibm.com/developerWorks directory. Open your instance of Eclipse Ganymede and ensure that your workspace points to where you've stored the personal-organizer project from Part 1, then open your Eclipse desktop to the plug-in development perspective. Open the Preferences panel for Eclipse. How you do this depends on your operating system — for example, on Windows®, it's Window > Preferences (see Figure 4); on Mac OS X, it's Eclipse > Preferences). Navigate to Plug-in Development > Target Platform. Figure 4. Specifying the target platform Change the value of the location box to the directory where you unzipped the download and click Reload. Figure 5. Making the target platform RAP Developing for the Rich Client Platform, the Ganymede way Page 6 of 57 © Copyright IBM Corporation 1994, 2008. All rights reserved. ibm.com/developerWorks developerWorks® This will load the plug-ins associated with the RAP and switch your target platform from the RCP. You're ready to start making the changes to the personal organizer to take advantage of RAP, which you'll do in the next section. Section 3. Moving from RCP to RAP Follow along to see how to migrate the personal-organizer example from RCP to RAP. And along the way, get a feel for some of the differences between the two environments. Follow the errors to spot the differences You may notice that since you've switched target platforms, Eclipse is complaining Developing for the Rich Client Platform, the Ganymede way © Copyright IBM Corporation 1994, 2008. All rights reserved. Page 7 of 57 developerWorks® ibm.com/developerWorks there are errors in your personal task-organizer code. Figure 6. Compiler errors for the personal organizer after switching to RAP One reason for this is because your existing project was meant to use RCP, but by switching targets, the plug-ins used to resolve some of the elements used in the personal organizer are now missing from your build path. Some of these have equivalents in RAP, but some do not. So you will have to do a few small modifications to get things to compile.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    57 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us