KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jface > bindings > keys > formatting > IKeyFormatter


1 /*******************************************************************************
2  * Copyright (c) 2004, 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
12 package org.eclipse.jface.bindings.keys.formatting;
13
14 import org.eclipse.jface.bindings.keys.KeySequence;
15 import org.eclipse.jface.bindings.keys.KeyStroke;
16
17 /**
18  * <p>
19  * Any formatter capable of taking a key sequence or a key stroke and converting
20  * it into a string. These formatters are used to produce the strings that the
21  * user sees in the keys preference page and the menus, as well as the strings
22  * that are used for persistent storage.
23  * </p>
24  *
25  * @since 3.1
26  */

27 public interface IKeyFormatter {
28
29     /**
30      * Formats an individual key into a human readable format. This uses an
31      * internationalization resource bundle to look up the key. This does not do
32      * any platform-specific formatting (e.g., Carbon's command character).
33      *
34      * @param key
35      * The key to format.
36      * @return The key formatted as a string; should not be <code>null</code>.
37      */

38     String JavaDoc format(int key);
39
40     /**
41      * Format the given key sequence into a string. The manner of the conversion
42      * is dependent on the formatter. It is required that unequal key sequences
43      * return unequal strings.
44      *
45      * @param keySequence
46      * The key sequence to convert; must not be <code>null</code>.
47      * @return A string representation of the key sequence; must not be
48      * <code>null</code>.
49      */

50     String JavaDoc format(KeySequence keySequence);
51
52     /**
53      * Format the given key strokes into a string. The manner of the conversion
54      * is dependent on the formatter. It is required that unequal key strokes
55      * return unequal strings.
56      *
57      * @param keyStroke
58      * The key stroke to convert; must not be <Code>null</code>.
59      * @return A string representation of the key stroke; must not be <code>
60      * null</code>
61      */

62     String JavaDoc format(KeyStroke keyStroke);
63 }
64
Popular Tags