/**
   * Formats an individual key into a human readable format. This uses an internationalization
   * resource bundle to look up the key. This does the platform-specific formatting for Carbon.
   *
   * @param key The key to format.
   * @return The key formatted as a string; should not be <code>null</code>.
   */
  public final String format(final int key) {
    final IKeyLookup lookup = KeyLookupFactory.getDefault();
    final String name = lookup.formalNameLookup(key);

    // TODO consider platform-specific resource bundles
    if (Util.isMac()) {
      String formattedName = (String) CARBON_KEY_LOOK_UP.get(name);
      if (formattedName != null) {
        return formattedName;
      }
    }

    return super.format(key);
  }
Example #2
0
 /*
  * (non-Javadoc)
  *
  * @see org.eclipse.jface.bindings.keys.KeyFormatter#format(org.eclipse.ui.keys.KeySequence)
  */
 public String format(final int key) {
   final IKeyLookup lookup = KeyLookupFactory.getDefault();
   return lookup.formalNameLookup(key);
 }