Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into a1-bs
Browse files Browse the repository at this point in the history
  • Loading branch information
BShaq committed Apr 13, 2021
2 parents 9f0d050 + e3094ac commit 4aca5fb
Show file tree
Hide file tree
Showing 15 changed files with 74 additions and 23 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/check-outdated-dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ jobs:
- name: Checkout source
uses: actions/checkout@v2
- name: Set up JDK
uses: actions/setup-java@v1
uses: actions/setup-java@v2
with:
java-version: 14
distribution: 'adopt'
- name: Look for outdated dependencies
run: ./gradlew -q checkOutdatedDependencies
- name: Report issues
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
name: Create installer and portable version for ${{ matrix.displayName }}
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.8.0
uses: styfle/cancel-workflow-action@0.9.0
with:
access_token: ${{ github.token }}
- name: Fetch all history for all tags and branches
Expand All @@ -57,14 +57,16 @@ jobs:
id: gitversion
uses: gittools/actions/gitversion/[email protected]
- name: Set up JDK 15 for linux and mac
uses: actions/setup-java@v1
uses: actions/setup-java@v2
with:
java-version: 15
distribution: 'adopt'
if: matrix.os != 'windows-latest'
- name: Set up JDK 14 for windows
uses: actions/setup-java@v1
uses: actions/setup-java@v2
with:
java-version: 14
distribution: 'adopt'
if: matrix.os == 'windows-latest'
- name: Restore gradle cache
uses: actions/cache@master
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/refresh-journal-lists.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
persist-credentials: false
fetch-depth: 0
- name: Set up JDK
uses: actions/setup-java@v1
uses: actions/setup-java@v2
with:
java-version: 14
- uses: actions/cache@v1
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/tests-fetchers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,10 @@ jobs:
- name: Checkout source
uses: actions/checkout@v2
- name: Set up JDK
uses: actions/setup-java@v1
uses: actions/setup-java@v2
with:
java-version: 14
distribution: 'adopt'
- uses: actions/cache@v1
name: Restore gradle cache
with:
Expand Down
17 changes: 11 additions & 6 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,16 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.8.0
uses: styfle/cancel-workflow-action@0.9.0
with:
access_token: ${{ github.token }}
- name: Checkout source
uses: actions/checkout@v2
- name: Set up JDK
uses: actions/setup-java@v1
uses: actions/setup-java@v2
with:
java-version: 14
distribution: 'adopt'
- uses: actions/cache@v1
name: Restore gradle cache
with:
Expand Down Expand Up @@ -60,9 +61,10 @@ jobs:
- name: Checkout source
uses: actions/checkout@v2
- name: Set up JDK
uses: actions/setup-java@v1
uses: actions/setup-java@v2
with:
java-version: 14
distribution: 'adopt'
- uses: actions/cache@v1
name: Restore gradle cache
with:
Expand Down Expand Up @@ -104,9 +106,10 @@ jobs:
- name: Checkout source
uses: actions/checkout@v2
- name: Set up JDK
uses: actions/setup-java@v1
uses: actions/setup-java@v2
with:
java-version: 14
distribution: 'adopt'
- uses: actions/cache@v1
name: Restore gradle cache
with:
Expand Down Expand Up @@ -150,9 +153,10 @@ jobs:
- name: Checkout source
uses: actions/checkout@v2
- name: Set up JDK
uses: actions/setup-java@v1
uses: actions/setup-java@v2
with:
java-version: 14
distribution: 'adopt'
- uses: actions/cache@v1
name: Restore gradle cache
with:
Expand Down Expand Up @@ -200,9 +204,10 @@ jobs:
- name: Checkout source
uses: actions/checkout@v2
- name: Set up JDK
uses: actions/setup-java@v1
uses: actions/setup-java@v2
with:
java-version: 14
distribution: 'adopt'
- uses: actions/cache@v1
name: Restore gradle cache
with:
Expand Down
2 changes: 1 addition & 1 deletion .markdownlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ MD031: false

MD033:
# we have <a> tags with ids and superscript
allowed_elements: ['a', 'sup']
allowed_elements: ['a', 'kbd', 'sup']
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve

### Added

- We added a progress counter to the title bar in Possible Duplicates dialog window. [#7366](https://github.com/JabRef/jabref/issues/7366)
- We added new "Customization" tab to the preferences which includes option to choose a custom address for DOI access. [#7337](https://github.com/JabRef/jabref/issues/7337)
- We added zbmath to the public databases from which the bibliographic information of an existing entry can be updated. [#7437](https://github.com/JabRef/jabref/issues/7437)
- We added the possibility to add a new entry via its zbMath ID (zbMATH can be chosen as ID type in the "Select entry type" window). [#7202](https://github.com/JabRef/jabref/issues/7202)
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ dependencies {
testImplementation 'net.bytebuddy:byte-buddy-parent:1.10.22'
testRuntime group: 'org.apache.logging.log4j', name: 'log4j-core', version: '3.0.0-SNAPSHOT'
testRuntime group: 'org.apache.logging.log4j', name: 'log4j-jul', version: '3.0.0-SNAPSHOT'
testImplementation 'org.mockito:mockito-core:3.8.0'
testImplementation 'org.mockito:mockito-core:3.9.0'
testImplementation 'org.xmlunit:xmlunit-core:2.8.2'
testImplementation 'org.xmlunit:xmlunit-matchers:2.8.2'
testRuntime 'com.tngtech.archunit:archunit-junit5-engine:0.17.0'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ This guide explains how to set up your environment for development of JabRef. It
```text
The most important step is to configure your IDE.
In case you know how to install JDK15 with JavaFX support and to fork JabRef's code,
please scroll down to the IDE setup.
please scroll down to the IDE setup.
```

For a complete step-by-step guide for Linux using IntelliJ IDEA as the IDE, have a look at the following video instructions:
Expand All @@ -20,7 +20,7 @@ This section list the prerequisites you need to get started to develop JabRef. A

A working Java \(Develoment Kit\) 15 installation with Java FX support is required. In the command line \(terminal in Linux, cmd in Windows\) run `javac -version` and make sure that the reported version is Java 15 \(e.g `javac 15`\). If `javac` is not found or a wrong version is reported, check your `PATH` environment variable, your `JAVA_HOME` environment variable or install the most recent JDK.

[JavaFX is not part of the default JDK any more](https://www.reddit.com/r/java/comments/82qm9x/javafx_will_be_removed_from_the_java_jdk_in_jdk_11/), it needs to be installed separately if not using a special JDK. ~~We recommend to setup the full Liberica JDK including JavaFX. You can get it from~~ [~~https://bell-sw.com/pages/downloads/?version=java-15&package=jdk-full~~](https://bell-sw.com/pages/downloads/?version=java-15&package=jdk-full)~~. On Windows, you can execute `choco install libericajdkfull` \(requires~~ [~~installation of chocolatey - a package manager for Windows~~](https://chocolatey.org/install)~~\).~~ \(Liberica JDK 15 does not include the Java compiler properly any more\)
[JavaFX is not part of the default JDK any more](https://www.reddit.com/r/java/comments/82qm9x/javafx_will_be_removed_from_the_java_jdk_in_jdk_11/), it needs to be installed separately if not using a special JDK.

Download and install the JDK from [https://jdk.java.net/](https://jdk.java.net/). Afterwards, download the "jmods" JavaFX 15 zip archive from [https://gluonhq.com/products/javafx/](https://gluonhq.com/products/javafx/) and put the `.jmod` files into `C:\Program Files\OpenJDK\jdk-15\jmods`.

Expand Down Expand Up @@ -92,7 +92,7 @@ This section explains how you get the JabRef code onto your machine in a form al

## Configure your IDE

These steps are very important. They allow you to focus on the content and ensure that the code formatting always goes well. Did you know that [IntelliJ allows for reformatting selected code](https://www.jetbrains.com/help/idea/reformat-and-rearrange-code.html#reformat_code) if you press Ctrl+Alt+L?
These steps are very important. They allow you to focus on the content and ensure that the code formatting always goes well. Did you know that [IntelliJ allows for reformatting selected code](https://www.jetbrains.com/help/idea/reformat-and-rearrange-code.html#reformat_code) if you press <kbd>Ctrl</kbd> + <kbd>Alt</kbd> + <kbd>L</kbd>?

### Configuration of IntelliJ IDEA

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;

import javafx.beans.binding.Bindings;
import javafx.beans.property.SimpleIntegerProperty;
import javafx.beans.property.SimpleStringProperty;

import org.jabref.gui.DialogService;
import org.jabref.gui.Globals;
import org.jabref.gui.JabRefExecutorService;
Expand Down Expand Up @@ -41,6 +45,9 @@ public class DuplicateSearch extends SimpleCommand {
private final AtomicBoolean libraryAnalyzed = new AtomicBoolean();
private final AtomicBoolean autoRemoveExactDuplicates = new AtomicBoolean();
private final AtomicInteger duplicateCount = new AtomicInteger();
private final SimpleStringProperty duplicateCountObservable = new SimpleStringProperty();
private final SimpleStringProperty duplicateTotal = new SimpleStringProperty();
private final SimpleIntegerProperty duplicateProgress = new SimpleIntegerProperty(0);
private final DialogService dialogService;
private final StateManager stateManager;

Expand All @@ -67,6 +74,8 @@ public void execute() {
return;
}

duplicateCountObservable.addListener((obj, oldValue, newValue) -> DefaultTaskExecutor.runAndWaitInJavaFXThread(() -> duplicateTotal.set(newValue)));

JabRefExecutorService.INSTANCE.executeInterruptableTask(() -> searchPossibleDuplicates(entries, database.getMode()), "DuplicateSearcher");
BackgroundTask.wrap(this::verifyDuplicates)
.onSuccess(this::handleDuplicates)
Expand All @@ -85,7 +94,7 @@ private void searchPossibleDuplicates(List<BibEntry> entries, BibDatabaseMode da

if (new DuplicateCheck(Globals.entryTypesManager).isDuplicate(first, second, databaseMode)) {
duplicates.add(Arrays.asList(first, second));
duplicateCount.getAndIncrement();
duplicateCountObservable.set(String.valueOf(duplicateCount.incrementAndGet()));
}
}
}
Expand All @@ -96,6 +105,8 @@ private DuplicateSearchResult verifyDuplicates() {
DuplicateSearchResult result = new DuplicateSearchResult();

while (!libraryAnalyzed.get() || !duplicates.isEmpty()) {
duplicateProgress.set(duplicateProgress.getValue() + 1);

List<BibEntry> dups;
try {
// poll with timeout in case the library is not analyzed completely, but contains no more duplicates
Expand Down Expand Up @@ -133,6 +144,8 @@ private DuplicateSearchResult verifyDuplicates() {
private void askResolveStrategy(DuplicateSearchResult result, BibEntry first, BibEntry second, DuplicateResolverType resolverType) {
DuplicateResolverDialog dialog = new DuplicateResolverDialog(first, second, resolverType, frame.getCurrentLibraryTab().getBibDatabaseContext(), stateManager);

dialog.titleProperty().bind(Bindings.concat(dialog.getTitle()).concat(" (").concat(duplicateProgress.getValue()).concat("/").concat(duplicateTotal).concat(")"));

DuplicateResolverResult resolverResult = dialogService.showCustomDialogAndWait(dialog)
.orElse(DuplicateResolverResult.BREAK);

Expand Down Expand Up @@ -172,6 +185,8 @@ private void handleDuplicates(DuplicateSearchResult result) {
libraryTab.markBaseChanged();
}

duplicateProgress.set(0);

dialogService.notify(Localization.lang("Duplicates found") + ": " + duplicateCount.get() + ' '
+ Localization.lang("pairs processed") + ": " + result.getDuplicateCount());
compoundEdit.end();
Expand Down
8 changes: 5 additions & 3 deletions src/main/java/org/jabref/gui/groups/GroupDialogViewModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,11 @@ private void setupValidation() {
}
return true;
},
ValidationMessage.error(Localization.lang("There exists already a group with the same name.")));
ValidationMessage.warning(
Localization.lang("There exists already a group with the same name.") + "\n" +
Localization.lang("If you use it, it will inherit all entries from this other group.")
)
);

keywordRegexValidator = new FunctionBasedValidator<>(
keywordGroupSearchTermProperty,
Expand Down Expand Up @@ -234,8 +238,6 @@ private void setupValidation() {
},
ValidationMessage.error(Localization.lang("Please provide a valid aux file.")));

validator.addValidators(nameValidator, sameNameValidator);

typeSearchProperty.addListener((obs, _oldValue, isSelected) -> {
if (isSelected) {
validator.addValidators(searchRegexValidator, searchSearchTermEmptyValidator);
Expand Down
25 changes: 23 additions & 2 deletions src/main/java/org/jabref/gui/groups/GroupTreeViewModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,16 @@ public void editGroup(GroupNodeViewModel oldGroup) {
boolean removePreviousAssignments = (oldGroup.getGroupNode().getGroup() instanceof ExplicitGroup)
&& (group instanceof ExplicitGroup);

int groupsWithSameName = 0;
Optional<GroupTreeNode> databaseRootGroup = currentDatabase.get().getMetaData().getGroups();
if (databaseRootGroup.isPresent()) {
String name = oldGroup.getGroupNode().getGroup().getName();
groupsWithSameName = databaseRootGroup.get().findChildrenSatisfying(g -> g.getName().equals(name)).size();
}
if (groupsWithSameName >= 2) {
removePreviousAssignments = false;
}

oldGroup.getGroupNode().setGroup(
group,
keepPreviousAssignments,
Expand Down Expand Up @@ -236,6 +246,9 @@ public void removeSubgroups(GroupNodeViewModel group) {
/// TODO: Add undo
// final UndoableModifySubtree undo = new UndoableModifySubtree(getGroupTreeRoot(), node, "Remove subgroups");
// panel.getUndoManager().addEdit(undo);
for (GroupNodeViewModel child : group.getChildren()) {
removeGroupsAndSubGroupsFromEntries(child);
}
group.getGroupNode().removeAllChildren();
dialogService.notify(Localization.lang("Removed all subgroups of group \"%0\".", group.getDisplayName()));
writeGroupChangesToMetaData();
Expand Down Expand Up @@ -290,8 +303,16 @@ void removeGroupsAndSubGroupsFromEntries(GroupNodeViewModel group) {

// only remove explicit groups from the entries, keyword groups should not be deleted
if (group.getGroupNode().getGroup() instanceof ExplicitGroup) {
List<BibEntry> entriesInGroup = group.getGroupNode().getEntriesInGroup(this.currentDatabase.get().getEntries());
group.getGroupNode().removeEntriesFromGroup(entriesInGroup);
int groupsWithSameName = 0;
String name = group.getGroupNode().getGroup().getName();
Optional<GroupTreeNode> rootGroup = currentDatabase.get().getMetaData().getGroups();
if (rootGroup.isPresent()) {
groupsWithSameName = rootGroup.get().findChildrenSatisfying(g -> g.getName().equals(name)).size();
}
if (groupsWithSameName < 2) {
List<BibEntry> entriesInGroup = group.getGroupNode().getEntriesInGroup(this.currentDatabase.get().getEntries());
group.getGroupNode().removeEntriesFromGroup(entriesInGroup);
}
}
}

Expand Down
1 change: 1 addition & 0 deletions src/main/resources/l10n/JabRef_de.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1757,6 +1757,7 @@ Delete\ '%0'=Lösche Datei '%0'
Delete\ from\ disk=Auf der Festplatte löschen
Remove\ from\ entry=Vom Eintrag entfernen
There\ exists\ already\ a\ group\ with\ the\ same\ name.=Es existiert bereits eine Gruppe mit demselben Namen.
If\ you\ use\ it,\ it\ will\ inherit\ all\ entries\ from\ this\ other\ group.=Wenn Sie diese Name benutzen, wird die neue Gruppe dieselbe Einträge beinhalten wie die bereits vorhandene Gruppe.

Copy\ linked\ file=Verlinkte Datei kopieren
Copy\ linked\ file\ to\ folder...=Verlinkte Datei in den Ordner kopieren...
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/l10n/JabRef_en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1737,6 +1737,7 @@ Delete\ '%0'=Delete '%0'
Delete\ from\ disk=Delete from disk
Remove\ from\ entry=Remove from entry
There\ exists\ already\ a\ group\ with\ the\ same\ name.=There exists already a group with the same name.
If\ you\ use\ it,\ it\ will\ inherit\ all\ entries\ from\ this\ other\ group.=If you use it, it will inherit all entries from this other group.
Copy\ linked\ file=Copy linked file
Copy\ linked\ file\ to\ folder...=Copy linked file to folder...
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/l10n/JabRef_ru.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1752,6 +1752,7 @@ Delete\ '%0'=Удалить '%0'
Delete\ from\ disk=Удалить с диска
Remove\ from\ entry=Удалить из записи
There\ exists\ already\ a\ group\ with\ the\ same\ name.=Группа с таким именем уже существует.
If\ you\ use\ it,\ it\ will\ inherit\ all\ entries\ from\ this\ other\ group.=Если Вы используете это имя, новая группа будет содержать те же записи, что и уже существующая.

Copy\ linked\ file=Копировать связанный файл
Copy\ linked\ file\ to\ folder...=Копировать прикрепленный файл в папку...
Expand Down

0 comments on commit 4aca5fb

Please sign in to comment.