Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into addcustomjdbc
Browse files Browse the repository at this point in the history
* upstream/main:
  Update latex citations status in JavaFx thread (#11302)
  Remove EnglishStemAnalyzer and use EnglishAnalyzer (#11301)
  Fix comment (#11299)
  Try gradle build speedup (#11300)
  Remove obsolete step (#11295)
  Bump com.fasterxml.jackson.dataformat:jackson-dataformat-yaml (#11290)
  Remove outdated pdf indexed files from Lucene index (#11293)
  Bump src/main/resources/csl-styles from `5338902` to `434df0a` (#11292)
  Bump org.mockito:mockito-core from 5.11.0 to 5.12.0 (#11291)
  Bump com.fasterxml.jackson.datatype:jackson-datatype-jsr310 (#11289)
  Bump com.dlsc.gemsfx:gemsfx from 2.12.0 to 2.16.0 (#11287)
  Bump org.openrewrite.recipe:rewrite-recipe-bom from 2.9.0 to 2.11.0 (#11288)
  Introduce formatter to remove word-enclosing braces (#11253)
  Try parallel tests (#9797)
  Store preview divider pos in entry editor (#11285)
  • Loading branch information
Siedlerchr committed May 19, 2024
2 parents 4cf199b + dfe1b0c commit 0721d98
Show file tree
Hide file tree
Showing 29 changed files with 316 additions and 185 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv
- We added value selection (such as for month) for content selectors in custom entry types. [#11109](https://github.com/JabRef/jabref/issues/11109)
- We added a duplicate checker for the Citation Relations tab. [#10414](https://github.com/JabRef/jabref/issues/10414)
- We added tooltip on main table cells that shows cell content or cell content and entry preview if set in preferences. [10925](https://github.com/JabRef/jabref/issues/10925)
- Added a formatter to remove word enclosing braces. [#11222](https://github.com/JabRef/jabref/issues/11222)
- We added the ability to add a keyword/crossref when typing the separator character (e.g., comma) in the keywords/crossref fields. [#11178](https://github.com/JabRef/jabref/issues/11178)
- We added an exporter and improved the importer for Endnote XML format. [#11137](https://github.com/JabRef/jabref/issues/11137)
- We added support for automatically update LaTeX citations when a LaTeX file is created, removed, or modified. [#10585](https://github.com/JabRef/jabref/issues/10585)
Expand All @@ -38,6 +39,7 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv
- We fixed an issue where drag and dropping entries created a shallow copy. [#11160](https://github.com/JabRef/jabref/issues/11160)
- 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)

### Removed

Expand Down
35 changes: 26 additions & 9 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,8 @@ dependencies {

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

implementation group: 'com.fasterxml.jackson.dataformat', name: 'jackson-dataformat-yaml', version: '2.17.0'
implementation group: 'com.fasterxml.jackson.datatype', name: 'jackson-datatype-jsr310', version: '2.17.0'
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'

implementation 'com.fasterxml:aalto-xml:1.3.2'

Expand Down Expand Up @@ -222,7 +222,7 @@ dependencies {
}
implementation 'org.fxmisc.flowless:flowless:0.7.2'
implementation 'org.fxmisc.richtext:richtextfx:0.11.2'
implementation (group: 'com.dlsc.gemsfx', name: 'gemsfx', version: '2.12.0') {
implementation (group: 'com.dlsc.gemsfx', name: 'gemsfx', version: '2.16.0') {
exclude module: 'javax.inject' // Split package, use only jakarta.inject
exclude module: 'commons-lang3'
exclude group: 'org.openjfx'
Expand Down Expand Up @@ -306,7 +306,7 @@ dependencies {
testImplementation 'org.junit.jupiter:junit-jupiter:5.10.2'
testImplementation 'org.junit.platform:junit-platform-launcher:1.10.2'

testImplementation 'org.mockito:mockito-core:5.11.0'
testImplementation 'org.mockito:mockito-core:5.12.0'
testImplementation 'org.xmlunit:xmlunit-core:2.10.0'
testImplementation 'org.xmlunit:xmlunit-matchers:2.10.0'
testRuntimeOnly 'com.tngtech.archunit:archunit-junit5-engine:1.3.0'
Expand All @@ -320,7 +320,7 @@ dependencies {
xjc group: 'org.glassfish.jaxb', name: 'jaxb-xjc', version: '3.0.2'
xjc group: 'org.glassfish.jaxb', name: 'jaxb-runtime', version: '3.0.2'

rewrite(platform("org.openrewrite.recipe:rewrite-recipe-bom:2.9.0"))
rewrite(platform("org.openrewrite.recipe:rewrite-recipe-bom:2.11.0"))
rewrite("org.openrewrite.recipe:rewrite-static-analysis")
rewrite("org.openrewrite.recipe:rewrite-logging-frameworks")
rewrite("org.openrewrite.recipe:rewrite-testing-frameworks")
Expand Down Expand Up @@ -428,6 +428,9 @@ tasks.register('generateCitaviSource', XjcTask) {

tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8'

// hint by https://docs.gradle.org/current/userguide/performance.html#run_the_compiler_as_a_separate_process
options.fork = true
}

compileJava {
Expand Down Expand Up @@ -529,16 +532,32 @@ testlogger {
showStackTraces false
}

tasks.withType(Test) {
reports.html.outputLocation.set(file("${reporting.baseDir}/${name}"))
// Enable parallel tests. See https://docs.gradle.org/8.1/userguide/performance.html#execute_tests_in_parallel for details.
maxParallelForks = Runtime.runtime.availableProcessors() - 1
}

tasks.register('databaseTest', Test) {
useJUnitPlatform {
includeTags 'DatabaseTest'
}

testLogging {
// set options for log level LIFECYCLE
events = ["FAILED"]
exceptionFormat "full"
}

maxParallelForks = 1
}

tasks.register('fetcherTest', Test) {
useJUnitPlatform {
includeTags 'FetcherTest'
}

maxParallelForks = 1
}

tasks.register('guiTest', Test) {
Expand All @@ -551,6 +570,8 @@ tasks.register('guiTest', Test) {
events = ["FAILED"]
exceptionFormat "full"
}

maxParallelForks = 1
}

// Test result tasks
Expand All @@ -560,10 +581,6 @@ tasks.register('copyTestResources', Copy) {
}
processTestResources.dependsOn copyTestResources

tasks.withType(Test) {
reports.html.outputLocation.set(file("${reporting.baseDir}/${name}"))
}

tasks.register('jacocoPrepare') {
doFirst {
// Ignore failures of tests
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,6 @@ After clicking "Download", IntelliJ installs Eclipse Temurin:
![IntelliJ installs Eclipse Temurin](guidelines-intellij-installs-temurin.png)
{% endfigure %}

Open the module settings: Right click on "JabRef" and select "Open Module Settings":

{% figure caption:"Open IntelliJ Module Settings" %}
![IntelliJ Module Settings](guidelines-intellij-open-module-settings.png)
{% endfigure %}

Navigate to **Project Settings > Project** and ensure that the projects' SDK is Java 21.

{% figure caption:"Project SDK is pinned to the downloaded SDK (showing JDK 21 as example)" %}
Expand Down
10 changes: 10 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,12 @@
org.gradle.vs.watch=true

# hint by https://docs.gradle.org/current/userguide/performance.html#increase_the_heap_size
org.gradle.jvmargs=-Xmx4096M

# hint by https://docs.gradle.org/current/userguide/performance.html#enable_configuration_cache
# Does not work:
# - Task `:compileJava` of type `org.gradle.api.tasks.compile.JavaCompile`: cannot serialize object of type 'org.gradle.api.internal.project.DefaultProject', a subtype of 'org.gradle.api.Project', as these are not supported with the configuration cache.
# org.gradle.configuration-cache=false

# hint by https://docs.gradle.org/current/userguide/performance.html#enable_the_build_cache
org.gradle.caching=true
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public static JournalPopupEnabled fromString(String status) {
private final ObjectProperty<JournalPopupEnabled> enablementStatus;
private final BooleanProperty shouldShowSciteTab;
private final BooleanProperty showUserCommentsFields;
private final DoubleProperty previewWidthDividerPosition;

public EntryEditorPreferences(Map<String, Set<Field>> entryEditorTabList,
Map<String, Set<Field>> defaultEntryEditorTabList,
Expand All @@ -62,7 +63,8 @@ public EntryEditorPreferences(Map<String, Set<Field>> entryEditorTabList,
boolean autolinkFilesEnabled,
JournalPopupEnabled journalPopupEnabled,
boolean showSciteTab,
boolean showUserCommentsFields) {
boolean showUserCommentsFields,
double previewWidthDividerPosition) {

this.entryEditorTabList = new SimpleMapProperty<>(FXCollections.observableMap(entryEditorTabList));
this.defaultEntryEditorTabList = new SimpleMapProperty<>(FXCollections.observableMap(defaultEntryEditorTabList));
Expand All @@ -77,6 +79,7 @@ public EntryEditorPreferences(Map<String, Set<Field>> entryEditorTabList,
this.enablementStatus = new SimpleObjectProperty<>(journalPopupEnabled);
this.shouldShowSciteTab = new SimpleBooleanProperty(showSciteTab);
this.showUserCommentsFields = new SimpleBooleanProperty(showUserCommentsFields);
this.previewWidthDividerPosition = new SimpleDoubleProperty(previewWidthDividerPosition);
}

public ObservableMap<String, Set<Field>> getEntryEditorTabs() {
Expand Down Expand Up @@ -226,4 +229,19 @@ public BooleanProperty showUserCommentsFieldsProperty() {
public void setShowUserCommentsFields(boolean showUserCommentsFields) {
this.showUserCommentsFields.set(showUserCommentsFields);
}

public void setPreviewWidthDividerPosition(double previewWidthDividerPosition) {
this.previewWidthDividerPosition.set(previewWidthDividerPosition);
}

/**
* Holds the horizontal divider position when the Preview is shown in the entry editor
*/
public DoubleProperty previewWidthDividerPositionProperty() {
return previewWidthDividerPosition;
}

public Double getPreviewWidthDividerPosition() {
return previewWidthDividerPosition.get();
}
}
15 changes: 15 additions & 0 deletions src/main/java/org/jabref/gui/entryeditor/FieldsEditorTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import org.jabref.preferences.PreferencesService;

import com.tobiasdiez.easybind.EasyBind;
import com.tobiasdiez.easybind.Subscription;

/**
* A single tab displayed in the EntryEditor holding several FieldEditors.
Expand All @@ -61,6 +62,7 @@ abstract class FieldsEditorTab extends EntryEditorTab {
private PreviewPanel previewPanel;
private final UndoManager undoManager;
private Collection<Field> fields = new ArrayList<>();
private Subscription dividerPositionSubscription;

public FieldsEditorTab(boolean compressed,
BibDatabaseContext databaseContext,
Expand Down Expand Up @@ -258,9 +260,22 @@ private void initPanel() {
container.getItems().remove(previewPanel);
} else {
container.getItems().add(1, previewPanel);
container.setDividerPositions(preferences.getEntryEditorPreferences().getPreviewWidthDividerPosition());
}
});

// save position
dividerPositionSubscription = EasyBind.valueAt(container.getDividers(), 0)
.mapObservable(SplitPane.Divider::positionProperty)
.subscribeToValues(this::savePreviewWidthDividerPosition);
setContent(container);
}
}

private void savePreviewWidthDividerPosition(Number position) {
if (!preferences.getPreviewPreferences().shouldShowPreviewAsExtraTab()) {
preferences.getEntryEditorPreferences().setPreviewWidthDividerPosition(position.doubleValue());
}
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ private FileAlterationListener getListener() {
@Override
public void onStart(FileAlterationObserver observer) {
if (!updateStatusOnCreate.get()) {
status.set(Status.IN_PROGRESS);
DefaultTaskExecutor.runInJavaFXThread(() -> status.set(Status.IN_PROGRESS));
}
}

Expand Down
6 changes: 4 additions & 2 deletions src/main/java/org/jabref/logic/formatter/Formatters.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
import org.jabref.logic.formatter.bibtexfields.NormalizeUnicodeFormatter;
import org.jabref.logic.formatter.bibtexfields.OrdinalsToSuperscriptFormatter;
import org.jabref.logic.formatter.bibtexfields.RegexFormatter;
import org.jabref.logic.formatter.bibtexfields.RemoveBracesFormatter;
import org.jabref.logic.formatter.bibtexfields.RemoveEnclosingBracesFormatter;
import org.jabref.logic.formatter.bibtexfields.RemoveWordEnclosingAndOuterEnclosingBracesFormatter;
import org.jabref.logic.formatter.bibtexfields.ShortenDOIFormatter;
import org.jabref.logic.formatter.bibtexfields.UnicodeToLatexFormatter;
import org.jabref.logic.formatter.bibtexfields.UnitsToLatexFormatter;
Expand Down Expand Up @@ -82,7 +83,8 @@ public static List<Formatter> getOthers() {
new NormalizeNamesFormatter(),
new NormalizePagesFormatter(),
new OrdinalsToSuperscriptFormatter(),
new RemoveBracesFormatter(),
new RemoveEnclosingBracesFormatter(),
new RemoveWordEnclosingAndOuterEnclosingBracesFormatter(),
new UnitsToLatexFormatter(),
new EscapeUnderscoresFormatter(),
new EscapeAmpersandsFormatter(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import org.jspecify.annotations.NullMarked;

@NullMarked
public class RemoveBracesFormatter extends Formatter {
public class RemoveEnclosingBracesFormatter extends Formatter {

@Override
public String getName() {
Expand All @@ -18,6 +18,16 @@ public String getKey() {
return "remove_braces";
}

@Override
public String getDescription() {
return Localization.lang("Removes braces encapsulating the complete field content.");
}

@Override
public String getExampleInput() {
return "{In CDMA}";
}

@Override
public String format(String value) {
String formatted = value;
Expand All @@ -37,16 +47,6 @@ public String format(String value) {
return formatted;
}

@Override
public String getDescription() {
return Localization.lang("Removes braces encapsulating the complete field content.");
}

@Override
public String getExampleInput() {
return "{In CDMA}";
}

/**
* Check if a string at any point has had more ending } braces than opening { ones.
* Will e.g. return true for the string "DNA} text {EPA"
Expand Down
Loading

0 comments on commit 0721d98

Please sign in to comment.