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/entryeditor/EntryEditor.java
#	src/main/java/org/jabref/gui/entryeditor/RelatedArticlesTab.java
#	src/main/java/org/jabref/gui/entryeditor/citationrelationtab/CitationRelationsTab.java
  • Loading branch information
calixtus committed Jun 17, 2024
2 parents 81f6e48 + 7ef4976 commit c39b382
Show file tree
Hide file tree
Showing 11 changed files with 145 additions and 145 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ dependencies {
antlr4 'org.antlr:antlr4:4.13.1'
implementation 'org.antlr:antlr4-runtime:4.13.1'

implementation group: 'org.eclipse.jgit', name: 'org.eclipse.jgit', version: '6.9.0.202403050737-r'
implementation group: 'org.eclipse.jgit', name: 'org.eclipse.jgit', version: '6.10.0.202406032230-r'

implementation group: 'com.fasterxml.jackson.dataformat', name: 'jackson-dataformat-yaml', version: '2.17.1'
implementation group: 'com.fasterxml.jackson.datatype', name: 'jackson-datatype-jsr310', version: '2.17.1'
Expand Down Expand Up @@ -218,7 +218,7 @@ dependencies {
}
implementation 'org.fxmisc.flowless:flowless:0.7.3'
implementation 'org.fxmisc.richtext:richtextfx:0.11.2'
implementation (group: 'com.dlsc.gemsfx', name: 'gemsfx', version: '2.23.0') {
implementation (group: 'com.dlsc.gemsfx', name: 'gemsfx', version: '2.25.0') {
exclude module: 'javax.inject' // Split package, use only jakarta.inject
exclude module: 'commons-lang3'
exclude group: 'org.openjfx'
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/org/jabref/gui/LibraryTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,7 @@ private void createMainTable() {
stateManager.setSelectedEntries(entries);
if (!entries.isEmpty()) {
// Update entry editor and preview according to selected entries
entryEditor.setEntry(entries.getFirst());
entryEditor.setCurrentlyEditedEntry(entries.getFirst());
}
});
}
Expand Down Expand Up @@ -639,7 +639,7 @@ public void showAndEdit(BibEntry entry) {

// We use != instead of equals because of performance reasons
if (entry != showing) {
entryEditor.setEntry(entry);
entryEditor.setCurrentlyEditedEntry(entry);
showing = entry;
}
entryEditor.requestFocus();
Expand Down Expand Up @@ -682,14 +682,14 @@ public void entryEditorClosing() {
private void ensureNotShowingBottomPanel(List<BibEntry> entriesToCheck) {
// This method is not able to close the bottom pane currently

if ((mode == PanelMode.MAIN_TABLE_AND_ENTRY_EDITOR) && (entriesToCheck.contains(entryEditor.getEntry()))) {
if ((mode == PanelMode.MAIN_TABLE_AND_ENTRY_EDITOR) && (entriesToCheck.contains(entryEditor.getCurrentlyEditedEntry()))) {
closeBottomPane();
}
}

public void updateEntryEditorIfShowing() {
if (mode == PanelMode.MAIN_TABLE_AND_ENTRY_EDITOR) {
BibEntry currentEntry = entryEditor.getEntry();
BibEntry currentEntry = entryEditor.getCurrentlyEditedEntry();
showAndEdit(currentEntry);
}
}
Expand Down
208 changes: 102 additions & 106 deletions src/main/java/org/jabref/gui/entryeditor/EntryEditor.java

Large diffs are not rendered by default.

14 changes: 0 additions & 14 deletions src/main/java/org/jabref/gui/entryeditor/EntryEditorTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,4 @@ public void notifyAboutFocus(BibEntry entry) {
}
handleFocus();
}

/**
* Switch to next Preview style - should be overriden if a EntryEditorTab is actually showing a preview
*/
protected void nextPreviewStyle() {
// do nothing by default
}

/**
* Switch to previous Preview style - should be overriden if a EntryEditorTab is actually showing a preview
*/
protected void previousPreviewStyle() {
// do nothing by default
}
}
6 changes: 3 additions & 3 deletions src/main/java/org/jabref/gui/entryeditor/FieldsEditorTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
/**
* A single tab displayed in the EntryEditor holding several FieldEditors.
*/
abstract class FieldsEditorTab extends EntryEditorTab {
abstract class FieldsEditorTab extends EntryEditorTab implements OffersPreview {
protected final BibDatabaseContext databaseContext;
protected final Map<Field, FieldEditorFX> editors = new LinkedHashMap<>();
protected GridPane gridPane;
Expand Down Expand Up @@ -213,14 +213,14 @@ protected void bindToEntry(BibEntry entry) {
}

@Override
protected void nextPreviewStyle() {
public void nextPreviewStyle() {
if (previewPanel != null) {
previewPanel.nextPreviewStyle();
}
}

@Override
protected void previousPreviewStyle() {
public void previousPreviewStyle() {
if (previewPanel != null) {
previewPanel.previousPreviewStyle();
}
Expand Down
14 changes: 14 additions & 0 deletions src/main/java/org/jabref/gui/entryeditor/OffersPreview.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package org.jabref.gui.entryeditor;

public interface OffersPreview {

/**
* Switch to next Preview style - should be overriden if a EntryEditorTab is actually showing a preview
*/
void nextPreviewStyle();

/**
* Switch to previous Preview style - should be overriden if a EntryEditorTab is actually showing a preview
*/
void previousPreviewStyle();
}
6 changes: 3 additions & 3 deletions src/main/java/org/jabref/gui/entryeditor/PreviewTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import org.jabref.model.entry.BibEntry;
import org.jabref.preferences.PreferencesService;

public class PreviewTab extends EntryEditorTab {
public class PreviewTab extends EntryEditorTab implements OffersPreview {
public static final String NAME = "Preview";
private final DialogService dialogService;
private final BibDatabaseContext databaseContext;
Expand Down Expand Up @@ -43,14 +43,14 @@ public PreviewTab(BibDatabaseContext databaseContext,
}

@Override
protected void nextPreviewStyle() {
public void nextPreviewStyle() {
if (previewPanel != null) {
previewPanel.nextPreviewStyle();
}
}

@Override
protected void previousPreviewStyle() {
public void previousPreviewStyle() {
if (previewPanel != null) {
previewPanel.previousPreviewStyle();
}
Expand Down
20 changes: 11 additions & 9 deletions src/main/java/org/jabref/gui/entryeditor/RelatedArticlesTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,30 +37,31 @@
import org.slf4j.LoggerFactory;

/**
* GUI for tab displaying article recommendations based on the currently selected BibEntry
* Tab displaying article recommendations based on the currently selected BibEntry
*/
public class RelatedArticlesTab extends EntryEditorTab {

public static final String NAME = "Related articles";
private static final Logger LOGGER = LoggerFactory.getLogger(RelatedArticlesTab.class);
private final EntryEditorPreferences preferences;

private final DialogService dialogService;
private final PreferencesService preferencesService;
private final BuildInfo buildInfo;
private final TaskExecutor taskExecutor;

private final PreferencesService preferencesService;

public RelatedArticlesTab(BuildInfo buildInfo,
EntryEditorPreferences preferences,
PreferencesService preferencesService,
DialogService dialogService,
TaskExecutor taskExecutor) {
this.dialogService = dialogService;
this.buildInfo = buildInfo;
this.taskExecutor = taskExecutor;

this.preferencesService = preferencesService;

setText(Localization.lang("Related articles"));
setTooltip(new Tooltip(Localization.lang("Related articles")));
this.preferences = preferences;
this.dialogService = dialogService;
this.preferencesService = preferencesService;
}

/**
Expand Down Expand Up @@ -241,15 +242,16 @@ private ScrollPane getPrivacyDialog(BibEntry entry) {

@Override
public boolean shouldShow(BibEntry entry) {
return preferences.shouldShowRecommendationsTab();
EntryEditorPreferences entryEditorPreferences = preferencesService.getEntryEditorPreferences();
return entryEditorPreferences.shouldShowRecommendationsTab();
}

@Override
protected void bindToEntry(BibEntry entry) {
// Ask for consent to send data to Mr. DLib on first time to tab
if (preferencesService.getMrDlibPreferences().shouldAcceptRecommendations()) {
setContent(getRelatedArticlesPane(entry));
} else {
// Ask for consent to send data to Mr. DLib on first time to tab
setContent(getPrivacyDialog(entry));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@
*/
public class CitationRelationsTab extends EntryEditorTab {

public static final String NAME = "Citation relations";

private static final Logger LOGGER = LoggerFactory.getLogger(CitationRelationsTab.class);

// Tasks used to implement asynchronous fetching of related articles
Expand All @@ -79,12 +81,12 @@ public CitationRelationsTab(DialogService dialogService,
StateManager stateManager,
FileUpdateMonitor fileUpdateMonitor,
PreferencesService preferencesService,
LibraryTab lTab,
LibraryTab libraryTab,
TaskExecutor taskExecutor) {
this.dialogService = dialogService;
this.databaseContext = databaseContext;
this.preferencesService = preferencesService;
this.libraryTab = lTab;
this.libraryTab = libraryTab;
this.taskExecutor = taskExecutor;
setText(Localization.lang("Citation relations"));
setTooltip(new Tooltip(Localization.lang("Show articles related by citation")));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public void listen(SharedEntriesNotPresentEvent event) {

libraryTab.getUndoManager().addEdit(new UndoableRemoveEntries(libraryTab.getDatabase(), event.getBibEntries()));

if (entryEditor != null && (event.getBibEntries().contains(entryEditor.getEntry()))) {
if (entryEditor != null && (event.getBibEntries().contains(entryEditor.getCurrentlyEditedEntry()))) {
dialogService.showInformationDialogAndWait(Localization.lang("Shared entry is no longer present"),
Localization.lang("The entry you currently work on has been deleted on the shared side.")
+ "\n"
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/csl-styles

0 comments on commit c39b382

Please sign in to comment.