Eclipse Rich-Client Platform (RCP) provides a highly flexible and functionally rich framework for rich clients. One drawback, however, is that it is not easy to link the business objects in RCP applications from other sources. It would be helpful if a user could click a link in another application and take it to an RCP application and have opened the business object referenced by the link. For example, suppose you have an RCP application for processing fee requests. Reports about overdue payments may be generated and published as spreadsheets (either on the intranet or as rich text documents, or as e-mail messages, or other forms, etc.). The report may use a reference number for each expiration request. Instead of forcing the user to copy and paste the reference number into the RCP application's Search dialog box, the report includes a hyperlink URL that launches the RCP application, which directs users directly to the corresponding fee request. This article explains how to do the above process.
Readers should have the experience of writing Eclipse Plug-ins, as well as the general knowledge of Windows® Registry and TCP protocols. Although the examples provided in this article are for Windows operating systems, the same functionality can be implemented in other operating systems.
Solution Overview
Let's look at how the solution works on a holistic basis, and then subdivide and discuss how to implement each section.
Follow the process in Figure 1:
Assume that the user has opened the RCP application on the desktop.
Then assume that the user receives an e-mail message in his common mail client that contains the link rcp://claim=25222-This is a reference to the expired request (1).
The user clicks the link, which launches the user's default browser to process the request (2).
The browser knows that it cannot open this URL on the computer, so it will query the Windows registry to determine how the operation should be delegated (3).
The registry looks for the RCP://protocol and determines that there is a batch file (4) that is bound to it.
This batch file is executed (5), which triggers a stand-alone Java™ client (6), captures the parameters of the URL, and therefore emits a local TCP call (7) to the TCP server embedded in the RCP application.
The TCP server resolves the parameters from the URL (that is, claim=25222) and requests the RCP application to open the appropriate business object (8).
The requested business object (9) is then presented to the user in the RCP application UI.
Figure 1. To open the process control for an RCP application using a URL
There are many steps involved in this process, but fortunately, each step is relatively simple and can be tailored to your environment and your application. The last few steps will help you figure out how to get the RCP application to gain the details of Windows focus.