Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into feature/use-unkow…
Browse files Browse the repository at this point in the history
…n-fields-as-default-fields
  • Loading branch information
DominikVoigt committed Sep 3, 2020
2 parents 9a8abf8 + 4aa8378 commit 13d90c0
Show file tree
Hide file tree
Showing 175 changed files with 318 additions and 328 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ jobs:
uses: unsplash/comment-on-pr@master
if: steps.authors_check.outputs.newauthor == 'true'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GH_TOKEN_COMMENT_ON_PR }}
with:
msg: "${{ steps.authors_check.outputs.message }}"
check_for_duplicate_msg: true
2 changes: 1 addition & 1 deletion .idea/runConfigurations/JabRef_Main.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ java {
}

application {
mainClassName = "$moduleName/org.jabref.JabRefLauncher"
mainClassName = "$moduleName/org.jabref.gui.JabRefLauncher"
}

// TODO: Ugly workaround to temporarily ignore build errors to dependencies of latex2unicode
Expand Down
2 changes: 1 addition & 1 deletion buildres/linux/JabRef.desktop
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ Type=Application
DESKTOP_MIMES
Categories=DEPLOY_BUNDLE_CATEGORY
Keywords=bibtex;biblatex;latex;bibliography
StartupWMClass=org.jabref.JabRefMain
StartupWMClass=org.jabref.gui.JabRefMain
1 change: 1 addition & 0 deletions docs/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* [Code Quality](advanced-reading/code-quality.md)
* [Recommendations for UI design](advanced-reading/ui-recommendations.md)
* [Custom SVG icons](advanced-reading/custom-svg-icons.md)
* [Working on fetchers](advanced-reading/fetchers.md)
* [Creating a binary and debug it](advanced-reading/jpackage.md)
* [JabRef and Software Engineering](teaching.md)
* [Readings on Coding](readings-on-coding/README.md)
Expand Down
2 changes: 1 addition & 1 deletion docs/advanced-reading/jpackage.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Sometimes issues with modularity only arise in the installed version and do not
3. Modify the `build\image\JabRef\runtime\bin\Jabref.bat` file, replace the last line with

```text
pushd %DIR% & %JAVA_EXEC% -Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=8000,suspend=n -p "%~dp0/../app" -m org.jabref/org.jabref.JabRefLauncher %* & popd
pushd %DIR% & %JAVA_EXEC% -Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=8000,suspend=n -p "%~dp0/../app" -m org.jabref/org.jabref.gui.JabRefLauncher %* & popd
```

4. Open your IDE and add a "Remote Debugging Configuration" for `localhost:8000`
Expand Down
6 changes: 3 additions & 3 deletions docs/getting-into-the-code/code-howtos.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Principles:
Localization.lang("Something went wrong...", ioe);
}
```

* Never, ever throw and catch `Exception` or `Throwable`
* Errors should only be logged when they are finally caught \(i.e., logged only once\). See **Logging** for details.
* If the Exception message is intended to be shown to the User in the UI \(see below\) provide also a localizedMessage \(see `JabRefException`\).
Expand All @@ -51,7 +52,7 @@ TODO: Usage of status bar and Swing Dialogs

## Using the EventSystem

### What the EventSystem is used for?
### What the EventSystem is used for

Many times there is a need to provide an object on many locations simultaneously. This design pattern is quite similar to Java's Observer, but it is much simplier and readable while having the same functional sense.
Expand Down Expand Up @@ -368,7 +369,7 @@ The following expressions can be used in FXML attributes, according to the [offi

All radio buttons that should be grouped together need to have a ToggleGroup defined in the FXML code Example:

```markup
```xml
<VBox>
<fx:define>
<ToggleGroup fx:id="citeToggleGroup"/>
Expand All @@ -383,4 +384,3 @@ All radio buttons that should be grouped together need to have a ToggleGroup def
</children>
</VBox>
```

Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ Make sure your Eclipse installation us up to date, Eclipse JEE 2020-03 or newer
3. Open or import the existing project in Eclipse as Java project.
* Remark: Importing it as gradle project will not work correctly.
* Refresh the project in Eclipse
4. Create a run/debug configuration for the main class `org.jabref.JabRefLauncher` and/or for `org.jabref.JabRefMain` \(both can be used equivalently\)
4. Create a run/debug configuration for the main class `org.jabref.gui.JabRefLauncher` and/or for `org.jabref.gui.JabRefMain` \(both can be used equivalently\)
* Remark: The run/debug configuration needs to be added by right clicking the class \(e.g. JabRefLauncher or JabRefMain\) otherwise it will not work.

![Creating the run/debug configuration by right clicking on the class](../.gitbook/assets/eclipse-create-run-config%20%281%29.png)
Expand All @@ -222,6 +222,7 @@ Make sure your Eclipse installation us up to date, Eclipse JEE 2020-03 or newer
--add-exports javafx.web/com.sun.webkit=org.controlsfx.controls
--add-exports javafx.graphics/com.sun.javafx.css=org.controlsfx.controls
--add-exports javafx.controls/com.sun.javafx.scene.control.behavior=com.jfoenix
--add-exports javafx.graphics/com.sun.javafx.stage=com.jfoenix
--add-exports com.oracle.truffle.regex/com.oracle.truffle.regex=org.graalvm.truffle
--patch-module org.jabref=build/resources/main
```
Expand Down
2 changes: 1 addition & 1 deletion scripts/generate-authors.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,5 @@ cd "$(dirname "$(readlink -f "$BASH_SOURCE")")/.."

# co-authors
coauthors=$(git log -i --grep=co-authored-by | grep -i "co-authored-by" | sed "s/.*co-authored-by: \(.*\)/\1/I" | sed "s/ <.*//")
echo -e "$authors\n$(git log --format='%aN')\n$coauthors" | grep -v "\[bot\]" | grep -v "JabRef" | grep -v "Siedlerchr" | grep -v "^Christoph$" | grep -v "^Mootez$" | grep -v "oscargus" | grep -v "dependabot" | grep -v "github actions" | grep -v "igorsteinmacher" | grep -v "halirutan" | grep -v "matthiasgeiger" | grep -v "Gitter Badger" | grep -v "gdstewart" | LC_ALL=C.UTF-8 sort --unique --ignore-case
echo -e "$authors\n$(git log --format='%aN')\n$coauthors" | grep -v "\[bot\]" | grep -v "JabRef" | grep -v "Siedlerchr" | grep -v "^Christoph$" | grep -v "^Mootez$" | grep -v "oscargus" | grep -v "dependabot" | grep -v "github actions" | grep -v "igorsteinmacher" | grep -v "halirutan" | grep -v "matthiasgeiger" | grep -v "Gitter Badger" | grep -v "gdstewart" | grep -v "chenyuheng" | LC_ALL=C.UTF-8 sort --unique --ignore-case
} > AUTHORS
2 changes: 1 addition & 1 deletion snap/local/JabRef-launcher
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#! /bin/sh
DIR="$SNAP/lib/runtime/bin"
"$DIR/java" -p "$DIR/../app" -m org.jabref/org.jabref.JabRefLauncher "$@"
"$DIR/java" -p "$DIR/../app" -m org.jabref/org.jabref.gui.JabRefLauncher "$@"
2 changes: 1 addition & 1 deletion src/jmh/java/org/jabref/benchmarks/Benchmarks.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import java.util.Random;
import java.util.stream.Collectors;

import org.jabref.Globals;
import org.jabref.gui.Globals;
import org.jabref.logic.exporter.BibtexDatabaseWriter;
import org.jabref.logic.exporter.SavePreferences;
import org.jabref.logic.formatter.bibtexfields.HtmlToLatexFormatter;
Expand Down
10 changes: 10 additions & 0 deletions src/main/java/org/jabref/architecture/AllowedToUseAwt.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package org.jabref.architecture;

/**
* Annotation to indicate that this logic class can access AWT
*/
public @interface AllowedToUseAwt {

// The rationale
String value();
}
9 changes: 5 additions & 4 deletions src/main/java/org/jabref/cli/ArgumentProcessor.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
import java.util.Set;
import java.util.prefs.BackingStoreException;

import org.jabref.Globals;
import org.jabref.JabRefException;
import org.jabref.gui.Globals;
import org.jabref.gui.externalfiles.AutoSetFileLinksUtil;
import org.jabref.gui.externalfiletype.ExternalFileTypes;
import org.jabref.gui.undo.NamedCompound;
import org.jabref.logic.JabRefException;
import org.jabref.logic.citationkeypattern.CitationKeyGenerator;
import org.jabref.logic.exporter.AtomicFileWriter;
import org.jabref.logic.exporter.BibDatabaseWriter;
Expand Down Expand Up @@ -48,6 +48,7 @@
import org.jabref.model.database.BibDatabaseMode;
import org.jabref.model.entry.BibEntry;
import org.jabref.model.strings.StringUtil;
import org.jabref.model.util.DummyFileUpdateMonitor;
import org.jabref.preferences.SearchPreferences;

import com.google.common.base.Throwables;
Expand Down Expand Up @@ -83,7 +84,7 @@ private static Optional<ParserResult> importToOpenBase(String argument) {
}

private static Optional<ParserResult> importBibtexToOpenBase(String argument) {
BibtexParser parser = new BibtexParser(Globals.prefs.getImportFormatPreferences(), Globals.getFileUpdateMonitor());
BibtexParser parser = new BibtexParser(Globals.prefs.getImportFormatPreferences(), new DummyFileUpdateMonitor());
try {
List<BibEntry> entries = parser.parseEntries(argument);
ParserResult result = new ParserResult(entries);
Expand Down Expand Up @@ -143,7 +144,7 @@ private static Optional<ParserResult> importFile(Path file, String importFormat)
// * means "guess the format":
System.out.println(Localization.lang("Importing in unknown format") + ": " + file);

ImportFormatReader.UnknownFormatImport importResult = Globals.IMPORT_FORMAT_READER.importUnknownFormat(file, Globals.getFileUpdateMonitor());
ImportFormatReader.UnknownFormatImport importResult = Globals.IMPORT_FORMAT_READER.importUnknownFormat(file, new DummyFileUpdateMonitor());

System.out.println(Localization.lang("Format used") + ": " + importResult.format);
return Optional.of(importResult.parserResult);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/jabref/cli/CrossrefFetcherEvaluator.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import java.util.concurrent.Executors;
import java.util.concurrent.atomic.AtomicInteger;

import org.jabref.Globals;
import org.jabref.gui.Globals;
import org.jabref.logic.importer.FetcherException;
import org.jabref.logic.importer.ParserResult;
import org.jabref.logic.importer.fetcher.CrossRef;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/jabref/cli/JabRefCLI.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import java.util.List;

import org.jabref.Globals;
import org.jabref.gui.Globals;
import org.jabref.logic.l10n.Localization;

import org.apache.commons.cli.CommandLine;
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/org/jabref/gui/BasePanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import javafx.scene.control.SplitPane;
import javafx.scene.layout.StackPane;

import org.jabref.Globals;
import org.jabref.gui.autocompleter.AutoCompletePreferences;
import org.jabref.gui.autocompleter.PersonNameSuggestionProvider;
import org.jabref.gui.autocompleter.SuggestionProviders;
Expand Down Expand Up @@ -614,7 +613,7 @@ public void copy() {
}

public void paste() {
mainTable.paste();
mainTable.paste(this.bibDatabaseContext.getMode());
}

public void cut() {
Expand Down
1 change: 0 additions & 1 deletion src/main/java/org/jabref/gui/BasePanelPreferences.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import javafx.beans.property.DoubleProperty;
import javafx.beans.property.SimpleDoubleProperty;

import org.jabref.Globals;
import org.jabref.gui.autocompleter.AutoCompletePreferences;
import org.jabref.gui.entryeditor.EntryEditorPreferences;
import org.jabref.gui.keyboard.KeyBindingRepository;
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/org/jabref/gui/ClipBoardManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import javafx.scene.input.DataFormat;
import javafx.scene.input.MouseButton;

import org.jabref.Globals;
import org.jabref.architecture.AllowedToUseAwt;
import org.jabref.logic.bibtex.BibEntryWriter;
import org.jabref.logic.bibtex.FieldWriter;
import org.jabref.logic.importer.FetcherException;
Expand All @@ -37,6 +37,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@AllowedToUseAwt("Requires ava.awt.datatransfer.Clipboard")
public class ClipBoardManager {

public static final DataFormat XML = new DataFormat("application/xml");
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/org/jabref/gui/DefaultInjector.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

import javax.swing.undo.UndoManager;

import org.jabref.Globals;
import org.jabref.JabRefGUI;
import org.jabref.gui.keyboard.KeyBindingRepository;
import org.jabref.gui.util.TaskExecutor;
import org.jabref.logic.journals.JournalAbbreviationRepository;
Expand Down
1 change: 0 additions & 1 deletion src/main/java/org/jabref/gui/EntryTypeView.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import javafx.scene.layout.FlowPane;
import javafx.stage.Screen;

import org.jabref.Globals;
import org.jabref.gui.util.BaseDialog;
import org.jabref.gui.util.ControlHelper;
import org.jabref.gui.util.IconValidationDecorator;
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/org/jabref/gui/EntryTypeViewModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
import javafx.concurrent.Task;
import javafx.concurrent.Worker;

import org.jabref.Globals;
import org.jabref.gui.duplicationFinder.DuplicateResolverDialog;
import org.jabref.logic.citationkeypattern.CitationKeyGenerator;
import org.jabref.logic.database.DuplicateCheck;
import org.jabref.logic.importer.FetcherException;
import org.jabref.logic.importer.IdBasedFetcher;
import org.jabref.logic.importer.ImportCleanup;
import org.jabref.logic.importer.WebFetchers;
import org.jabref.logic.importer.fetcher.DoiFetcher;
import org.jabref.logic.l10n.Localization;
Expand Down Expand Up @@ -147,6 +147,8 @@ public void runFetcherWorker() {
Optional<BibEntry> result = fetcherWorker.getValue();
if (result.isPresent()) {
final BibEntry entry = result.get();
ImportCleanup cleanup = new ImportCleanup(basePanel.getBibDatabaseContext().getMode());
cleanup.doPostCleanup(entry);
Optional<BibEntry> duplicate = new DuplicateCheck(Globals.entryTypesManager).containsDuplicate(basePanel.getDatabase(), entry, basePanel.getBibDatabaseContext().getMode());
if ((duplicate.isPresent())) {
DuplicateResolverDialog dialog = new DuplicateResolverDialog(entry, duplicate.get(), DuplicateResolverDialog.DuplicateResolverType.IMPORT_CHECK, basePanel.getBibDatabaseContext(), stateManager);
Expand Down
1 change: 0 additions & 1 deletion src/main/java/org/jabref/gui/FXDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import javafx.stage.Modality;
import javafx.stage.Stage;

import org.jabref.Globals;
import org.jabref.gui.icon.IconTheme;
import org.jabref.gui.keyboard.KeyBinding;
import org.jabref.gui.keyboard.KeyBindingRepository;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.jabref;
package org.jabref.gui;

import org.jabref.gui.util.DefaultTaskExecutor;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
package org.jabref;
package org.jabref.gui;

import java.awt.GraphicsEnvironment;
import java.util.Optional;
import java.util.UUID;

import javafx.stage.Screen;

import org.jabref.gui.ClipBoardManager;
import org.jabref.gui.StateManager;
import org.jabref.architecture.AllowedToUseAwt;
import org.jabref.gui.keyboard.KeyBindingRepository;
import org.jabref.gui.undo.CountingUndoManager;
import org.jabref.gui.util.DefaultFileUpdateMonitor;
Expand All @@ -33,6 +32,7 @@
* @deprecated try to use {@link StateManager} and {@link org.jabref.preferences.PreferencesService}
*/
@Deprecated
@AllowedToUseAwt("Requires AWT for headless check")
public class Globals {

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.jabref;
package org.jabref.gui;

import java.util.Collection;
import java.util.Collections;
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/org/jabref/gui/JabRefFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@
import javafx.scene.shape.Rectangle;
import javafx.stage.Stage;

import org.jabref.Globals;
import org.jabref.JabRefExecutorService;
import org.jabref.gui.actions.ActionFactory;
import org.jabref.gui.actions.ActionHelper;
import org.jabref.gui.actions.SimpleCommand;
Expand Down Expand Up @@ -125,6 +123,7 @@
import org.jabref.logic.autosaveandbackup.BackupManager;
import org.jabref.logic.citationstyle.CitationStyleOutputFormat;
import org.jabref.logic.importer.IdFetcher;
import org.jabref.logic.importer.ImportCleanup;
import org.jabref.logic.importer.ParserResult;
import org.jabref.logic.importer.WebFetchers;
import org.jabref.logic.l10n.Localization;
Expand Down Expand Up @@ -1191,6 +1190,8 @@ private boolean readyForAutosave(BibDatabaseContext context) {
*/
private void addImportedEntries(final BasePanel panel, final ParserResult parserResult) {
BackgroundTask<ParserResult> task = BackgroundTask.wrap(() -> parserResult);
ImportCleanup cleanup = new ImportCleanup(panel.getBibDatabaseContext().getMode());
cleanup.doPostCleanup(parserResult.getDatabase().getEntries());
ImportEntriesDialog dialog = new ImportEntriesDialog(panel.getBibDatabaseContext(), task);
dialog.setTitle(Localization.lang("Import"));
dialog.showAndWait();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.jabref;
package org.jabref.gui;

import java.io.File;
import java.sql.SQLException;
Expand All @@ -11,8 +11,6 @@
import javafx.stage.Screen;
import javafx.stage.Stage;

import org.jabref.gui.BasePanel;
import org.jabref.gui.JabRefFrame;
import org.jabref.gui.dialogs.BackupUIManager;
import org.jabref.gui.help.VersionWorker;
import org.jabref.gui.icon.IconTheme;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.jabref;
package org.jabref.gui;

/**
* JabRef launcher: This just starts JabRefMain. It is there because to have the name consistent to other Java applications.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.jabref;
package org.jabref.gui;

import java.net.Authenticator;

Expand All @@ -9,7 +9,6 @@

import org.jabref.cli.ArgumentProcessor;
import org.jabref.cli.JabRefCLI;
import org.jabref.gui.FXDialog;
import org.jabref.gui.remote.JabRefMessageHandler;
import org.jabref.logic.exporter.ExporterFactory;
import org.jabref.logic.journals.JournalAbbreviationLoader;
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/org/jabref/gui/SendAsEMailAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import java.util.ArrayList;
import java.util.List;

import org.jabref.Globals;
import org.jabref.architecture.AllowedToUseAwt;
import org.jabref.gui.actions.ActionHelper;
import org.jabref.gui.actions.SimpleCommand;
import org.jabref.gui.desktop.JabRefDesktop;
Expand All @@ -34,6 +34,7 @@
* are opened. This feature is disabled by default and can be switched on at
* preferences/external programs
*/
@AllowedToUseAwt("Requires AWT to send an email")
public class SendAsEMailAction extends SimpleCommand {

private static final Logger LOGGER = LoggerFactory.getLogger(SendAsEMailAction.class);
Expand Down
Loading

0 comments on commit 13d90c0

Please sign in to comment.