Skip to content

Commit f41a629

Browse files
authored
Remove deprecated methods (#818)
Removed deprecated methods from ViewActions and GenericStyledArea
1 parent 836902e commit f41a629

File tree

2 files changed

+3
-57
lines changed

2 files changed

+3
-57
lines changed

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

+3-36
Original file line numberDiff line numberDiff line change
@@ -442,14 +442,14 @@ public final boolean removeSelection(Selection<PS, SEG, S> selection) {
442442
@Override public final void setOnOutsideSelectionMousePressed(EventHandler<MouseEvent> handler) { onOutsideSelectionMousePressed.set( handler ); }
443443
@Override public final ObjectProperty<EventHandler<MouseEvent>> onOutsideSelectionMousePressedProperty() { return onOutsideSelectionMousePressed; }
444444
private final ObjectProperty<EventHandler<MouseEvent>> onOutsideSelectionMousePressed = new SimpleObjectProperty<>( e -> {
445-
onOutsideSelectionMousePressProperty().get().accept(e);
445+
moveTo( hit( e.getX(), e.getY() ).getInsertionIndex(), SelectionPolicy.CLEAR );
446446
});
447447

448448
@Override public final EventHandler<MouseEvent> getOnInsideSelectionMousePressReleased() { return onInsideSelectionMousePressReleased.get(); }
449449
@Override public final void setOnInsideSelectionMousePressReleased(EventHandler<MouseEvent> handler) { onInsideSelectionMousePressReleased.set( handler ); }
450450
@Override public final ObjectProperty<EventHandler<MouseEvent>> onInsideSelectionMousePressReleasedProperty() { return onInsideSelectionMousePressReleased; }
451451
private final ObjectProperty<EventHandler<MouseEvent>> onInsideSelectionMousePressReleased = new SimpleObjectProperty<>( e -> {
452-
onInsideSelectionMousePressReleaseProperty().get().accept(e);
452+
moveTo( hit( e.getX(), e.getY() ).getInsertionIndex(), SelectionPolicy.CLEAR );
453453
});
454454

455455
private final ObjectProperty<Consumer<Point2D>> onNewSelectionDrag = new SimpleObjectProperty<>(p -> {
@@ -476,7 +476,7 @@ public final boolean removeSelection(Selection<PS, SEG, S> selection) {
476476
@Override public final void setOnSelectionDropped(EventHandler<MouseEvent> handler) { onSelectionDropped.set( handler ); }
477477
@Override public final ObjectProperty<EventHandler<MouseEvent>> onSelectionDroppedProperty() { return onSelectionDropped; }
478478
private final ObjectProperty<EventHandler<MouseEvent>> onSelectionDropped = new SimpleObjectProperty<>( e -> {
479-
onSelectionDropProperty().get().accept(e);
479+
moveSelectedText( hit( e.getX(), e.getY() ).getInsertionIndex() );
480480
});
481481

482482
// not a hook, but still plays a part in the default mouse behavior
@@ -1581,37 +1581,4 @@ private void suspendVisibleParsWhile(Runnable runnable) {
15811581
return CSS_META_DATA_LIST;
15821582
}
15831583

1584-
1585-
// Note: this code should be moved to `onOutsideSelectionMousePressed` property
1586-
// in the next major release before removing this deprecated field
1587-
@Deprecated private final ObjectProperty<Consumer<MouseEvent>> onOutsideSelectionMousePress = new SimpleObjectProperty<>( e -> {
1588-
CharacterHit hit = hit(e.getX(), e.getY());
1589-
moveTo(hit.getInsertionIndex(), SelectionPolicy.CLEAR);
1590-
});
1591-
@Deprecated
1592-
@Override public final ObjectProperty<Consumer<MouseEvent>> onOutsideSelectionMousePressProperty() {
1593-
return onOutsideSelectionMousePress;
1594-
}
1595-
1596-
// Note: this code should be moved to `onInsideSelectionMouseReleased` property
1597-
// in the next major release before removing this deprecated field
1598-
@Deprecated private final ObjectProperty<Consumer<MouseEvent>> onInsideSelectionMousePressRelease = new SimpleObjectProperty<>( e -> {
1599-
CharacterHit hit = hit(e.getX(), e.getY());
1600-
moveTo(hit.getInsertionIndex(), SelectionPolicy.CLEAR);
1601-
});
1602-
@Deprecated
1603-
@Override public final ObjectProperty<Consumer<MouseEvent>> onInsideSelectionMousePressReleaseProperty() {
1604-
return onInsideSelectionMousePressRelease;
1605-
}
1606-
1607-
// Note: this code should be moved to `onSelectionDropped` property
1608-
// in the next major release before removing this deprecated field
1609-
@Deprecated private final ObjectProperty<Consumer<MouseEvent>> onSelectionDrop = new SimpleObjectProperty<>( e -> {
1610-
CharacterHit hit = hit(e.getX(), e.getY());
1611-
moveSelectedText(hit.getInsertionIndex());
1612-
});
1613-
@Deprecated
1614-
@Override public final ObjectProperty<Consumer<MouseEvent>> onSelectionDropProperty() {
1615-
return onSelectionDrop;
1616-
}
16171584
}

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

-21
Original file line numberDiff line numberDiff line change
@@ -463,25 +463,4 @@ default void hideContextMenu() {
463463
}
464464
}
465465

466-
/** Use setOnOutsideSelectionMousePress<u>ed</u>(<i>EventHandler&gt;MouseEvent&lt;</i>) instead, which is FXML compatible */
467-
@Deprecated default void setOnOutsideSelectionMousePress(Consumer<MouseEvent> consumer) { onOutsideSelectionMousePressProperty().set(consumer); }
468-
/** Use getOnOutsideSelectionMousePress<u>ed</u>() instead */
469-
@Deprecated default Consumer<MouseEvent> getOnOutsideSelectionMousePress() { return onOutsideSelectionMousePressProperty().get(); }
470-
/** Use onOutsideSelectionMousePress<u>ed</u>Property() instead */
471-
@Deprecated ObjectProperty<Consumer<MouseEvent>> onOutsideSelectionMousePressProperty();
472-
473-
/** Use getOnInsideSelectionMousePressRelease<u>d</u>() instead */
474-
@Deprecated default Consumer<MouseEvent> getOnInsideSelectionMousePressRelease() { return onInsideSelectionMousePressReleaseProperty().get(); }
475-
/** Use setOnInsideSelectionMousePressRelease<u>d</u>(<i>EventHandler&gt;MouseEvent&lt;</i>) instead, which is FXML compatible */
476-
@Deprecated default void setOnInsideSelectionMousePressRelease(Consumer<MouseEvent> consumer) { onInsideSelectionMousePressReleaseProperty().set(consumer); }
477-
/** Use onInsideSelectionMousePressRelease<u>d</u>Property() instead */
478-
@Deprecated ObjectProperty<Consumer<MouseEvent>> onInsideSelectionMousePressReleaseProperty();
479-
480-
/** Use getOnSelectionDrop<u>ped</u>() instead */
481-
@Deprecated default Consumer<MouseEvent> getOnSelectionDrop() { return onSelectionDropProperty().get(); }
482-
/** Use setOnSelectionDrop<u>ped</u>(<i>EventHandler&gt;MouseEvent&lt;</i>) instead, which is FXML compatible */
483-
@Deprecated default void setOnSelectionDrop(Consumer<MouseEvent> consumer) { onSelectionDropProperty().set(consumer); }
484-
/** Use onSelectionDrop<u>ped</u>Property() instead */
485-
@Deprecated ObjectProperty<Consumer<MouseEvent>> onSelectionDropProperty();
486-
487466
}

0 commit comments

Comments
 (0)