Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into fix-for-issue-348
Browse files Browse the repository at this point in the history
* upstream/main:
  Fix CHANGELOG.md
  Bump commons-cli:commons-cli from 1.5.0 to 1.6.0 (JabRef#10607)
  Fix issue JabRef#9306: Move "Open only one instance of JabRef" preference option to somewhere else (JabRef#10602)
  Update README.md (JabRef#10604)
  Bump me.champeau.jmh from 0.7.1 to 0.7.2
  Bump org.beryx.jlink from 3.0.0 to 3.0.1
  Bump com.dlsc.gemsfx:gemsfx from 1.82.0 to 1.84.0
  Bump org.apache.logging.log4j:log4j-to-slf4j from 2.21.0 to 2.21.1

# Conflicts:
#	src/main/resources/l10n/JabRef_en.properties
  • Loading branch information
Siedlerchr committed Nov 1, 2023
2 parents 6fa25c7 + dc2b649 commit 2997e90
Show file tree
Hide file tree
Showing 12 changed files with 148 additions and 121 deletions.
7 changes: 4 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,14 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv

### Changed

- The two previews in the change resolver dialog now have their scrollbars synchronized [#9576](https://github.com/JabRef/jabref/issues/9576).
- We moved the location of the 'Open only one instance of JabRef' preference option from "Network" to "General". [#9306](https://github.com/JabRef/jabref/issues/9306)
- The two previews in the change resolver dialog now have their scrollbars synchronized. [#9576](https://github.com/JabRef/jabref/issues/9576).
- We changed the setting of the keyword separator to accept a single character only. [#177](https://github.com/koppor/jabref/issues/177)

### Fixed

- We fixed an issue where the added protected term has unwanted leading and trailing whitespaces, where the formatted text has unwanted empty brackets and where the word at the cursor in the textbox can be added to the list [#10415](https://github.com/JabRef/jabref/issues/10415).
- We fixed an issue where in the merge dialog the file field of entries was not correctly merged when the first and second entry both contained values inside the file field [#10572](https://github.com/JabRef/jabref/issues/10572)
- We fixed an issue where the added protected term has unwanted leading and trailing whitespaces, where the formatted text has unwanted empty brackets and where the word at the cursor in the textbox can be added to the list. [#10415](https://github.com/JabRef/jabref/issues/10415).
- We fixed an issue where in the merge dialog the file field of entries was not correctly merged when the first and second entry both contained values inside the file field. [#10572](https://github.com/JabRef/jabref/issues/10572)

### Removed

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ It supports you in every step of your research work.
- Easily retrieve and link full-text articles
- Fetch complete bibliographic information based on ISBN, DOI, PubMed-ID and arXiv-ID
- Extract metadata from PDFs
- Import new references directly from the browser with one click using the [official browser extension](https://github.com/JabRef/JabRef-Browser-Extension) for [Firefox](https://addons.mozilla.org/en-US/firefox/addon/jabref/?src=external-github), [Chrome](https://chrome.google.com/webstore/detail/jabref-browser-extension/bifehkofibaamoeaopjglfkddgkijdlh), [Edge](https://microsoftedge.microsoft.com/addons/detail/pgkajmkfgbehiomipedjhoddkejohfna) and [Vivaldi](https://chrome.google.com/webstore/detail/jabref-browser-extension/bifehkofibaamoeaopjglfkddgkijdlh)
- Import new references directly from the browser with one click using the [official browser extension](https://github.com/JabRef/JabRef-Browser-Extension) for [Firefox](https://addons.mozilla.org/en-US/firefox/addon/jabref/?src=external-github), [Chrome](https://chrome.google.com/webstore/detail/jabref-browser-extension/bifehkofibaamoeaopjglfkddgkijdlh), [Edge](https://microsoftedge.microsoft.com/addons/detail/pgkajmkfgbehiomipedjhoddkejohfna), and [Vivaldi](https://chrome.google.com/webstore/detail/jabref-browser-extension/bifehkofibaamoeaopjglfkddgkijdlh)

### Organize

- Group your research into hierarchical collections and organize research items based on keywords/tags, search terms or your manual assignments
- Group your research into hierarchical collections and organize research items based on keywords/tags, search terms, or your manual assignments
- Advanced search and filter features
- Complete and fix bibliographic data by comparing with curated online catalogs such as Google Scholar, Springer or MathSciNet
- Complete and fix bibliographic data by comparing with curated online catalogs such as Google Scholar, Springer, or MathSciNet
- Customizable citation key generator
- Customize and add new metadata fields or reference types
- Find and merge duplicates
Expand Down
10 changes: 5 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ plugins {

id 'com.github.andygoossens.modernizer' version '1.9.0'

id 'me.champeau.jmh' version '0.7.1'
id 'me.champeau.jmh' version '0.7.2'

id 'org.javamodularity.moduleplugin' version '1.8.12'

id 'org.openjfx.javafxplugin' version '0.1.0'

id 'org.beryx.jlink' version '3.0.0'
id 'org.beryx.jlink' version '3.0.1'

// nicer test outputs during running and completion
// Homepage: https://github.com/radarsh/gradle-test-logger-plugin
Expand Down Expand Up @@ -130,7 +130,7 @@ dependencies {
// required for reading write-protected PDFs - see https://github.com/JabRef/jabref/pull/942#issuecomment-209252635
implementation 'org.bouncycastle:bcprov-jdk18on:1.76'

implementation 'commons-cli:commons-cli:1.5.0'
implementation 'commons-cli:commons-cli:1.6.0'

implementation 'org.libreoffice:unoloader:7.6.1'
implementation 'org.libreoffice:libreoffice:7.6.1'
Expand Down Expand Up @@ -174,7 +174,7 @@ dependencies {
implementation('com.tobiasdiez:easybind:2.2.1-SNAPSHOT')
implementation 'org.fxmisc.flowless:flowless:0.7.1'
implementation 'org.fxmisc.richtext:richtextfx:0.11.1'
implementation (group: 'com.dlsc.gemsfx', name: 'gemsfx', version: '1.82.0') {
implementation (group: 'com.dlsc.gemsfx', name: 'gemsfx', version: '1.84.0') {
exclude module: 'javax.inject' // Split package, use only jakarta.inject
exclude group: 'org.apache.logging.log4j'
}
Expand All @@ -192,7 +192,7 @@ dependencies {
// route all requests to java.util.logging to SLF4J (which in turn routes to tinylog)
implementation 'org.slf4j:jul-to-slf4j:2.0.9'
// route all requests to log4j to SLF4J
implementation 'org.apache.logging.log4j:log4j-to-slf4j:2.21.0'
implementation 'org.apache.logging.log4j:log4j-to-slf4j:2.21.1'

implementation('de.undercouch:citeproc-java:3.0.0-beta.2') {
exclude group: 'org.antlr'
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/module-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
uses org.mariadb.jdbc.credential.CredentialPlugin;

// Apache Commons and other (similar) helper libraries
requires commons.cli;
requires org.apache.commons.cli;
requires org.apache.commons.csv;
requires org.apache.commons.lang3;
requires com.google.common;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.CheckBox?>
<?import javafx.scene.control.ComboBox?>
<?import javafx.scene.control.Hyperlink?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.Spinner?>
<?import javafx.scene.control.TextField?>
Expand All @@ -13,7 +14,6 @@
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.VBox?>
<?import org.jabref.gui.icon.JabRefIconView?>
<?import javafx.scene.control.Hyperlink?>
<fx:root spacing="10.0" type="VBox"
xmlns="http://javafx.com/javafx" xmlns:fx="http://javafx.com/fxml"
fx:controller="org.jabref.gui.preferences.general.GeneralTab">
Expand Down Expand Up @@ -70,6 +70,13 @@
<CheckBox fx:id="confirmDelete" text="%Show confirmation dialog when deleting entries"/>
<CheckBox fx:id="collectTelemetry" text="%Collect and share telemetry data to help improve JabRef"/>

<Label styleClass="sectionHeader" text="%Single instance" />
<HBox alignment="CENTER_LEFT" spacing="10.0">
<CheckBox fx:id="remoteServer" text="%Enforce single JabRef instance (and allow remote operations) using port" />
<TextField fx:id="remotePort" maxWidth="100.0" HBox.hgrow="ALWAYS" />
<Button fx:id="remoteHelp" prefWidth="20.0" />
</HBox>

<Label styleClass="sectionHeader" text="%Libraries"/>
<GridPane hgap="10.0" vgap="4.0">
<columnConstraints>
Expand Down
16 changes: 15 additions & 1 deletion src/main/java/org/jabref/gui/preferences/general/GeneralTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,13 @@
import org.jabref.logic.l10n.Language;
import org.jabref.logic.l10n.Localization;
import org.jabref.model.database.BibDatabaseMode;
import org.jabref.model.entry.BibEntryTypesManager;
import org.jabref.model.util.FileUpdateMonitor;

import com.airhacks.afterburner.views.ViewLoader;
import com.tobiasdiez.easybind.EasyBind;
import de.saxsys.mvvmfx.utils.validation.visualization.ControlsFxVisualizer;
import jakarta.inject.Inject;

public class GeneralTab extends AbstractPreferenceTabView<GeneralTabViewModel> implements PreferencesTab {

Expand All @@ -49,6 +52,11 @@ public class GeneralTab extends AbstractPreferenceTabView<GeneralTabViewModel> i
@FXML private Button autosaveLocalLibrariesHelp;
@FXML private CheckBox createBackup;
@FXML private TextField backupDirectory;
@FXML private CheckBox remoteServer;
@FXML private TextField remotePort;
@FXML private Button remoteHelp;
@Inject private FileUpdateMonitor fileUpdateMonitor;
@Inject private BibEntryTypesManager entryTypesManager;

private final ControlsFxVisualizer validationVisualizer = new ControlsFxVisualizer();

Expand All @@ -74,7 +82,7 @@ public String getTabName() {
}

public void initialize() {
this.viewModel = new GeneralTabViewModel(dialogService, preferencesService);
this.viewModel = new GeneralTabViewModel(dialogService, preferencesService, fileUpdateMonitor, entryTypesManager);

new ViewModelListCellFactory<Language>()
.withText(Language::getDisplayName)
Expand Down Expand Up @@ -122,15 +130,21 @@ public void initialize() {
autosaveLocalLibraries.selectedProperty().bindBidirectional(viewModel.autosaveLocalLibrariesProperty());
ActionFactory actionFactory = new ActionFactory(preferencesService.getKeyBindingRepository());
actionFactory.configureIconButton(StandardActions.HELP, new HelpAction(HelpFile.AUTOSAVE, dialogService, preferencesService.getFilePreferences()), autosaveLocalLibrariesHelp);
actionFactory.configureIconButton(StandardActions.HELP, new HelpAction(HelpFile.REMOTE, dialogService, preferencesService.getFilePreferences()), remoteHelp);

createBackup.selectedProperty().bindBidirectional(viewModel.createBackupProperty());
backupDirectory.textProperty().bindBidirectional(viewModel.backupDirectoryProperty());
backupDirectory.disableProperty().bind(viewModel.createBackupProperty().not());

Platform.runLater(() -> {
validationVisualizer.initVisualization(viewModel.remotePortValidationStatus(), remotePort);
validationVisualizer.initVisualization(viewModel.fontSizeValidationStatus(), fontSize);
validationVisualizer.initVisualization(viewModel.customPathToThemeValidationStatus(), customThemePath);
});

remoteServer.selectedProperty().bindBidirectional(viewModel.remoteServerProperty());
remotePort.textProperty().bindBidirectional(viewModel.remotePortProperty());
remotePort.disableProperty().bind(remoteServer.selectedProperty().not());
}

@FXML
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;

import javafx.beans.property.BooleanProperty;
import javafx.beans.property.ListProperty;
Expand All @@ -19,18 +20,26 @@
import javafx.scene.control.SpinnerValueFactory;

import org.jabref.gui.DialogService;
import org.jabref.gui.Globals;
import org.jabref.gui.desktop.JabRefDesktop;
import org.jabref.gui.preferences.PreferenceTabViewModel;
import org.jabref.gui.remote.CLIMessageHandler;
import org.jabref.gui.theme.Theme;
import org.jabref.gui.theme.ThemeTypes;
import org.jabref.gui.util.DirectoryDialogConfiguration;
import org.jabref.gui.util.FileDialogConfiguration;
import org.jabref.logic.l10n.Language;
import org.jabref.logic.l10n.Localization;
import org.jabref.logic.net.ssl.TrustStoreManager;
import org.jabref.logic.remote.RemotePreferences;
import org.jabref.logic.remote.RemoteUtil;
import org.jabref.logic.util.StandardFileType;
import org.jabref.model.database.BibDatabaseMode;
import org.jabref.model.entry.BibEntryTypesManager;
import org.jabref.model.strings.StringUtil;
import org.jabref.model.util.FileUpdateMonitor;
import org.jabref.preferences.FilePreferences;
import org.jabref.preferences.InternalPreferences;
import org.jabref.preferences.LibraryPreferences;
import org.jabref.preferences.PreferencesService;
import org.jabref.preferences.TelemetryPreferences;
Expand Down Expand Up @@ -81,19 +90,33 @@ public class GeneralTabViewModel implements PreferenceTabViewModel {
private final TelemetryPreferences telemetryPreferences;
private final LibraryPreferences libraryPreferences;
private final FilePreferences filePreferences;
private final RemotePreferences remotePreferences;

private final Validator fontSizeValidator;
private final Validator customPathToThemeValidator;

private final List<String> restartWarning = new ArrayList<>();

public GeneralTabViewModel(DialogService dialogService, PreferencesService preferences) {
private final BooleanProperty remoteServerProperty = new SimpleBooleanProperty();
private final StringProperty remotePortProperty = new SimpleStringProperty("");
private final Validator remotePortValidator;
private final InternalPreferences internalPreferences;
private final BooleanProperty versionCheckProperty = new SimpleBooleanProperty();
private final FileUpdateMonitor fileUpdateMonitor;
private final BibEntryTypesManager entryTypesManager;
private TrustStoreManager trustStoreManager;

public GeneralTabViewModel(DialogService dialogService, PreferencesService preferences, FileUpdateMonitor fileUpdateMonitor, BibEntryTypesManager entryTypesManager) {
this.dialogService = dialogService;
this.preferences = preferences;
this.workspacePreferences = preferences.getWorkspacePreferences();
this.telemetryPreferences = preferences.getTelemetryPreferences();
this.libraryPreferences = preferences.getLibraryPreferences();
this.filePreferences = preferences.getFilePreferences();
this.remotePreferences = preferences.getRemotePreferences();
this.internalPreferences = preferences.getInternalPreferences();
this.fileUpdateMonitor = fileUpdateMonitor;
this.entryTypesManager = entryTypesManager;
this.trustStoreManager = trustStoreManager;

fontSizeValidator = new FunctionBasedValidator<>(
fontSizeProperty,
Expand All @@ -116,6 +139,27 @@ public GeneralTabViewModel(DialogService dialogService, PreferencesService prefe
Localization.lang("General"),
Localization.lang("Visual theme"),
Localization.lang("Please specify a css theme file."))));

remotePortValidator = new FunctionBasedValidator<>(
remotePortProperty,
input -> {
try {
int portNumber = Integer.parseInt(remotePortProperty().getValue());
return RemoteUtil.isUserPort(portNumber);
} catch (NumberFormatException ex) {
return false;
}
},
ValidationMessage.error(String.format("%s > %s %n %n %s",
Localization.lang("Network"),
Localization.lang("Remote operation"),
Localization.lang("You must enter an integer value in the interval 1025-65535"))));

this.trustStoreManager = new TrustStoreManager(Path.of(preferences.getSSLPreferences().getTruststorePath()));
}

public ValidationStatus remotePortValidationStatus() {
return remotePortValidator.getValidationStatus();
}

@Override
Expand All @@ -125,8 +169,10 @@ public void setValues() {
// The light theme is in fact the absence of any theme modifying 'base.css'. Another embedded theme like
// 'dark.css', stored in the classpath, can be introduced in {@link org.jabref.gui.theme.Theme}.
switch (workspacePreferences.getTheme().getType()) {
case DEFAULT -> selectedThemeProperty.setValue(ThemeTypes.LIGHT);
case EMBEDDED -> selectedThemeProperty.setValue(ThemeTypes.DARK);
case DEFAULT ->
selectedThemeProperty.setValue(ThemeTypes.LIGHT);
case EMBEDDED ->
selectedThemeProperty.setValue(ThemeTypes.DARK);
case CUSTOM -> {
selectedThemeProperty.setValue(ThemeTypes.CUSTOM);
customPathToThemeProperty.setValue(workspacePreferences.getTheme().getName());
Expand All @@ -151,6 +197,9 @@ public void setValues() {

createBackupProperty.setValue(filePreferences.shouldCreateBackup());
backupDirectoryProperty.setValue(filePreferences.getBackupDirectory().toString());

remoteServerProperty.setValue(remotePreferences.useRemoteServer());
remotePortProperty.setValue(String.valueOf(remotePreferences.getPort()));
}

@Override
Expand Down Expand Up @@ -185,6 +234,38 @@ public void storeSettings() {

filePreferences.createBackupProperty().setValue(createBackupProperty.getValue());
filePreferences.backupDirectoryProperty().setValue(Path.of(backupDirectoryProperty.getValue()));

getPortAsInt(remotePortProperty.getValue()).ifPresent(newPort -> {
if (remotePreferences.isDifferentPort(newPort)) {
remotePreferences.setPort(newPort);
}
});

internalPreferences.setVersionCheckEnabled(versionCheckProperty.getValue());

getPortAsInt(remotePortProperty.getValue()).ifPresent(newPort -> {
if (remotePreferences.isDifferentPort(newPort)) {
remotePreferences.setPort(newPort);
}
});

if (remoteServerProperty.getValue()) {
remotePreferences.setUseRemoteServer(true);
Globals.REMOTE_LISTENER.openAndStart(new CLIMessageHandler(preferences, fileUpdateMonitor, entryTypesManager), remotePreferences.getPort());
} else {
remotePreferences.setUseRemoteServer(false);
Globals.REMOTE_LISTENER.stop();
}
trustStoreManager.flush();

if (remoteServerProperty.getValue()) {
remotePreferences.setUseRemoteServer(true);
Globals.REMOTE_LISTENER.openAndStart(new CLIMessageHandler(preferences, fileUpdateMonitor, entryTypesManager), remotePreferences.getPort());
} else {
remotePreferences.setUseRemoteServer(false);
Globals.REMOTE_LISTENER.stop();
}
trustStoreManager.flush();
}

public ValidationStatus fontSizeValidationStatus() {
Expand All @@ -199,6 +280,10 @@ public ValidationStatus customPathToThemeValidationStatus() {
public boolean validateSettings() {
CompositeValidator validator = new CompositeValidator();

if (remoteServerProperty.getValue()) {
validator.addValidators(remotePortValidator);
}

if (fontOverrideProperty.getValue()) {
validator.addValidators(fontSizeValidator);
}
Expand Down Expand Up @@ -310,6 +395,14 @@ public void backupFileDirBrowse() {
.ifPresent(dir -> backupDirectoryProperty.setValue(dir.toString()));
}

public BooleanProperty remoteServerProperty() {
return remoteServerProperty;
}

public StringProperty remotePortProperty() {
return remotePortProperty;
}

public void openBrowser() {
String url = "https://themes.jabref.org";
try {
Expand All @@ -318,4 +411,12 @@ public void openBrowser() {
dialogService.showErrorDialogAndWait(Localization.lang("Could not open website."), e);
}
}

private Optional<Integer> getPortAsInt(String value) {
try {
return Optional.of(Integer.parseInt(value));
} catch (NumberFormatException ex) {
return Optional.empty();
}
}
}
Loading

0 comments on commit 2997e90

Please sign in to comment.