We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b05910d commit 6db5678Copy full SHA for 6db5678
1 file changed
src/main/java/com/ss/editor/ui/util/UIUtils.java
@@ -544,6 +544,19 @@ public static boolean isNotHotKey(@Nullable final KeyEvent event) {
544
return true;
545
}
546
547
+ /**
548
+ * Consume an event if the condition returns true.
549
+ *
550
+ * @param event the event.
551
+ * @param condition the condition.
552
+ */
553
+ @FXThread
554
+ public static void consumeIf(@NotNull final KeyEvent event, @NotNull final Predicate<KeyEvent> condition) {
555
+ if (condition.test(event)) {
556
+ event.consume();
557
+ }
558
559
+
560
/**
561
* Consume an event if the event is not hotkey.
562
*
0 commit comments