To reference the externalized help context IDs, which are defined in a
ResourceBundle properties file, UI components must implement an interface class
to declare the abstract helpKey constants.
The following example is from the org.eclipse.datatools.connectivity.ui
source code.
package org.eclipse.datatools.connectivity.internal.ui;
/**
* helpKey_constants_for_plug-in: org.eclipse.datatools.connectivity.ui
*/
public interface IHelpConstants {
/*
* CONTEXT_ID_CP_PROPERTY_PAGE =
* Basic profile name/description/auto-connect property page
*/
public static final String CONTEXT_ID_CP_PROPERTY_PAGE =
"CONTEXT_ID_CP_PROPERTY_PAGE"; //$NON-NLS-1$
/*
* CONTEXT_ID_CP_WIZARD_PAGE =
* wizard selection page in New Connection Profile wizard
*/
public static final String CONTEXT_ID_CP_WIZARD_PAGE =
"CONTEXT_ID_CP_WIZARD_PAGE"; //$NON-NLS-1$
/*
* CONTEXT_ID_INTRO_WIZARD_PAGE =
* Basic intro page for new connection profile wizard
*/
public static final String CONTEXT_ID_INTRO_WIZARD_PAGE =
"CONTEXT_ID_INTRO_WIZARD_PAGE"; //$NON-NLS-1$
...
}
Notice the following features of the helpKey constants interface class:
- A Javadoc comment block appears between the package and class declarations.
The comment identifies every UI plug-in that will use this class to pass an
abstract helpKey constant to the ContextProviderDelegate.
- The class declares only helpKey constants; no other constants are declared in
this class.
- The class declares all of the helpKey constants for at least one UI plug-in.
Note: The class can declare helpKey constants for more than one
UI plug-in, but
all of the helpKey constants for any one UI plug-in must be declared in only one
helpKey constants interface class.
- Each helpKey constant declaration should be preceded by a comment, which must
provide sufficient information for the Documentation team to determine the
location and purpose of the associated UI control.
- Each helpKey constant is declared as public static final String, in the form:
public static final String MY_HELP_KEY = "MY_HELP_KEY";
where MY_HELP_KEY is the literal character string used as the helpKey constant
in a UI control.
Note: The helpKey constants should be declared as literal
string values only.
Indirect declarations (such as
HELP_KEY = PREFIX + "HELP_KEY_STRING" )
should be avoided.
- The only characters allowed in a helpKey constant string are: upper case and
lower case letters (a-z, A-Z), numbers (0-9), and the underscore (_).
Note: A helpKey constant string must not appear in the format of a
fully-qualified help context ID. Any period (.) or blank space character will
cause problems, if the helpKey constant is mapped to itself (as an unqualified
help context ID) in the helpKey properties file.