/**
   * Clears all mappings and (re-)loads the mappings from the according preferences file into the
   * local structure.
   */
  private void reload() {
    commandMapping.clear();
    identifierToCommand.clear();

    Properties props = new Properties();
    File f = new File(Constants.COMMAND_BINDINGS_FILE);
    if (f.exists()) {
      try {
        props.load(new FileInputStream(f));
        for (Entry<Object, Object> entry : props.entrySet()) {
          String pluginCommand = (String) entry.getKey();
          int underscoreIndex = pluginCommand.lastIndexOf("_"); // $NON-NLS-1$
          String mainClass = pluginCommand.substring(0, underscoreIndex);
          String commandKey = pluginCommand.substring(underscoreIndex + 1);

          if (pluginCommand.startsWith(SAVE_KEY)) {

            mainClass = mainClass.replaceFirst(SAVE_KEY, ""); // $NON-NLS-1$
            CommandDefinition def = CommandDefinition.getSimpleCommandDef(mainClass, commandKey);
            String value = (String) entry.getValue();
            K recoverObject = recoverObject(value);
            if (recoverObject != null) {
              addCommandMappingInternal(def, recoverObject);
            }
          }
        }
      } catch (FileNotFoundException e) {
        logClass.error(
            "Error: "
                + e.getMessage() // $NON-NLS-1$
                + Constants.LINE_SEPARATOR,
            e);
      } catch (IOException e) {
        logClass.error(
            "Error: "
                + e.getMessage() // $NON-NLS-1$
                + Constants.LINE_SEPARATOR,
            e);
      }
    }
  }
 /**
  * Gets the bind object for the given command
  *
  * @param command the plugin command to get the object for
  * @return the object or <code>null</code> if none found for the given plugin command
  */
 protected K getObjectInternal(CommandDefinition command) {
   K object = commandMapping.get(command.getIdentifierString());
   return object;
 }
 /**
  * Binds the given object to the given command.<br>
  * Mappings to <code>null</code> are not save, so if you want to clear a mapping, use <code>null
  * </code> as value for the key sequence.<br>
  *
  * @param command the plugin command
  * @param object the object to bind to the command
  */
 protected void addCommandMappingInternal(CommandDefinition command, K object) {
   commandMapping.put(command.getIdentifierString(), object);
   identifierToCommand.put(command.getIdentifierString(), command);
 }