Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/submodules/src/main/resources/csl…
Browse files Browse the repository at this point in the history
…-styles-b90b81a
  • Loading branch information
Siedlerchr authored Nov 25, 2024
2 parents 8ea569d + 23c2ad6 commit 88267d8
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 12 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv
- We changed the defualt [unwanted charachters](https://docs.jabref.org/setup/citationkeypatterns#removing-unwanted-characters) in the citation key generator and allow a dash (`-`) and colon (`:`) being part of a citation key. [#12144](https://github.com/JabRef/jabref/pull/12144)
- The CitationKey column is now a default shown column for the entry table. [#10510](https://github.com/JabRef/jabref/issues/10510)
- We disabled the actions "Open Terminal here" and "Reveal in file explorer" for unsaved libraries. [#11920](https://github.com/JabRef/jabref/issues/11920)
- JabRef now opens the corresponding directory in the library properties when "Browse" is clicked. [#12223](https://github.com/JabRef/jabref/pull/12223)

### Fixed

Expand Down
10 changes: 5 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,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.16'
// route all requests to log4j to SLF4J
implementation 'org.apache.logging.log4j:log4j-to-slf4j:2.24.1'
implementation 'org.apache.logging.log4j:log4j-to-slf4j:2.24.2'

implementation('de.undercouch:citeproc-java:3.1.0') {
exclude group: 'org.antlr'
Expand Down Expand Up @@ -341,7 +341,7 @@ dependencies {
exclude group: 'com.squareup.retrofit2', module: 'retrofit'
exclude group: 'org.jetbrains.kotlin'
}
implementation('dev.langchain4j:langchain4j-mistral-ai:0.36.0') {
implementation('dev.langchain4j:langchain4j-mistral-ai:0.36.2') {
exclude group: 'com.squareup.okhttp3'
exclude group: 'com.squareup.retrofit2', module: 'retrofit'
exclude group: 'org.jetbrains.kotlin'
Expand Down Expand Up @@ -370,17 +370,17 @@ dependencies {
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:2.0.21'
// endregion

implementation 'commons-io:commons-io:2.17.0'
implementation 'commons-io:commons-io:2.18.0'

// Even if "compileOnly" is used, IntelliJ always adds to module-info.java. To avoid issues during committing, we use "implementation" instead of "compileOnly"
implementation 'io.github.adr:e-adr:2.0.0-SNAPSHOT'

implementation 'io.zonky.test:embedded-postgres:2.0.7'
implementation 'io.zonky.test:embedded-postgres:2.1.0'
implementation enforcedPlatform('io.zonky.test.postgres:embedded-postgres-binaries-bom:17.0.0')

testImplementation 'io.github.classgraph:classgraph:4.8.177'
testImplementation 'org.junit.jupiter:junit-jupiter:5.11.3'
testImplementation 'org.junit.platform:junit-platform-launcher:1.10.3'
testImplementation 'org.junit.platform:junit-platform-launcher:1.11.3'

testImplementation 'org.mockito:mockito-core:5.14.2'
testImplementation 'org.xmlunit:xmlunit-core:2.10.0'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Optional;

import javafx.beans.property.BooleanProperty;
import javafx.beans.property.ListProperty;
Expand All @@ -18,6 +20,7 @@
import org.jabref.gui.libraryproperties.PropertiesTabViewModel;
import org.jabref.gui.util.DirectoryDialogConfiguration;
import org.jabref.logic.l10n.Encodings;
import org.jabref.logic.l10n.Localization;
import org.jabref.logic.preferences.CliPreferences;
import org.jabref.logic.shared.DatabaseLocation;
import org.jabref.model.database.BibDatabaseContext;
Expand All @@ -40,16 +43,12 @@ public class GeneralPropertiesViewModel implements PropertiesTabViewModel {

private final BibDatabaseContext databaseContext;
private final MetaData metaData;
private final DirectoryDialogConfiguration directoryDialogConfiguration;

GeneralPropertiesViewModel(BibDatabaseContext databaseContext, DialogService dialogService, CliPreferences preferences) {
this.dialogService = dialogService;
this.preferences = preferences;
this.databaseContext = databaseContext;
this.metaData = databaseContext.getMetaData();

this.directoryDialogConfiguration = new DirectoryDialogConfiguration.Builder()
.withInitialDirectory(preferences.getFilePreferences().getWorkingDirectory()).build();
}

@Override
Expand Down Expand Up @@ -96,16 +95,22 @@ public void storeSettings() {
}

public void browseLibrarySpecificDir() {
DirectoryDialogConfiguration directoryDialogConfiguration = new DirectoryDialogConfiguration.Builder()
.withInitialDirectory(getBrowseDirectory(librarySpecificDirectoryProperty.getValue())).build();
dialogService.showDirectorySelectionDialog(directoryDialogConfiguration)
.ifPresent(dir -> librarySpecificDirectoryProperty.setValue(dir.toAbsolutePath().toString()));
}

public void browseUserDir() {
DirectoryDialogConfiguration directoryDialogConfiguration = new DirectoryDialogConfiguration.Builder()
.withInitialDirectory(getBrowseDirectory(userSpecificFileDirectoryProperty.getValue())).build();
dialogService.showDirectorySelectionDialog(directoryDialogConfiguration)
.ifPresent(dir -> userSpecificFileDirectoryProperty.setValue(dir.toAbsolutePath().toString()));
}

public void browseLatexDir() {
DirectoryDialogConfiguration directoryDialogConfiguration = new DirectoryDialogConfiguration.Builder()
.withInitialDirectory(getBrowseDirectory(laTexFileDirectoryProperty.getValue())).build();
dialogService.showDirectorySelectionDialog(directoryDialogConfiguration)
.ifPresent(dir -> laTexFileDirectoryProperty.setValue(dir.toAbsolutePath().toString()));
}
Expand Down Expand Up @@ -141,4 +146,19 @@ public StringProperty userSpecificFileDirectoryProperty() {
public StringProperty laTexFileDirectoryProperty() {
return this.laTexFileDirectoryProperty;
}

private Path getBrowseDirectory(String configuredDir) {
if (configuredDir.isEmpty()) {
return preferences.getFilePreferences().getWorkingDirectory();
}
Optional<Path> foundPath = this.databaseContext.getFileDirectories(preferences.getFilePreferences()).stream()
.filter(path -> path.toString().endsWith(configuredDir))
.filter(Files::exists).findFirst();

if (foundPath.isEmpty()) {
dialogService.notify(Localization.lang("Path %0 could not be resolved. Using working dir.", configuredDir));
return preferences.getFilePreferences().getWorkingDirectory();
}
return foundPath.get();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -162,10 +162,10 @@ public List<Path> getFileDirectories(FilePreferences preferences) {
// Paths are a) ordered and b) should be contained only once in the result
LinkedHashSet<Path> fileDirs = new LinkedHashSet<>(3);

Optional<Path> userFileDirectory = metaData.getUserFileDirectory(preferences.getUserAndHost()).map(dir -> getFileDirectoryPath(dir));
Optional<Path> userFileDirectory = metaData.getUserFileDirectory(preferences.getUserAndHost()).map(this::getFileDirectoryPath);
userFileDirectory.ifPresent(fileDirs::add);

Optional<Path> librarySpecificFileDirectory = metaData.getLibrarySpecificFileDirectory().map(dir -> getFileDirectoryPath(dir));
Optional<Path> librarySpecificFileDirectory = metaData.getLibrarySpecificFileDirectory().map(this::getFileDirectoryPath);
librarySpecificFileDirectory.ifPresent(fileDirs::add);

// fileDirs.isEmpty() is true after these two if there are no directories set in the BIB file itself:
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/csl-locales
2 changes: 2 additions & 0 deletions src/main/resources/l10n/JabRef_en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1059,6 +1059,8 @@ Expected\ syntax\ for\ --fetch\='<name\ of\ fetcher>\:<query>'=Expected syntax f
Library-specific\ file\ directory=Library-specific file directory
User-specific\ file\ directory=User-specific file directory
LaTeX\ file\ directory=LaTeX file directory
Path\ %0\ could\ not\ be\ resolved.\ Using\ working\ dir.=Path %0 could not be resolved. Using working dir.


You\ must\ enter\ an\ integer\ value\ in\ the\ interval\ 1025-65535=You must enter an integer value in the interval 1025-65535
Autocomplete\ names\ in\ 'Firstname\ Lastname'\ format\ only=Autocomplete names in 'Firstname Lastname' format only
Expand Down

0 comments on commit 88267d8

Please sign in to comment.