|
14 | 14 | /** |
15 | 15 | * A class filled with factory methods to help easily construct an {@link UndoManager} for a {@link GenericStyledArea}. |
16 | 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> |
22 | 17 | */ |
23 | 18 | public final class UndoUtils { |
24 | 19 |
|
@@ -84,11 +79,8 @@ public static <PS, SEG, S> UndoManager<RichTextChange<PS, SEG, S>> richTextUndoM |
84 | 79 | public static <PS, SEG, S> UndoManager<RichTextChange<PS, SEG, S>> richTextUndoManager(GenericStyledArea<PS, SEG, S> area, |
85 | 80 | UndoManagerFactory factory, |
86 | 81 | Duration preventMergeDelay) { |
87 | | - return wrap( |
88 | | - factory.create(area.richChanges(), TextChange::invert, applyRichTextChange(area), TextChange::mergeWith, TextChange::isIdentity), |
89 | | - area.richChanges(), |
90 | | - preventMergeDelay |
91 | | - ); |
| 82 | + return factory.create(area.richChanges(), TextChange::invert, applyRichTextChange(area), |
| 83 | + TextChange::mergeWith, TextChange::isIdentity, preventMergeDelay); |
92 | 84 | }; |
93 | 85 |
|
94 | 86 | /** |
@@ -128,11 +120,8 @@ public static <PS, SEG, S> UndoManager<PlainTextChange> plainTextUndoManager(Gen |
128 | 120 | public static <PS, SEG, S> UndoManager<PlainTextChange> plainTextUndoManager(GenericStyledArea<PS, SEG, S> area, |
129 | 121 | UndoManagerFactory factory, |
130 | 122 | Duration preventMergeDelay) { |
131 | | - return wrap( |
132 | | - factory.create(area.plainTextChanges(), TextChange::invert, applyPlainTextChange(area), TextChange::mergeWith, TextChange::isIdentity), |
133 | | - area.plainTextChanges(), |
134 | | - preventMergeDelay |
135 | | - ); |
| 123 | + return factory.create(area.plainTextChanges(), TextChange::invert, applyPlainTextChange(area), |
| 124 | + TextChange::mergeWith, TextChange::isIdentity, preventMergeDelay); |
136 | 125 | } |
137 | 126 |
|
138 | 127 | /* ********************************************************************** * |
@@ -162,7 +151,10 @@ public static <PS, SEG, S> Consumer<RichTextChange<PS, SEG, S>> applyRichTextCha |
162 | 151 | /** |
163 | 152 | * Wraps an {@link UndoManager} and prevents the next emitted change from merging with the previous one are a |
164 | 153 | * period of inactivity (i.e., the {@code changeStream} has not emitted an event in {@code preventMergeDelay} |
| 154 | + * |
| 155 | + * @deprecated No longer needed since UndoFX 1.4.0 |
165 | 156 | */ |
| 157 | + @Deprecated |
166 | 158 | public static <T> UndoManager<T> wrap(UndoManager<T> undoManager, EventStream<T> changeStream, Duration preventMergeDelay) { |
167 | 159 | return new UndoManagerInactivityWrapper<>(undoManager, changeStream, preventMergeDelay); |
168 | 160 | } |
|
0 commit comments