Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into fix-for-issue-6994
Browse files Browse the repository at this point in the history
  • Loading branch information
Fu188 committed Jan 31, 2021
2 parents 780e5f3 + e4c83cf commit 12dad55
Show file tree
Hide file tree
Showing 119 changed files with 3,844 additions and 1,696 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve

### Changed

- We improved the "Find unlinked files" dialog to show import results for each file. [#7209](https://github.com/JabRef/jabref/pull/7209)
- The content of the field `timestamp` is migrated to `creationdate`. In case one configured "udpate timestampe", it is migrated to `modificationdate`. [koppor#130](https://github.com/koppor/jabref/issues/130)
- The JabRef specific meta-data content in the main field such as priorities (prio1, prio2, ...) are migrated to their respective fields. They are removed from the keywords. [#6840](https://github.com/jabref/jabref/issues/6840)
- We fixed an issue where groups generated from authors' last names did not include all entries of the authors' [#5833](https://github.com/JabRef/jabref/issues/5833)
Expand All @@ -30,12 +31,17 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve
- We fixed an issue with the style of highlighted check boxes while searching in preferences. [#7226](https://github.com/JabRef/jabref/issues/7226)
- We fixed an issue where the option "Move file to file directory" was disabled in the entry editor for all files [#7194](https://github.com/JabRef/jabref/issues/7194)
- We fixed an issue where application dialogs were opening in the wrong display when using multiple screens [#7273](https://github.com/JabRef/jabref/pull/7273)
- We fixed an issue where the "Find unlinked files" dialog would freeze JabRef on importing. [#7205](https://github.com/JabRef/jabref/issues/7205)
- We fixed an issue where the "Find unlinked files" would stop importing when importing a single file failed. [#7206](https://github.com/JabRef/jabref/issues/7206)
- We fixed an issue where an exception would be displayed for previewing and preferences when a custom theme has been configured but is missing [#7177](https://github.com/JabRef/jabref/issues/7177)
- We fixed an issue where URLs in `file` fields could not be handled on Windows. [#7359](https://github.com/JabRef/jabref/issues/7359)
- We fixed an issue where the regex based file search miss-interpreted specific symbols. [#4342](https://github.com/JabRef/jabref/issues/4342)
- We fixed an issue where the Harvard RTF exporter used the wrong default file extension. [4508](https://github.com/JabRef/jabref/issues/4508)
- We fixed an issue where the Harvard RTF exporter did not use the new authors formatter and therefore did not export "organization" authors correctly. [4508](https://github.com/JabRef/jabref/issues/4508)
- We fixed an issue where the field `urldate` was not exported to the corresponding fields `YearAccessed`, `MonthAccessed`, `DayAccessed` in MS Office XML [#7354](https://github.com/JabRef/jabref/issues/7354)
- We fixed an issue where the password for a shared SQL database was only remembered if it was the same as the username [#6869](https://github.com/JabRef/jabref/issues/6869)
- We fixed an issue where alt+keyboard shortcuts do not work [#6994](https://github.com/JabRef/jabref/issues/6994)
- We fixed an issue where the file path is invisible in dark theme. [#7382](https://github.com/JabRef/jabref/issues/7382)

### Removed

Expand Down
4 changes: 4 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ java {

application {
mainClassName = "org.jabref.gui.JabRefLauncher"
mainModule = 'org.jabref'
}

// TODO: Ugly workaround to temporarily ignore build errors to dependencies of latex2unicode
Expand Down Expand Up @@ -132,6 +133,9 @@ dependencies {

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

implementation group: 'com.fasterxml.jackson.dataformat', name: 'jackson-dataformat-yaml', version: '2.12.0-rc2'
implementation group: 'com.fasterxml.jackson.datatype', name: 'jackson-datatype-jsr310', version: '2.12.0-rc2'

implementation group: 'org.mariadb.jdbc', name: 'mariadb-java-client', version: '2.7.1'

implementation 'org.postgresql:postgresql:42.2.18'
Expand Down
2 changes: 2 additions & 0 deletions config/checkstyle/suppressions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@

<suppressions>
<suppress checks="[a-zA-Z0-9]*" files="[\\/]generated[\\/]" />
<!-- We ignore this file because it's a modification of the original java code https://github.com/openjdk/jfx/blob/jfx15/modules/javafx.controls/src/main/java/javafx/scene/control/skin/TitledPaneSkin.java -->
<suppress checks="[a-zA-Z0-9]*" files="CustomTitledPaneSkin.java" />
</suppressions>
56 changes: 56 additions & 0 deletions docs/adr/0018-use-Jackson-to-parse-study-yml.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Use Jackson to parse study.yml

## Context and Problem Statement

The study definition file is formulated as a YAML document.
To accessed the definition within JabRef this document has to be parsed.
What parser should be used to parse YAML files?

## Considered Options

* [Jackson](https://github.com/FasterXML/jackson-dataformat-yaml)
* [SnakeYAML Engine](https://bitbucket.org/asomov/snakeyaml)
* [yamlbeans](https://github.com/EsotericSoftware/yamlbeans)
* [eo-yaml](https://github.com/decorators-squad/eo-yaml)
* Self-written parser

## Decision Outcome

Chosen option: Jackson, because as it is a dedicated library for parsing YAML. yamlbeans also seem to be viable. They all offer similar functionality

## Pros and Cons of the Options

### Jackson

* Good, because established YAML parser library
* Good, because supports YAML 1.2
* Good, because it can parse LocalDate

### SnakeYAML Engine

* Good, because established YAML parser library
* Good, because supports YAML 1.2
* Bad, because cannot parse YAML into Java DTOs, only into [basic Java structures](https://bitbucket.org/asomov/snakeyaml-engine/src/master/), this then has to be assembled into DTOs

### yamlbeans

* Good, because established YAML parser library
* Good, because [nice getting started page](https://github.com/EsotericSoftware/yamlbeans)
* Bad, because objects need to be annotated in the yaml file to be parsed into Java objects

### eo-yaml

* Good, because established YAML parser library
* Good, because supports YAML 1.2
* Bad, because cannot parse YAML into Java DTOs

### Own parser

* Good, because easily customizable
* Bad, because high effort
* Bad, because has to be tested extensively

## Links

* [Winery's ADR-0009](https://github.com/eclipse/winery/blob/master/docs/adr/0009-manual-tosca-yaml-serialisation.md)
* [Winery's ADR-0010](https://github.com/eclipse/winery/blob/master/docs/adr/0010-tosca-yaml-deserialisation-using-snakeyaml.md)
30 changes: 30 additions & 0 deletions docs/adr/0019-keep-study-as-a-dto.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Keep study as a DTO

## Context and Problem Statement

The study holds query and library entries that could be replaced respectively with complex query and fetcher instances.
This poses the question: should the study remain a pure DTO object or should it contain direct object instances?

## Considered Options

* Keep study as DTO and use transformers
* Replace entries with instances

## Decision Outcome

Chosen option: "Keep study as DTO and use transformators", because comes out best (see below).

## Pros and Cons of the Options

### Keep study as DTO and use transformators

* Good, because no need for custom serialization
* Good, because deactivated fetchers can be documented (important for traceable Searching (SLRs))
* Bad, because Entries for databases and queries needed

### Replace entries with instances

* Good, because no need for database and query entries
* Bad, because custom de-/serializers for fetchers and complex queries needed
* Bad, because harder to maintain than using "vanilla" jackson de-/serialization
*<!-- numbers of pros and cons can vary -->
4 changes: 2 additions & 2 deletions docs/getting-into-the-code/code-howtos.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ Many times there is a need to provide an object on many locations simultaneously
### Register to the `EventBus`
Any listening method has to be annotated with `@Subscribe` keyword and must have only one accepting parameter. Furthermore the object which contains such listening method\(s\) has to be registered using the `register(Object)` method provided by `EventBus`. The listening methods can be overloaded by using different parameter types.
Any listening method has to be annotated with `@Subscribe` keyword and must have only one accepting parameter. Furthermore, the object which contains such listening method\(s\) has to be registered using the `register(Object)` method provided by `EventBus`. The listening methods can be overloaded by using different parameter types.
### Posting an object
Expand Down Expand Up @@ -190,7 +190,7 @@ If the language is a variant of a language `zh_CN` or `pt_BR` it is necessary to

## Cleanup and Formatters

We try to build a cleanup mechanism based on formatters. The idea is that we can register these actions in arbitrary places, e.g., onSave, onImport, onExport, cleanup, etc. and apply them to different fields. The formatters themself are independent of any logic and therefore easy to test.
We try to build a cleanup mechanism based on formatters. The idea is that we can register these actions in arbitrary places, e.g., onSave, onImport, onExport, cleanup, etc. and apply them to different fields. The formatters themselves are independent of any logic and therefore easy to test.

Example: [NormalizePagesFormatter](https://github.com/JabRef/jabref/blob/master/src/main/java/org/jabref/logic/formatter/bibtexfields/NormalizePagesFormatter.java)

Expand Down
3 changes: 3 additions & 0 deletions src/main/java/module-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,7 @@
requires lucene.queryparser;
requires lucene.core;
requires org.eclipse.jgit;
requires com.fasterxml.jackson.databind;
requires com.fasterxml.jackson.dataformat.yaml;
requires com.fasterxml.jackson.datatype.jsr310;
}
31 changes: 30 additions & 1 deletion src/main/java/org/jabref/gui/Base.css
Original file line number Diff line number Diff line change
Expand Up @@ -642,6 +642,10 @@
-fx-background-color: -jr-warn;
}

.file-row-text{
-fx-fill: -jr-search-text;
}

.combo-box-base {
-fx-background-color: -fx-outer-border, -fx-control-inner-background;
-fx-background-insets: 0, 1;
Expand Down Expand Up @@ -690,6 +694,31 @@
-fx-padding: 0;
}

.accordion .titled-pane {
-fx-skin: "org.jabref.gui.util.CustomTitledPaneSkin";
-fx-arrow-side: right;
}

.accordion .titled-pane .title {
-fx-background-color: transparent;
-fx-border-color: transparent;
-fx-background-insets: 5 5 5 5;
}

.accordion .titled-pane > *.content {
-fx-background-color: transparent;
-fx-border-color: transparent;
}

/*
* The arrow button has some right padding that's added
* by "modena.css". This simply puts the padding on the
* left since the arrow is positioned on the right.
*/
.titled-pane > .title > .arrow-button {
-fx-padding: 0.0em 0.0em 0.0em 0.583em;
}

.text-input {
-fx-background-color: -fx-outer-border, -fx-control-inner-background;
-fx-background-insets: 0, 1;
Expand Down Expand Up @@ -1192,6 +1221,6 @@ TextFlow * {

}

.mainTable-header{
.mainTable-header {
-fx-fill: -fx-mid-text-color;
}
2 changes: 1 addition & 1 deletion src/main/java/org/jabref/gui/JabRefFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -797,7 +797,7 @@ private MenuBar createMenu() {

new SeparatorMenuItem(),

factory.createMenuItem(StandardActions.FIND_UNLINKED_FILES, new FindUnlinkedFilesAction(dialogService, prefs, undoManager, stateManager))
factory.createMenuItem(StandardActions.FIND_UNLINKED_FILES, new FindUnlinkedFilesAction(dialogService, stateManager))
);

// PushToApplication
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ public class BibtexExtractorViewModel {
private static final Logger LOGGER = LoggerFactory.getLogger(BibtexExtractorViewModel.class);

private final StringProperty inputTextProperty = new SimpleStringProperty("");
private DialogService dialogService;
private GrobidCitationFetcher currentCitationfetcher;
private TaskExecutor taskExecutor;
private ImportHandler importHandler;
private final DialogService dialogService;
private final GrobidCitationFetcher currentCitationfetcher;
private final TaskExecutor taskExecutor;
private final ImportHandler importHandler;

public BibtexExtractorViewModel(BibDatabaseContext bibdatabaseContext,
DialogService dialogService,
Expand All @@ -48,7 +48,6 @@ public BibtexExtractorViewModel(BibDatabaseContext bibdatabaseContext,
currentCitationfetcher = new GrobidCitationFetcher(preferencesService.getImportFormatPreferences());
this.taskExecutor = taskExecutor;
this.importHandler = new ImportHandler(
dialogService,
bibdatabaseContext,
ExternalFileTypes.getInstance(),
preferencesService,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package org.jabref.gui.externalfiles;

import java.nio.file.DirectoryStream.Filter;
import java.nio.file.Path;
import java.util.List;
import java.util.stream.Collectors;

import org.jabref.gui.externalfiletype.ExternalFileType;
import org.jabref.gui.externalfiletype.ExternalFileTypes;
import org.jabref.gui.icon.JabRefIcon;
import org.jabref.gui.util.FileFilterConverter;
import org.jabref.logic.l10n.Localization;
import org.jabref.logic.util.FileType;

public class FileExtensionViewModel {

private final String description;
private final List<String> extensions;
private final ExternalFileTypes externalFileTypes;

FileExtensionViewModel(FileType fileType, ExternalFileTypes externalFileTypes) {
this.description = Localization.lang("%0 file", fileType.getName());
this.extensions = fileType.getExtensionsWithDot();
this.externalFileTypes = externalFileTypes;
}

public String getDescription() {
return this.description + extensions.stream().collect(Collectors.joining(", ", " (", ")"));
}

public JabRefIcon getIcon() {
return externalFileTypes.getExternalFileTypeByExt(extensions.get(0))
.map(ExternalFileType::getIcon)
.orElse(null);
}

public Filter<Path> dirFilter() {
return FileFilterConverter.toDirFilter(extensions);
}
}
Original file line number Diff line number Diff line change
@@ -1,34 +1,25 @@
package org.jabref.gui.externalfiles;

import javax.swing.undo.UndoManager;

import org.jabref.gui.DialogService;
import org.jabref.gui.StateManager;
import org.jabref.gui.actions.SimpleCommand;
import org.jabref.model.database.BibDatabaseContext;
import org.jabref.preferences.PreferencesService;

import static org.jabref.gui.actions.ActionHelper.needsDatabase;

public class FindUnlinkedFilesAction extends SimpleCommand {

private final DialogService dialogService;
private final PreferencesService preferencesService;
private final UndoManager undoManager;
private final StateManager stateManager;

public FindUnlinkedFilesAction(DialogService dialogService, PreferencesService preferencesService, UndoManager undoManager, StateManager stateManager) {
public FindUnlinkedFilesAction(DialogService dialogService, StateManager stateManager) {
this.dialogService = dialogService;
this.preferencesService = preferencesService;
this.undoManager = undoManager;
this.stateManager = stateManager;

this.executable.bind(needsDatabase(this.stateManager));
}

@Override
public void execute() {
BibDatabaseContext database = stateManager.getActiveDatabase().orElseThrow(() -> new NullPointerException("Database null"));
dialogService.showCustomDialogAndWait(new FindUnlinkedFilesDialog(database, dialogService, preferencesService, undoManager));
dialogService.showCustomDialogAndWait(new UnlinkedFilesDialogView());
}
}
Loading

0 comments on commit 12dad55

Please sign in to comment.