@@ -59,10 +59,37 @@ public class TextEditorPane extends RSyntaxTextArea implements
5959
6060 private static final long serialVersionUID = 1L ;
6161
62+ /**
63+ * Property change event fired when the file path this text area references
64+ * is updated.
65+ *
66+ * @see #load(FileLocation, String)
67+ * @see #saveAs(FileLocation)
68+ */
6269 public static final String FULL_PATH_PROPERTY = "TextEditorPane.fileFullPath" ;
70+
71+ /**
72+ * Property change event fired when the text area's dirty flag changes.
73+ *
74+ * @see #setDirty(boolean)
75+ */
6376 public static final String DIRTY_PROPERTY = "TextEditorPane.dirty" ;
77+
78+ /**
79+ * Property change event fired when the text area should be treated as
80+ * read-only, and previously it should not, or vice-versa.
81+ *
82+ * @see #setReadOnly(boolean)
83+ */
6484 public static final String READ_ONLY_PROPERTY = "TextEditorPane.readOnly" ;
6585
86+ /**
87+ * Property change event fired when the text area's encoding changes.
88+ *
89+ * @see #setEncoding(String)
90+ */
91+ public static final String ENCODING_PROPERTY = "TextEditorPane.encoding" ;
92+
6693 /**
6794 * The location of the file being edited.
6895 */
@@ -604,7 +631,8 @@ public void setDocument(Document doc) {
604631
605632 /**
606633 * Sets the encoding to use when reading or writing this file. This
607- * method sets the editor's dirty flag when the encoding is changed.
634+ * method sets the editor's dirty flag when the encoding is changed, and
635+ * fires a property change event of type {@link #ENCODING_PROPERTY}.
608636 *
609637 * @param encoding The new encoding.
610638 * @throws UnsupportedCharsetException If the encoding is not supported.
@@ -620,7 +648,9 @@ else if (!Charset.isSupported(encoding)) {
620648 throw new UnsupportedCharsetException (encoding );
621649 }
622650 if (charSet ==null || !charSet .equals (encoding )) {
651+ String oldEncoding = charSet ;
623652 charSet = encoding ;
653+ firePropertyChange (ENCODING_PROPERTY , oldEncoding , charSet );
624654 setDirty (true );
625655 }
626656 }
0 commit comments