diff options
author | mark <mark@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-01-17 18:09:40 +0000 |
---|---|---|
committer | mark <mark@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-01-17 18:09:40 +0000 |
commit | 2d8cf20d0d5ca6b1fbdefc22229d4b7cf1497ede (patch) | |
tree | c976ca91e3ef0bda3b34b37c0195145638d8d08e /libjava/classpath/javax/swing/text/AbstractDocument.java | |
parent | a3ef37ddfeddcc5b0f1c5068d8fdeb25a302d5cd (diff) | |
download | ppe42-gcc-2d8cf20d0d5ca6b1fbdefc22229d4b7cf1497ede.tar.gz ppe42-gcc-2d8cf20d0d5ca6b1fbdefc22229d4b7cf1497ede.zip |
Imported GNU Classpath 0.20
* Makefile.am (AM_CPPFLAGS): Add classpath/include.
* java/nio/charset/spi/CharsetProvider.java: New override file.
* java/security/Security.java: Likewise.
* sources.am: Regenerated.
* Makefile.in: Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@109831 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/classpath/javax/swing/text/AbstractDocument.java')
-rw-r--r-- | libjava/classpath/javax/swing/text/AbstractDocument.java | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/libjava/classpath/javax/swing/text/AbstractDocument.java b/libjava/classpath/javax/swing/text/AbstractDocument.java index a324425562e..c7353885e12 100644 --- a/libjava/classpath/javax/swing/text/AbstractDocument.java +++ b/libjava/classpath/javax/swing/text/AbstractDocument.java @@ -541,6 +541,9 @@ public abstract class AbstractDocument implements Document, Serializable writeLock(); UndoableEdit undo = content.insertString(offset, text); + if (undo != null) + event.addEdit(undo); + insertUpdate(event, attributes); writeUnlock(); @@ -1326,7 +1329,14 @@ public abstract class AbstractDocument implements Document, Serializable */ public Object getAttribute(Object key) { - return attributes.getAttribute(key); + Object result = attributes.getAttribute(key); + if (result == null && element_parent != null) + { + AttributeSet parentSet = element_parent.getAttributes(); + if (parentSet != null) + result = parentSet.getAttribute(key); + } + return result; } /** @@ -1809,6 +1819,12 @@ public abstract class AbstractDocument implements Document, Serializable Hashtable changes; /** + * Indicates if this event has been modified or not. This is used to + * determine if this event is thrown. + */ + boolean modified; + + /** * Creates a new <code>DefaultDocumentEvent</code>. * * @param offset the starting offset of the change @@ -1822,6 +1838,7 @@ public abstract class AbstractDocument implements Document, Serializable this.length = length; this.type = type; changes = new Hashtable(); + modified = false; } /** @@ -1836,6 +1853,7 @@ public abstract class AbstractDocument implements Document, Serializable // XXX - Fully qualify ElementChange to work around gcj bug #2499. if (edit instanceof DocumentEvent.ElementChange) { + modified = true; DocumentEvent.ElementChange elEdit = (DocumentEvent.ElementChange) edit; changes.put(elEdit.getElement(), elEdit); @@ -1896,6 +1914,15 @@ public abstract class AbstractDocument implements Document, Serializable // XXX - Fully qualify ElementChange to work around gcj bug #2499. return (DocumentEvent.ElementChange) changes.get(elem); } + + /** + * Returns a String description of the change event. This returns the + * toString method of the Vector of edits. + */ + public String toString() + { + return edits.toString(); + } } /** |