Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/upstream/main' into di
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/main/java/org/jabref/gui/fieldeditors/OptionEditor.java
#	src/main/java/org/jabref/gui/util/component/TemporalAccessorPicker.java
  • Loading branch information
calixtus committed May 27, 2024
2 parents 8bac78a + 52c2f8b commit 55a1345
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 158 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv
- 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)
- We fixed an issue where a new entry was not added to the selected group [#8933](https://github.com/JabRef/jabref/issues/8933)
- 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)
- We fixed an issue where the search index was not updated after linking PDF files. [#11317](https://github.com/JabRef/jabref/pull/11317)
- 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)

### Removed

Expand Down
2 changes: 1 addition & 1 deletion docs/code-howtos/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Optional<Path> file = FileHelper.expandFilename(database, fileText, preferences.

`String path` Can be the files name or a relative path to it. The Preferences should only be directly accessed in the GUI. For the usage in logic pass them as parameter

## Setting a Database Directory for a .bib File
## Setting a Directory for a .bib File

* `@comment{jabref-meta: fileDirectory:<directory>`
* “fileDirectory” is determined by Globals.pref.get(“userFileDir”) (which defaults to “fileDirectory”
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/org/jabref/gui/LibraryTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@ private void setDatabaseContext(BibDatabaseContext bibDatabaseContext) {
setupMainPanel();
setupAutoCompletion();

this.getDatabase().registerListener(new IndexUpdateListener());
this.getDatabase().registerListener(new EntriesRemovedListener());

// ensure that at each addition of a new entry, the entry is added to the groups interface
Expand Down Expand Up @@ -1098,9 +1099,9 @@ public void listen(FieldChangedEvent fieldChangedEvent) {
List<LinkedFile> newFileList = FileFieldParser.parse(fieldChangedEvent.getNewValue());

List<LinkedFile> addedFiles = new ArrayList<>(newFileList);
addedFiles.remove(oldFileList);
addedFiles.removeAll(oldFileList);
List<LinkedFile> removedFiles = new ArrayList<>(oldFileList);
removedFiles.remove(newFileList);
removedFiles.removeAll(newFileList);

try {
PdfIndexer indexer = PdfIndexerManager.getIndexer(bibDatabaseContext, preferencesService.getFilePreferences());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ public void initContextMenu(final Supplier<List<MenuItem>> items, KeyBindingRepo
setOnContextMenuRequested(event -> {
contextMenu.getItems().setAll(EditorContextAction.getDefaultContextMenuItems(this));
contextMenu.getItems().addAll(0, items.get());

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

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

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

Expand Down
4 changes: 1 addition & 3 deletions src/main/java/org/jabref/gui/fieldeditors/OptionEditor.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ public class OptionEditor<T> extends HBox implements FieldEditorFX {
@FXML private final OptionEditorViewModel<T> viewModel;
@FXML private ComboBox<T> comboBox;

@Inject private KeyBindingRepository keyBindingRepository;

public OptionEditor(OptionEditorViewModel<T> viewModel) {
ViewLoader.view(this)
.root(this)
Expand All @@ -39,7 +37,7 @@ public OptionEditor(OptionEditorViewModel<T> viewModel) {
comboBox.getEditor().setOnContextMenuRequested(event -> {
ContextMenu contextMenu = new ContextMenu();
contextMenu.getItems().setAll(EditorContextAction.getDefaultContextMenuItems(comboBox.getEditor()));
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 @@ -18,7 +18,6 @@
import javafx.scene.control.DatePicker;
import javafx.util.StringConverter;

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 @@ -27,18 +26,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 @@ -57,7 +56,7 @@ public TemporalAccessorPicker() {
getEditor().setOnContextMenuRequested(event -> {
ContextMenu contextMenu = new ContextMenu();
contextMenu.getItems().setAll(EditorContextAction.getDefaultContextMenuItems(getEditor()));
TextInputControlBehavior.showContextMenu(getEditor(), contextMenu, event);
contextMenu.show(this, event.getScreenX(), event.getScreenY());
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,8 @@ public Path getFulltextIndexPath() {
Path indexPath;

if (getDatabasePath().isPresent()) {
Path databaseFileName = getDatabasePath().get().getFileName();
String fileName = BackupFileUtil.getUniqueFilePrefix(databaseFileName) + "--" + databaseFileName;
Path databasePath = getDatabasePath().get();
String fileName = BackupFileUtil.getUniqueFilePrefix(databasePath) + "--" + databasePath.getFileName();
indexPath = appData.resolve(fileName);
LOGGER.debug("Index path for {} is {}", getDatabasePath().get(), indexPath);
return indexPath;
Expand Down

0 comments on commit 55a1345

Please sign in to comment.