/**
  * Sets the current page to be the one corresponding to the given index in the page history.
  *
  * @param index the index into the page history
  */
 private void jumpToHistory(int index) {
   if (index >= 0 && index < history.size()) {
     historyIndex = index;
     dialog.setCurrentPageId(getHistoryEntry(index).getId());
   }
   updateHistoryControls();
 }
 /**
  * Adds the preference page path and its label to the page history.
  *
  * @param entry the preference page history entry
  */
 public void addHistoryEntry(PreferenceHistoryEntry entry) {
   if (historyIndex == -1 || !history.get(historyIndex).equals(entry)) {
     history.subList(historyIndex + 1, history.size()).clear();
     history.add(entry);
     historyIndex++;
     updateHistoryControls();
   }
 }