KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jface > bindings > keys > IKeyLookup


1 /*******************************************************************************
2  * Copyright (c) 2005 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.jface.bindings.keys;
12
13 /**
14  * <p>
15  * A facilitiy for converting the formal representation for key strokes
16  * (i.e., used in persistence) into real key stroke instances.
17  * </p>
18  *
19  * @since 3.1
20  */

21 public interface IKeyLookup {
22     /**
23      * The formal name of the 'Alt' key.
24      */

25     public static final String JavaDoc ALT_NAME = "ALT"; //$NON-NLS-1$
26

27     /**
28      * The formal name of the 'Arrow Down' key.
29      */

30     public static final String JavaDoc ARROW_DOWN_NAME = "ARROW_DOWN"; //$NON-NLS-1$
31

32     /**
33      * The formal name of the 'Arrow Left' key.
34      */

35     public static final String JavaDoc ARROW_LEFT_NAME = "ARROW_LEFT"; //$NON-NLS-1$
36

37     /**
38      * The formal name of the 'Arrow Right' key.
39      */

40     public static final String JavaDoc ARROW_RIGHT_NAME = "ARROW_RIGHT"; //$NON-NLS-1$
41

42     /**
43      * The formal name of the 'Arrow Up' key.
44      */

45     public static final String JavaDoc ARROW_UP_NAME = "ARROW_UP"; //$NON-NLS-1$
46

47     /**
48      * An alternate name for the backspace key.
49      */

50     public static final String JavaDoc BACKSPACE_NAME = "BACKSPACE"; //$NON-NLS-1$
51

52     /**
53      * The formal name for the 'Break' key.
54      */

55     public static final String JavaDoc BREAK_NAME = "BREAK"; //$NON-NLS-1$
56

57     /**
58      * The formal name of the backspace key.
59      */

60     public static final String JavaDoc BS_NAME = "BS"; //$NON-NLS-1$
61

62     /**
63      * The formal name for the 'Caps Lock' key.
64      */

65     public static final String JavaDoc CAPS_LOCK_NAME = "CAPS_LOCK"; //$NON-NLS-1$
66

67     /**
68      * The formal name of the 'Command' key.
69      */

70     public static final String JavaDoc COMMAND_NAME = "COMMAND"; //$NON-NLS-1$
71

72     /**
73      * The formal name of the carriage return (U+000D)
74      */

75     public static final String JavaDoc CR_NAME = "CR"; //$NON-NLS-1$
76

77     /**
78      * The formal name of the 'Ctrl' key.
79      */

80     public static final String JavaDoc CTRL_NAME = "CTRL"; //$NON-NLS-1$
81

82     /**
83      * The formal name of the delete (U+007F) key
84      */

85     public static final String JavaDoc DEL_NAME = "DEL"; //$NON-NLS-1$
86

87     /**
88      * An alternative name for the delete key.
89      */

90     public static final String JavaDoc DELETE_NAME = "DELETE"; //$NON-NLS-1$
91

92     /**
93      * The formal name of the 'End' key.
94      */

95     public static final String JavaDoc END_NAME = "END"; //$NON-NLS-1$
96

97     /**
98      * An alternative name for the enter key.
99      */

100     public static final String JavaDoc ENTER_NAME = "ENTER"; //$NON-NLS-1$
101

102     /**
103      * The formal name of the escape (U+001B) key.
104      */

105     public static final String JavaDoc ESC_NAME = "ESC"; //$NON-NLS-1$
106

107     /**
108      * An alternative name for the escape key.
109      */

110     public static final String JavaDoc ESCAPE_NAME = "ESCAPE"; //$NON-NLS-1$
111

112     /**
113      * The formal name of the 'F1' key.
114      */

115     public static final String JavaDoc F1_NAME = "F1"; //$NON-NLS-1$
116

117     /**
118      * The formal name of the 'F10' key.
119      */

120     public static final String JavaDoc F10_NAME = "F10"; //$NON-NLS-1$
121

122     /**
123      * The formal name of the 'F11' key.
124      */

125     public static final String JavaDoc F11_NAME = "F11"; //$NON-NLS-1$
126

127     /**
128      * The formal name of the 'F12' key.
129      */

130     public static final String JavaDoc F12_NAME = "F12"; //$NON-NLS-1$
131

132     /**
133      * The formal name of the 'F13' key.
134      */

135     public static final String JavaDoc F13_NAME = "F13"; //$NON-NLS-1$
136

137     /**
138      * The formal name of the 'F14' key.
139      */

140     public static final String JavaDoc F14_NAME = "F14"; //$NON-NLS-1$
141

142     /**
143      * The formal name of the 'F15' key.
144      */

145     public static final String JavaDoc F15_NAME = "F15"; //$NON-NLS-1$
146

147     /**
148      * The formal name of the 'F2' key.
149      */

150     public static final String JavaDoc F2_NAME = "F2"; //$NON-NLS-1$
151

152     /**
153      * The formal name of the 'F3' key.
154      */

155     public static final String JavaDoc F3_NAME = "F3"; //$NON-NLS-1$
156

157     /**
158      * The formal name of the 'F4' key.
159      */

160     public static final String JavaDoc F4_NAME = "F4"; //$NON-NLS-1$
161

162     /**
163      * The formal name of the 'F5' key.
164      */

165     public static final String JavaDoc F5_NAME = "F5"; //$NON-NLS-1$
166

167     /**
168      * The formal name of the 'F6' key.
169      */

170     public static final String JavaDoc F6_NAME = "F6"; //$NON-NLS-1$
171

172     /**
173      * The formal name of the 'F7' key.
174      */

175     public static final String JavaDoc F7_NAME = "F7"; //$NON-NLS-1$
176

177     /**
178      * The formal name of the 'F8' key.
179      */

180     public static final String JavaDoc F8_NAME = "F8"; //$NON-NLS-1$
181

182     /**
183      * The formal name of the 'F9' key.
184      */

185     public static final String JavaDoc F9_NAME = "F9"; //$NON-NLS-1$
186

187     /**
188      * The formal name of the form feed (U+000C) key.
189      */

190     public static final String JavaDoc FF_NAME = "FF"; //$NON-NLS-1$
191

192     /**
193      * The formal name of the 'Home' key.
194      */

195     public static final String JavaDoc HOME_NAME = "HOME"; //$NON-NLS-1$
196

197     /**
198      * The formal name of the 'Insert' key.
199      */

200     public static final String JavaDoc INSERT_NAME = "INSERT"; //$NON-NLS-1$
201

202     /**
203      * The formal name of the line feed (U+000A) key.
204      */

205     public static final String JavaDoc LF_NAME = "LF"; //$NON-NLS-1$
206

207     /**
208      * The formal name of the 'M1' key.
209      */

210     public static final String JavaDoc M1_NAME = "M1"; //$NON-NLS-1$
211

212     /**
213      * The formal name of the 'M2' key.
214      */

215     public static final String JavaDoc M2_NAME = "M2"; //$NON-NLS-1$
216

217     /**
218      * The formal name of the 'M3' key.
219      */

220     public static final String JavaDoc M3_NAME = "M3"; //$NON-NLS-1$
221

222     /**
223      * The formal name of the 'M4' key.
224      */

225     public static final String JavaDoc M4_NAME = "M4"; //$NON-NLS-1$
226

227     /**
228      * The formal name of the null (U+0000) key.
229      */

230     public static final String JavaDoc NUL_NAME = "NUL"; //$NON-NLS-1$
231

232     /**
233      * The formal name of the 'NumLock' key.
234      */

235     public static final String JavaDoc NUM_LOCK_NAME = "NUM_LOCK"; //$NON-NLS-1$
236

237     /**
238      * The formal name of the '0' key on the numpad.
239      */

240     public static final String JavaDoc NUMPAD_0_NAME = "NUMPAD_0"; //$NON-NLS-1$
241

242     /**
243      * The formal name of the '1' key on the numpad.
244      */

245     public static final String JavaDoc NUMPAD_1_NAME = "NUMPAD_1"; //$NON-NLS-1$
246

247     /**
248      * The formal name of the '2' key on the numpad.
249      */

250     public static final String JavaDoc NUMPAD_2_NAME = "NUMPAD_2"; //$NON-NLS-1$
251

252     /**
253      * The formal name of the '3' key on the numpad.
254      */

255     public static final String JavaDoc NUMPAD_3_NAME = "NUMPAD_3"; //$NON-NLS-1$
256

257     /**
258      * The formal name of the '4' key on the numpad.
259      */

260     public static final String JavaDoc NUMPAD_4_NAME = "NUMPAD_4"; //$NON-NLS-1$
261

262     /**
263      * The formal name of the '5' key on the numpad.
264      */

265     public static final String JavaDoc NUMPAD_5_NAME = "NUMPAD_5"; //$NON-NLS-1$
266

267     /**
268      * The formal name of the '6' key on the numpad.
269      */

270     public static final String JavaDoc NUMPAD_6_NAME = "NUMPAD_6"; //$NON-NLS-1$
271

272     /**
273      * The formal name of the '7' key on the numpad.
274      */

275     public static final String JavaDoc NUMPAD_7_NAME = "NUMPAD_7"; //$NON-NLS-1$
276

277     /**
278      * The formal name of the '8' key on the numpad.
279      */

280     public static final String JavaDoc NUMPAD_8_NAME = "NUMPAD_8"; //$NON-NLS-1$
281

282     /**
283      * The formal name of the '9' key on the numpad.
284      */

285     public static final String JavaDoc NUMPAD_9_NAME = "NUMPAD_9"; //$NON-NLS-1$
286

287     /**
288      * The formal name of the 'Add' key on the numpad.
289      */

290     public static final String JavaDoc NUMPAD_ADD_NAME = "NUMPAD_ADD"; //$NON-NLS-1$
291

292     /**
293      * The formal name of the 'Decimal' key on the numpad.
294      */

295     public static final String JavaDoc NUMPAD_DECIMAL_NAME = "NUMPAD_DECIMAL"; //$NON-NLS-1$
296

297     /**
298      * The formal name of the 'Divide' key on the numpad.
299      */

300     public static final String JavaDoc NUMPAD_DIVIDE_NAME = "NUMPAD_DIVIDE"; //$NON-NLS-1$
301

302     /**
303      * The formal name of the 'Enter' key on the numpad.
304      */

305     public static final String JavaDoc NUMPAD_ENTER_NAME = "NUMPAD_ENTER"; //$NON-NLS-1$
306

307     /**
308      * The formal name of the '=' key on the numpad.
309      */

310     public static final String JavaDoc NUMPAD_EQUAL_NAME = "NUMPAD_EQUAL"; //$NON-NLS-1$
311

312     /**
313      * The formal name of the 'Multiply' key on the numpad.
314      */

315     public static final String JavaDoc NUMPAD_MULTIPLY_NAME = "NUMPAD_MULTIPLY"; //$NON-NLS-1$
316

317     /**
318      * The formal name of the 'Subtract' key on the numpad.
319      */

320     public static final String JavaDoc NUMPAD_SUBTRACT_NAME = "NUMPAD_SUBTRACT"; //$NON-NLS-1$
321

322     /**
323      * The formal name of the 'Page Down' key.
324      */

325     public static final String JavaDoc PAGE_DOWN_NAME = "PAGE_DOWN"; //$NON-NLS-1$
326

327     /**
328      * The formal name of the 'Page Up' key.
329      */

330     public static final String JavaDoc PAGE_UP_NAME = "PAGE_UP"; //$NON-NLS-1$
331

332     /**
333      * The formal name for the 'Pause' key.
334      */

335     public static final String JavaDoc PAUSE_NAME = "PAUSE"; //$NON-NLS-1$
336

337     /**
338      * The formal name for the 'Print Screen' key.
339      */

340     public static final String JavaDoc PRINT_SCREEN_NAME = "PRINT_SCREEN"; //$NON-NLS-1$
341

342     /**
343      * An alternative name for the enter key.
344      */

345     public static final String JavaDoc RETURN_NAME = "RETURN"; //$NON-NLS-1$
346

347     /**
348      * The formal name for the 'Scroll Lock' key.
349      */

350     public static final String JavaDoc SCROLL_LOCK_NAME = "SCROLL_LOCK"; //$NON-NLS-1$
351

352     /**
353      * The formal name of the 'Shift' key.
354      */

355     public static final String JavaDoc SHIFT_NAME = "SHIFT"; //$NON-NLS-1$
356

357     /**
358      * The formal name of the space (U+0020) key.
359      */

360     public static final String JavaDoc SPACE_NAME = "SPACE"; //$NON-NLS-1$
361

362     /**
363      * The formal name of the tab (U+0009) key.
364      */

365     public static final String JavaDoc TAB_NAME = "TAB"; //$NON-NLS-1$
366

367     /**
368      * The formal name of the vertical tab (U+000B) key.
369      */

370     public static final String JavaDoc VT_NAME = "VT"; //$NON-NLS-1$
371

372     /**
373      * Looks up a single natural key by its formal name, and returns the integer
374      * representation for this natural key
375      *
376      * @param name
377      * The formal name of the natural key to look-up; must not be
378      * <code>null</code>.
379      * @return The integer representation of this key. If the natural key cannot
380      * be found, then this method returns <code>0</code>.
381      */

382     public int formalKeyLookup(String JavaDoc name);
383
384     /**
385      * Looks up a single natural key by its formal name, and returns the integer
386      * representation for this natural key
387      *
388      * @param name
389      * The formal name of the natural key to look-up; must not be
390      * <code>null</code>.
391      * @return The integer representation of this key. If the natural key cannot
392      * be found, then this method returns <code>0</code>.
393      */

394     public Integer JavaDoc formalKeyLookupInteger(String JavaDoc name);
395
396     /**
397      * Looks up a single modifier key by its formal name, and returns the integer
398      * representation for this modifier key
399      *
400      * @param name
401      * The formal name of the modifier key to look-up; must not be
402      * <code>null</code>.
403      * @return The integer representation of this key. If the modifier key
404      * cannot be found, then this method returns <code>0</code>.
405      */

406     public int formalModifierLookup(String JavaDoc name);
407
408     /**
409      * Looks up a key value, and returns the formal string representation for
410      * that key
411      *
412      * @param key
413      * The key to look-up.
414      * @return The formal string representation of this key. If this key cannot
415      * be found, then it is simply the character corresponding to that
416      * integer value.
417      */

418     public String JavaDoc formalNameLookup(int key);
419
420     /**
421      * Returns the integer representation of the ALT key.
422      *
423      * @return The ALT key
424      */

425     public int getAlt();
426
427     /**
428      * Returns the integer representation of the COMMAND key.
429      *
430      * @return The COMMAND key
431      */

432     public int getCommand();
433
434     /**
435      * Returns the integer representation of the CTRL key.
436      *
437      * @return The CTRL key
438      */

439     public int getCtrl();
440
441     /**
442      * Returns the integer representation of the SHIFT key.
443      *
444      * @return The SHIFT key
445      */

446     public int getShift();
447
448     /**
449      * Returns whether the given key is a modifier key.
450      *
451      * @param key
452      * The integer value of the key to check.
453      * @return <code>true</code> if the key is one of the modifier keys;
454      * <code>false</code> otherwise.
455      */

456     public boolean isModifierKey(int key);
457 }
458
Popular Tags