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

Section 8.5.  About Information - Eclipse Rich Client Platform: Designing, Coding, and Packaging Java Applications

Previous Page
Next Page

8.5. About Information

Most applications have an About dialog that reports product version, license, and copyright information to the user. The Eclipse Workbench includes a standard dialog that presents this information and gives users access to configuration information that is useful if they need to report problems. You are, of course, free to ignore this dialog and write your own. If you want to use the standard About dialog, read on.

8.5.1. Product About Information

The About action, accessed via Help > About Hyperbola, was added to Hyperbola in Chapter 6, "Adding Actions," but the About dialog is currently empty. Let's add branding information to update the dialog, as shown in Figure 8-11.

Figure 8-11. Hyperbola About dialog


The standard About dialog is branded by supplying an about image and some about text. The about image is the graphic shown down the left side of the dialog. This image can be anything you want, but it should be in GIF format. If the image is smaller than 250x330 pixels, then the about text is shown at the right of the image in the dialog, as in Figure 8-11. If the image is larger, the about text is not shown and the image fills the entire top portion of the dialog. In any event, the image should be less than 500x330 pixels.

The branded about image and text are defined in the About Dialog section of the Branding page in the product editor, as shown in Figure 8-12. Notice that the about text has a value of %aboutText. You could put real text here. Using %aboutText indicates to Eclipse that the value is human-readable and the real text can be found in the plugin.properties file associated with the product plug-in. This allows the text to be adjusted to suit different locales. Create a plugin.properties file at the root of org.eclipsercp.hyperbola and add the following content:

org.eclipsercp.hyperbola/plugin.properties
aboutText=\n\nHyperbola Chat Client (Workbench)\n\
Version: 1.0.0\n\n\
Hyperbola is an RCP application developed for the book \n\
\tEclipse Rich Client Platform \n\
\t\tDesigning, Coding, and Packaging Java Applications \n\
\n\
(c) Copyright Jeff McAffer and Jean-Michel Lemieux 2005. \
All Rights Reserved.\n

Figure 8-12. Defining About dialog branding


Specializing the About text

Typical About information includes the version number of the product and perhaps even the build number or date. Redefining the About text for every build across all translations is challenging. Rather than forcing such values to be embedded in the text, the standard Eclipse About dialog does variable substitution in the About text string.

The About text is treated as a java.text.MessageFormat template, where values are supplied by the properties file called about.mappings in the product's plug-in. For example, change the Hyperbola aboutText shown in this section to be

          Version: {0}\n\n\

and then add an about.mappings file in the Hyperbola product plug-in with the following line:

          0=1.0.0

The net result is that the About dialog shows

          "Hyperbola Version 1.0.0"

To move to the next version of Hyperbola, you only need to update the value of the key '0' in about.mappings. The downside to this approach is that the mapped values cannot be translated.


As one final check, run Hyperbola and open the About dialog. Don't forget to synchronize. Click on the Plug-in Details button. There should be a collection of Eclipse plug-ins and a single Hyperbola plug-in. Notice that our plug-in does not have a provider. Open the plug-in editor for Hyperbola by double-clicking on the plugin.xml file. On the Overview page, enter "eclipsercp.org" in the Provider field. Now re-run and check the plug-in details page.

8.5.2. Plug-in About Information

You may have noticed a More Info button at the bottom left of the plug-in details dialog. When you select a plug-in and click More Info, you are shown the contents of the about.html file in the root of the plug-in. Typically, this contains detailed licensing information about the plug-in, but since it is a standard HTML page, it can present anything you like.

Note

If your plug-in is shipped as a JAR file and the about.html references other pages in the plug-in, the additional pages must be in a directory called about_files at the root of the plug-in. This is required because Eclipse extracts the files from the JAR before presenting the root file in the Web browserbrowsers typically cannot see inside JARs.



Previous Page
Next Page