Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions richtextfx/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ if (gradle.gradleVersion.substring(0, 1) >= "4") {
}
dependencies {
compile group: 'org.reactfx', name: 'reactfx', version: '2.0-M5'
compile group: 'org.fxmisc.undo', name: 'undofx', version: '1.3.1'
compile group: 'org.fxmisc.undo', name: 'undofx', version: '1.4.0'
compile group: 'org.fxmisc.flowless', name: 'flowless', version: '0.6'
compile group: 'org.fxmisc.wellbehaved', name: 'wellbehavedfx', version: '0.3'
compile group: 'org.fxmisc.wellbehaved', name: 'wellbehavedfx', version: '0.3.1'

testCompile group: 'junit', name: 'junit', version: '4.12'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* after a specified period of time.
*
* @param <C> the type of change the UndoManager can undo/redo
* @deprecated No longer needed since UndoFX 1.4.0. Will be removed in future release.
*/
final class UndoManagerInactivityWrapper<C> implements UndoManager<C> {

Expand Down Expand Up @@ -51,6 +52,11 @@ public boolean isUndoAvailable() {
return delegate.isUndoAvailable();
}

@Override
public Val<C> nextUndoProperty() {
return delegate.nextUndoProperty();
}

@Override
public Val<C> nextToUndoProperty() {
return delegate.nextToUndoProperty();
Expand All @@ -61,6 +67,11 @@ public C getNextToUndo() {
return delegate.getNextToUndo();
}

@Override
public Val<C> nextRedoProperty() {
return delegate.nextRedoProperty();
}

@Override
public Val<C> nextToRedoProperty() {
return delegate.nextToRedoProperty();
Expand Down
22 changes: 7 additions & 15 deletions richtextfx/src/main/java/org/fxmisc/richtext/util/UndoUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@
/**
* A class filled with factory methods to help easily construct an {@link UndoManager} for a {@link GenericStyledArea}.
*
* <p>
* To create an UndoManager that will prevent incoming changes from merging with the previous one after a period
* of user inactivity (via {@link UndoManager#preventMerge()}),
* use {@link #wrap(UndoManager, EventStream, Duration)}.
* </p>
*/
public final class UndoUtils {

Expand Down Expand Up @@ -84,11 +79,8 @@ public static <PS, SEG, S> UndoManager<RichTextChange<PS, SEG, S>> richTextUndoM
public static <PS, SEG, S> UndoManager<RichTextChange<PS, SEG, S>> richTextUndoManager(GenericStyledArea<PS, SEG, S> area,
UndoManagerFactory factory,
Duration preventMergeDelay) {
return wrap(
factory.create(area.richChanges(), TextChange::invert, applyRichTextChange(area), TextChange::mergeWith, TextChange::isIdentity),
area.richChanges(),
preventMergeDelay
);
return factory.create(area.richChanges(), TextChange::invert, applyRichTextChange(area),
TextChange::mergeWith, TextChange::isIdentity, preventMergeDelay);
};

/**
Expand Down Expand Up @@ -128,11 +120,8 @@ public static <PS, SEG, S> UndoManager<PlainTextChange> plainTextUndoManager(Gen
public static <PS, SEG, S> UndoManager<PlainTextChange> plainTextUndoManager(GenericStyledArea<PS, SEG, S> area,
UndoManagerFactory factory,
Duration preventMergeDelay) {
return wrap(
factory.create(area.plainTextChanges(), TextChange::invert, applyPlainTextChange(area), TextChange::mergeWith, TextChange::isIdentity),
area.plainTextChanges(),
preventMergeDelay
);
return factory.create(area.plainTextChanges(), TextChange::invert, applyPlainTextChange(area),
TextChange::mergeWith, TextChange::isIdentity, preventMergeDelay);
}

/* ********************************************************************** *
Expand Down Expand Up @@ -162,7 +151,10 @@ public static <PS, SEG, S> Consumer<RichTextChange<PS, SEG, S>> applyRichTextCha
/**
* Wraps an {@link UndoManager} and prevents the next emitted change from merging with the previous one are a
* period of inactivity (i.e., the {@code changeStream} has not emitted an event in {@code preventMergeDelay}
*
* @deprecated No longer needed since UndoFX 1.4.0
*/
@Deprecated
public static <T> UndoManager<T> wrap(UndoManager<T> undoManager, EventStream<T> changeStream, Duration preventMergeDelay) {
return new UndoManagerInactivityWrapper<>(undoManager, changeStream, preventMergeDelay);
}
Expand Down