3118 lines · 108.4 KB · Java
RawDownload
         /**         * Constructs an edit record.  This does not modify the element         * so it can safely be used to <em>catch up</em> a view to the         * current model state for views that just attached to a model.         *         * @param e the element         * @param index the index into the model >= 0         * @param removed a set of elements that were removed         * @param added a set of elements that were added         */        public ElementEdit(Element e, int index, Element[] removed, Element[] added) {            super();            this.e = e;            this.index = index;            this.removed = removed;            this.added = added;        }         /**         * Returns the underlying element.         *         * @return the element         */        public Element getElement() {            return e;        }         /**         * Returns the index into the list of elements.         *         * @return the index >= 0         */        public int getIndex() {            return index;        }         /**         * Gets a list of children that were removed.         *         * @return the list         */        public Element[] getChildrenRemoved() {            return removed;        }         /**         * Gets a list of children that were added.         *         * @return the list         */        public Element[] getChildrenAdded() {            return added;        }         /**         * Redoes a change.         *         * @exception CannotRedoException if the change cannot be redone         */        public void redo() throws CannotRedoException {            super.redo();             // Since this event will be reused, switch around added/removed.            Element[] tmp = removed;            removed = added;            added = tmp;             // PENDING(prinz) need MutableElement interface, canRedo() should check            ((AbstractDocument.BranchElement)e).replace(index, removed.length, added);        }         /**         * Undoes a change.         *         * @exception CannotUndoException if the change cannot be undone         */        public void undo() throws CannotUndoException {            super.undo();            // PENDING(prinz) need MutableElement interface, canUndo() should check            ((AbstractDocument.BranchElement)e).replace(index, added.length, removed);             // Since this event will be reused, switch around added/removed.            Element[] tmp = removed;            removed = added;            added = tmp;        }         private Element e;        private int index;        private Element[] removed;        private Element[] added;    }      private class DefaultFilterBypass extends DocumentFilter.FilterBypass {        public Document getDocument() {            return AbstractDocument.this;        }         public void remove(int offset, int length) throws            BadLocationException {            handleRemove(offset, length);        }         public void insertString(int offset, String string,                                 AttributeSet attr) throws                                        BadLocationException {            handleInsertString(offset, string, attr);        }         public void replace(int offset, int length, String text,                            AttributeSet attrs) throws BadLocationException {            handleRemove(offset, length);            handleInsertString(offset, text, attrs);        }    }}

Lines 3001–3118 of 3118. Previous lines

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t