Skip to content

Commit

Permalink
Fix showing of context menu
Browse files Browse the repository at this point in the history
Remove hack code

Fixes #11323
  • Loading branch information
Siedlerchr committed May 22, 2024
1 parent 8124ad0 commit 9530f6a
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 151 deletions.
2 changes: 0 additions & 2 deletions src/main/java/org/jabref/gui/fieldeditors/EditorTextArea.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,7 @@ public void initContextMenu(final Supplier<List<MenuItem>> items) {
setOnContextMenuRequested(event -> {
contextMenu.getItems().setAll(EditorContextAction.getDefaultContextMenuItems(this, Globals.getKeyPrefs()));
contextMenu.getItems().addAll(0, items.get());

contextMenu.show(this, event.getScreenX(), event.getScreenY());
// TextInputControlBehavior.showContextMenu(this, contextMenu, event);
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@ public void initContextMenu(final Supplier<List<MenuItem>> items) {
setOnContextMenuRequested(event -> {
contextMenu.getItems().setAll(EditorContextAction.getDefaultContextMenuItems(this, Globals.getKeyPrefs()));
contextMenu.getItems().addAll(0, items.get());

contextMenu.show(this, event.getScreenX(), event.getScreenY());
// TextInputControlBehavior.showContextMenu(this, contextMenu, event);
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public OptionEditor(OptionEditorViewModel<T> viewModel) {
comboBox.getEditor().setOnContextMenuRequested(event -> {
ContextMenu contextMenu = new ContextMenu();
contextMenu.getItems().setAll(EditorContextAction.getDefaultContextMenuItems(comboBox.getEditor(), Globals.getKeyPrefs()));
TextInputControlBehavior.showContextMenu(comboBox.getEditor(), contextMenu, event);
contextMenu.show(comboBox, event.getScreenX(), event.getScreenY());
});
}

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import javafx.util.StringConverter;

import org.jabref.gui.Globals;
import org.jabref.gui.fieldeditors.TextInputControlBehavior;
import org.jabref.gui.fieldeditors.contextmenu.EditorContextAction;
import org.jabref.gui.util.BindingsHelper;
import org.jabref.model.entry.Date;
Expand All @@ -28,18 +27,18 @@
/**
* A date picker with configurable datetime format where both date and time can be changed via the text field and the
* date can additionally be changed via the JavaFX default date picker. Also supports incomplete dates.
*
* <p>
* First recall how the date picker normally works: - The user selects a date in the popup, which sets {@link
* #valueProperty()} to the selected date. - The converter ({@link #converterProperty()}) is used to transform the date
* to a string representation and display it in the text field.
*
* <p>
* The idea is now to intercept the process and add an additional step: - The user selects a date in the popup, which
* sets {@link #valueProperty()} to the selected date. - The date is converted to a {@link TemporalAccessor} (i.e,
* enriched by a time component) using {@link #addCurrentTime(LocalDate)} - The string converter ({@link
* #stringConverterProperty()}) is used to transform the temporal accessor to a string representation and display it in
* the text field.
*
* Inspiration taken from https://github.com/edvin/tornadofx-controls/blob/master/src/main/java/tornadofx/control/DateTimePicker.java
* <p>
* Inspiration taken from <a href="https://github.com/edvin/tornadofx-controls/blob/master/src/main/java/tornadofx/control/DateTimePicker.java">Controlsfx DateTimePicker</a>
*/
public class TemporalAccessorPicker extends DatePicker {
private final ObjectProperty<TemporalAccessor> temporalAccessorValue = new SimpleObjectProperty<>(null);
Expand All @@ -58,7 +57,7 @@ public TemporalAccessorPicker() {
getEditor().setOnContextMenuRequested(event -> {
ContextMenu contextMenu = new ContextMenu();
contextMenu.getItems().setAll(EditorContextAction.getDefaultContextMenuItems(getEditor(), Globals.getKeyPrefs()));
TextInputControlBehavior.showContextMenu(getEditor(), contextMenu, event);
contextMenu.show(this, event.getScreenX(), event.getScreenY());
});
}

Expand Down

0 comments on commit 9530f6a

Please sign in to comment.