blob: e8b15ce25b64653b7d11dc942439e851a03dbf8b [file] [log] [blame]
Xiaoying Gu07591712010-12-06 06:28:46 +00001<?xml version="1.0" encoding="UTF-8"?>
2<!DOCTYPE html
3 PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
4<html lang="en" xml:lang="en">
5<head>
6<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
7<meta name="copyright" content="(C) Copyright 2005"/>
8<meta name="DC.rights.owner" content="(C) Copyright 2005"/>
9<meta name="DC.Type" content="concept"/>
10<meta name="DC.Title" content="helpKey Constants Interface Class"/>
11<meta name="abstract" content="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."/>
12<meta name="description" content="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."/>
13<meta name="DC.Relation" scheme="URI" content="../../../../../projects/dtp/dtp/en/source/c_csh_ui_implementation.html"/>
14<meta name="DC.Creator" content="dresch"/>
15<meta name="DC.Format" content="XHTML"/>
16<meta name="DC.Identifier" content="concept_EA01CE3135D245F7BB30A94E130A08C7"/>
17<meta name="DC.Language" content="en"/>
18<link rel="stylesheet" type="text/css" href="../../../../../styles/commonltr.css"/>
19<link rel="stylesheet" type="text/css" href="../../../../../styles/doc.css"/>
20<title>helpKey Constants Interface Class</title>
21<meta name="provider" content="Sybase, Inc."/></head>
22<body id="concept_EA01CE3135D245F7BB30A94E130A08C7"><a name="concept_EA01CE3135D245F7BB30A94E130A08C7"><!-- --></a>
23<br/>
24
25 <h1 class="topictitle1">helpKey Constants Interface Class</h1>
26
27
28 <div><p>To reference the externalized help context IDs, which are defined in a
29 ResourceBundle properties file, UI components must implement an interface class
30 to declare the abstract helpKey constants.
31 </p>
32
33
34 <p>The following example is from the org.eclipse.datatools.connectivity.ui
35 source code.
36 </p>
37
38 <pre class="codeblock">
39 package org.eclipse.datatools.connectivity.internal.ui;
40
41 /**
42 * helpKey_constants_for_plug-in: org.eclipse.datatools.connectivity.ui
43 */
44
45 public interface IHelpConstants {
46
47 /*
48 * CONTEXT_ID_CP_PROPERTY_PAGE =
49 * Basic profile name/description/auto-connect property page
50 */
51 public static final String CONTEXT_ID_CP_PROPERTY_PAGE =
52 "CONTEXT_ID_CP_PROPERTY_PAGE"; //$NON-NLS-1$
53
54 /*
55 * CONTEXT_ID_CP_WIZARD_PAGE =
56 * wizard selection page in New Connection Profile wizard
57 */
58 public static final String CONTEXT_ID_CP_WIZARD_PAGE =
59 "CONTEXT_ID_CP_WIZARD_PAGE"; //$NON-NLS-1$
60
61 /*
62 * CONTEXT_ID_INTRO_WIZARD_PAGE =
63 * Basic intro page for new connection profile wizard
64 */
65 public static final String CONTEXT_ID_INTRO_WIZARD_PAGE =
66 "CONTEXT_ID_INTRO_WIZARD_PAGE"; //$NON-NLS-1$
67
68 ...
69 }
70</pre>
71
72 <div class="p">Notice the following features of the helpKey constants interface class:
73 <br/><a name="concept_EA01CE3135D245F7BB30A94E130A08C7__ul_4480078CAC86431AA55EEBF7FBED5262"><!-- --></a><ul id="concept_EA01CE3135D245F7BB30A94E130A08C7__ul_4480078CAC86431AA55EEBF7FBED5262">
74 <li id="concept_EA01CE3135D245F7BB30A94E130A08C7__li_0D0D7394CD174C5A9324EEA4FAF0F158"><a name="concept_EA01CE3135D245F7BB30A94E130A08C7__li_0D0D7394CD174C5A9324EEA4FAF0F158"><!-- --></a>A Javadoc comment block appears between the package and class declarations.
75 The comment identifies every UI plug-in that will use this class to pass an
76 abstract helpKey constant to the ContextProviderDelegate.</li>
77
78 <li id="concept_EA01CE3135D245F7BB30A94E130A08C7__li_AABDA2686CB5490797AF580BE4D46795"><a name="concept_EA01CE3135D245F7BB30A94E130A08C7__li_AABDA2686CB5490797AF580BE4D46795"><!-- --></a>The class declares only helpKey constants; no other constants are declared in
79 this class.</li>
80
81 <li id="concept_EA01CE3135D245F7BB30A94E130A08C7__li_584E2E0307674FE8A9543844B2389923"><a name="concept_EA01CE3135D245F7BB30A94E130A08C7__li_584E2E0307674FE8A9543844B2389923"><!-- --></a>The class declares all of the helpKey constants for at least one UI plug-in.
82
83 <div class="note"><span class="notetitle">Note:</span> The class can declare helpKey constants for more than one
84 UI plug-in, but
85 all of the helpKey constants for any one UI plug-in must be declared in only one
86 helpKey constants interface class.
87 </div>
88</li>
89
90 <li id="concept_EA01CE3135D245F7BB30A94E130A08C7__li_47160C7E02E0419795BAF17EA45AB057"><a name="concept_EA01CE3135D245F7BB30A94E130A08C7__li_47160C7E02E0419795BAF17EA45AB057"><!-- --></a>Each helpKey constant declaration should be preceded by a comment, which must
91 provide sufficient information for the Documentation team to determine the
92 location and purpose of the associated UI control.</li>
93
94 <li id="concept_EA01CE3135D245F7BB30A94E130A08C7__li_EDF5980A1F9048409BC48F3787CEAEF3"><a name="concept_EA01CE3135D245F7BB30A94E130A08C7__li_EDF5980A1F9048409BC48F3787CEAEF3"><!-- --></a>Each helpKey constant is declared as public static final String, in the form:
95 <pre class="codeblock">
96 public static final String MY_HELP_KEY = "MY_HELP_KEY";
97</pre>
98
99 where <span class="cmdname">MY_HELP_KEY</span> is the literal character string used as the helpKey constant
100 in a UI control.
101
102 <div class="note"><span class="notetitle">Note:</span> The helpKey constants should be declared as literal
103 string values only.
104 Indirect declarations (such as
105 <samp class="codeph">HELP_KEY = PREFIX + "HELP_KEY_STRING"</samp> )
106 should be avoided.
107 </div>
108</li>
109
110 <li id="concept_EA01CE3135D245F7BB30A94E130A08C7__li_E38BA334BD054F33A29E6F7A1C408E9D"><a name="concept_EA01CE3135D245F7BB30A94E130A08C7__li_E38BA334BD054F33A29E6F7A1C408E9D"><!-- --></a>The only characters allowed in a helpKey constant string are: upper case and
111 lower case letters (a-z, A-Z), numbers (0-9), and the underscore (_).
112
113 <div class="note"><span class="notetitle">Note:</span> A helpKey constant string must not appear in the format of a
114 fully-qualified help context ID. Any period (.) or blank space character will
115 cause problems, if the helpKey constant is mapped to itself (as an unqualified
116 help context ID) in the helpKey properties file.
117 </div>
118</li>
119
120 </ul>
121
122 </div>
123
124 </div>
125
126<div>
127<div class="familylinks">
128<div class="parentlink"><strong>Parent topic:</strong> <a href="../../../../../projects/dtp/dtp/en/source/c_csh_ui_implementation.html" title="Java code examples of dynamic help context implementation in a view and a dialog, with context abstraction, are from the Eclipse Data Tools Platform (DTP) 1.6 source code.">Context-Sensitive Help UI Implementation</a></div>
129</div>
130</div>
131<div/>
132</body>
133</html>