public void register(
      KeySequence keys, AppCommand command, String groupName, String title, String disableModes) {
    KeyboardShortcut shortcut = new KeyboardShortcut(keys, groupName, title, disableModes);

    // Update state related to key dispatch.
    updateKeyPrefixes(shortcut);

    if (command == null) {
      // If the shortcut is unbound, check to see whether there's another
      // unbound shortcut with the same title; replace it if there is.
      boolean existingShortcut = false;
      for (int i = 0; i < unboundShortcuts_.size(); i++) {
        if (unboundShortcuts_.get(i).getTitle().equals(title)) {
          unboundShortcuts_.set(i, shortcut);
          existingShortcut = true;
          break;
        }
      }
      if (!existingShortcut) unboundShortcuts_.add(shortcut);
    } else {
      // Setting the shortcut on a command is done purely for UI-related tasks.
      // We don't want to set modal shortcuts (the binding will be active regardless
      // of whether we let the command 'know' about the binding).
      if (disableModes.indexOf("default") != 0) command.setShortcut(shortcut);

      commands_.addCommandBinding(keys, command, shortcut);
    }
  }
  public void register(
      KeySequence keys, AppCommand command, String groupName, String title, String disableModes) {

    KeyboardShortcut shortcut = new KeyboardShortcut(keys, groupName, title, disableModes);

    if (command == null) {
      // If the shortcut is unbound, check to see whether there's another
      // unbound shortcut with the same title; replace it if there is.
      boolean existingShortcut = false;
      for (int i = 0; i < unboundShortcuts_.size(); i++) {
        if (unboundShortcuts_.get(i).getTitle().equals(title)) {
          unboundShortcuts_.set(i, shortcut);
          existingShortcut = true;
          break;
        }
      }
      if (!existingShortcut) unboundShortcuts_.add(shortcut);
    } else {
      ArrayList<AppCommand> commands;
      if (commands_.containsKey(shortcut)) {
        // already have a command for this shortcut; add this one
        commands = commands_.get(shortcut);
      } else {
        // no commands yet, make a new list
        commands = new ArrayList<AppCommand>();
        commands_.put(shortcut, commands);
      }
      commands.add(command);

      command.setShortcut(shortcut);
    }

    if (shortcut.isModalShortcut()) {
      modalShortcuts_.add(shortcut);
    }
  }