站内搜索: 请输入搜索关键词
当前页面: 图书首页 > Eclipse Rich Client Platform: Designing, Coding, and Packaging Java Applications

Section 3.4.  Target Setup - Eclipse Rich Client Platform: Designing, Coding, and Packaging Java Applications

Previous Page
Next Page

3.4. Target Setup

Before starting development, you have one more thing to install, the target. The target is the set of plug-ins on which your application is based, that is, everything except the plug-ins you are writing.

A good starting point for the target is the Eclipse RCP SDK for the latest release. This is the fundamental set of 11 or so plug-ins that forms the basis of most Eclipse RCP-based applications. It includes OSGi, the Runtime, SWT, JFace, and the UI Workbench framework.

As with the Eclipse SDK, the CD that comes with this book includes a set of target archives. You can use these or go back to the Eclipse downloads site for the latest release. On the main downloads site click the link called "Other downloads for 3.1" and on the next page there is a section labeled Eclipse RCP SDK. Download the file that matches your machine's OS, window system, and processor architecture. The download is a zip or tar.gz with a name similar to:

eclipse-RCP-SDK-3.1-win32.zip

Once the file is available, expand it in a convenient location, say c:\target. At this point you have the development environment installed and running, the target is installed, and all that is left is to hook them together.

Note

When developing Eclipse RCP-based products, it is best to ignore the fact that you are using Eclipse to do the work. Be sure to separate the Eclipse you are using as your development environment (the IDE Eclipse) and the Eclipse environment you are buildingyour target Eclipse. Keeping these separate allows you to add and remove plug-ins from one without affecting the other. It also allows you to replace your IDE independent of your target (and vice versa).

This approach adds a little bit of complexity to the initial setup but makes life much easier down the road by eliminating accidental references to code that will not be on your user's machine.


The target platform is defined by setting a preference (Window > Preferences). Go to the Plug-in Development > Target Platform preference page and use the Browse... button or type in the Location field to set the target location to c:\target\eclipse and click Reload. You should see a setup similar to Figure 3-2.

Figure 3-2. Defining a target platform


Notice that all of the plug-ins you just downloaded and installed as the target appear in the plug-in list. You can come back to this page anytime and add or remove plug-ins to the target. Deselecting the check boxes filters out plug-ins that are not relevant to your ultimate execution environment, that is, just because a plug-in is in the target location does not mean you need it or want it to run. For example, you could be working on a Linux machine but writing code intended to run on Windows.

Under the covers

The PDE included with the Eclipse SDK provides sophisticated support for the development of plug-ins, RCP applications, and products. One of the PDE's primary jobs is to build and maintain a model of the world you are creating. This model consists of two groups of plug-ins: the ones from your workspace (i.e., the ones you are actively writing) and the ones in your target definition (i.e., the ones you are simply using). You add to the workspace by creating plug-in projects. You add to the target platform through the PDE preference pages as described here.


In addition to defining a set of plug-ins, the target also defines the environment and JRE for which you are building. You might be using JDK 1.4.2 to run your IDE, but targeting the J2ME Foundation class libraries. The Target Platform preference pages allow you to configure these characteristics.


Previous Page
Next Page