-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/master' into fix-for-issue-6994
- Loading branch information
Showing
119 changed files
with
3,844 additions
and
1,696 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
src/main/java/org/jabref/gui/externalfiles/FileExtensionViewModel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |
13 changes: 2 additions & 11 deletions
13
src/main/java/org/jabref/gui/externalfiles/FindUnlinkedFilesAction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()); | ||
} | ||
} |
Oops, something went wrong.