Skip to content

Commit cc464e8

Browse files
authored
Merge pull request #11324 from JabRef/tryToFixContextMenu
Fix context menu on second screen
2 parents aa80a72 + d38c73a commit cc464e8

File tree

6 files changed

+9
-151
lines changed

6 files changed

+9
-151
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv
4141
- We fixed an issue where imports to a custom group would only work for the first entry [#11085](https://github.com/JabRef/jabref/issues/11085), [#11269](https://github.com/JabRef/jabref/issues/11269)
4242
- We fixed an issue where a new entry was not added to the selected group [#8933](https://github.com/JabRef/jabref/issues/8933)
4343
- We fixed an issue where the horizontal position of the Entry Preview inside the entry editor was not remembered across restarts [#11281](https://github.com/JabRef/jabref/issues/11281)
44+
- We fixed an issue where the entry editor context menu was not shown correctly when JabRef is opened on a second, extended screen [#11323](https://github.com/JabRef/jabref/issues/11323), [#11174](https://github.com/JabRef/jabref/issues/11174)
4445

4546
### Removed
4647

src/main/java/org/jabref/gui/fieldeditors/EditorTextArea.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@ public void initContextMenu(final Supplier<List<MenuItem>> items) {
4242
setOnContextMenuRequested(event -> {
4343
contextMenu.getItems().setAll(EditorContextAction.getDefaultContextMenuItems(this, Globals.getKeyPrefs()));
4444
contextMenu.getItems().addAll(0, items.get());
45-
46-
TextInputControlBehavior.showContextMenu(this, contextMenu, event);
45+
contextMenu.show(this, event.getScreenX(), event.getScreenY());
4746
});
4847
}
4948

src/main/java/org/jabref/gui/fieldeditors/EditorTextField.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,7 @@ public void initContextMenu(final Supplier<List<MenuItem>> items) {
3838
setOnContextMenuRequested(event -> {
3939
contextMenu.getItems().setAll(EditorContextAction.getDefaultContextMenuItems(this, Globals.getKeyPrefs()));
4040
contextMenu.getItems().addAll(0, items.get());
41-
42-
TextInputControlBehavior.showContextMenu(this, contextMenu, event);
41+
contextMenu.show(this, event.getScreenX(), event.getScreenY());
4342
});
4443
}
4544

src/main/java/org/jabref/gui/fieldeditors/OptionEditor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public OptionEditor(OptionEditorViewModel<T> viewModel) {
3636
comboBox.getEditor().setOnContextMenuRequested(event -> {
3737
ContextMenu contextMenu = new ContextMenu();
3838
contextMenu.getItems().setAll(EditorContextAction.getDefaultContextMenuItems(comboBox.getEditor(), Globals.getKeyPrefs()));
39-
TextInputControlBehavior.showContextMenu(comboBox.getEditor(), contextMenu, event);
39+
contextMenu.show(comboBox, event.getScreenX(), event.getScreenY());
4040
});
4141
}
4242

src/main/java/org/jabref/gui/fieldeditors/TextInputControlBehavior.java

Lines changed: 0 additions & 140 deletions
This file was deleted.

src/main/java/org/jabref/gui/util/component/TemporalAccessorPicker.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
import javafx.util.StringConverter;
2020

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

0 commit comments

Comments
 (0)