Skip to content

Commit 9c128d8

Browse files
Add javadoc, pointing developers to UndoUtils and its wrap method
1 parent 63f831c commit 9c128d8

3 files changed

Lines changed: 19 additions & 0 deletions

File tree

richtextfx/src/main/java/org/fxmisc/richtext/GenericStyledArea.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,14 @@
130130
* <p>Additionally, when overriding the default user-interaction behavior, remember to include a call
131131
* to {@link #requestFollowCaret()}.</p>
132132
*
133+
* <h3>Setting the area's {@link UndoManager}</h3>
134+
*
135+
* <p>
136+
* The default UndoManager can undo/redo either {@link PlainTextChange}s or {@link RichTextChange}s. To create
137+
* your own specialized version that may use changes different than these (or a combination of these changes
138+
* with others), create them using the convenient factory methods in {@link UndoUtils}.
139+
* </p>
140+
*
133141
* <h3>Overriding default keyboard behavior</h3>
134142
*
135143
* {@code StyledTextArea} uses {@code KEY_TYPED} handler to handle ordinary

richtextfx/src/main/java/org/fxmisc/richtext/model/UndoActions.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ public interface UndoActions {
1313
* Undo manager of this text area.
1414
*/
1515
UndoManager getUndoManager();
16+
17+
/**
18+
* Closes the current area's undo manager before setting it to the given one. <b>Note:</b> to create your
19+
* own {@link UndoManager}, see the convenient factory methods in {@link org.fxmisc.richtext.util.UndoUtils}.
20+
*/
1621
void setUndoManager(UndoManager undoManager);
1722

1823
default void undo() { getUndoManager().undo(); }

richtextfx/src/main/java/org/fxmisc/richtext/util/UndoUtils.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@
1313

1414
/**
1515
* A class filled with factory methods to help easily construct an {@link UndoManager} for a {@link GenericStyledArea}.
16+
*
17+
* <p>
18+
* To create an UndoManager that will prevent incoming changes from merging with the previous one after a period
19+
* of user inactivity (via {@link UndoManager#preventMerge()}),
20+
* use {@link #wrap(UndoManager, EventStream, Duration)}.
21+
* </p>
1622
*/
1723
public final class UndoUtils {
1824

0 commit comments

Comments
 (0)