code: public void addHistoryEntry(Query q)
    {
      try
      {
        Query queryCopy = q.clone();
        // remove it first in order to let it appear on the beginning of the list
        state.getHistory().removeItem(queryCopy);
        state.getHistory().addItemAt(0, queryCopy);
        searchView.getControlPanel().getQueryPanel().updateShortHistory();
      }
      catch(CloneNotSupportedException ex)
      {
        log.error("Can't clone the query", ex);
      }
    }
docs: Adds a history entry to the history panel.
  
  @param q the entry, which is added.
  
  @see HistoryPanel