public boolean add(Object st) {
        // never add the passed element (which is now selected on the
        // editor). We will add it when the next element is passed
        boolean ret = false;
        boolean removed = history.remove(st);
        if ((maxHistory > 0) && (lastAdded != null)
                && (lastAdded.toString().length() > 0)
                && !lastAdded.equals(st)) {
            history.add(0, lastAdded);

            int size = history.size();
            if (size > maxHistory) {
                history.remove(--size);
                removed = true;
            } else {
                ret = true;
                if (!removed) {
                    fireIntervalAdded(this, 0, 0);
                }
            }
        }

        if (removed) {
            fireContentsChanged(this, 0, history.size());
            ret = true;
        }

        lastAdded = st;
        shownHistory = history;

        return ret;
    }
public boolean add(Object st)