Skip to content

Commit

Permalink
Merge branch 'main' into fix-10558
Browse files Browse the repository at this point in the history
  • Loading branch information
Siedlerchr authored Feb 20, 2024
2 parents c168c9b + 118f176 commit fb12954
Show file tree
Hide file tree
Showing 25 changed files with 120 additions and 120 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/check-links.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ on:
push:
paths:
- '.github/workflows/check-links.yml'
- '.lycheeignore'
- 'lychee.toml'
- '**/*.md'
schedule:
# Run on the first of each month at 9:00 AM (See https://pubs.opengroup.org/onlinepubs/9699919799/utilities/crontab.html#tag_20_25_07)
Expand Down Expand Up @@ -32,4 +34,4 @@ jobs:
uses: lycheeverse/lychee-action@v1.9.3
with:
fail: true
args: --accept '200,201,202,203,204,429,500' --max-concurrency 1 --cache --no-progress --exclude-all-private './**/*.md'
args: --accept '200,201,202,203,204,403,429,500' --max-concurrency 1 --cache --no-progress --exclude-all-private './**/*.md'
4 changes: 2 additions & 2 deletions .github/workflows/deployment-arm64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ jobs:
shell: bash
run: |
jpackage \
--module org.jabref/org.jabref.cli.Launcher \
--module org.jabref/org.jabref.Launcher \
--module-path ${{env.JAVA_HOME}}/jmods/:build/jlinkbase/jlinkjars \
--add-modules org.jabref,org.jabref.merged.module \
--dest build/distribution \
Expand All @@ -129,7 +129,7 @@ jobs:
shell: bash
run: |
jpackage \
--module org.jabref/org.jabref.cli.Launcher \
--module org.jabref/org.jabref.Launcher \
--module-path ${{env.JAVA_HOME}}/jmods/:build/jlinkbase/jlinkjars \
--add-modules org.jabref,org.jabref.merged.module \
--dest build/distribution \
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ jobs:
shell: bash
run: |
jpackage \
--module org.jabref/org.jabref.cli.Launcher \
--module org.jabref/org.jabref.Launcher \
--module-path ${{env.JAVA_HOME}}/jmods/:build/jlinkbase/jlinkjars \
--add-modules org.jabref,org.jabref.merged.module \
--dest build/distribution \
Expand All @@ -141,7 +141,7 @@ jobs:
shell: bash
run: |
jpackage \
--module org.jabref/org.jabref.cli.Launcher \
--module org.jabref/org.jabref.Launcher \
--module-path ${{env.JAVA_HOME}}/jmods/:build/jlinkbase/jlinkjars \
--add-modules org.jabref,org.jabref.merged.module \
--dest build/distribution \
Expand Down
1 change: 1 addition & 0 deletions .lycheeignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
https://arxiv.org/
https://chrome.google.com/
https://contribute.jabref.org/
https://donations.jabref.org/
https://pubs.acs.org/
Expand Down
1 change: 1 addition & 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](https://semv
- We added a new boolean to the style files for Openoffice/Libreoffice integration to switch between ZERO_WIDTH_SPACE (default) and no space. [#10843](https://github.com/JabRef/jabref/pull/10843)
- When pasting HTML into the abstract or a comment field, the hypertext is automatically converted to Markdown. [#10558](https://github.com/JabRef/jabref/issues/10558)
- We added the possibility to redownload files that had been present but are no longer in the specified location. [#10848](https://github.com/JabRef/jabref/issues/10848)
- We added the citation key pattern `[camelN]`. Equivalent to the first N words of the `[camel]` pattern.

### Changed

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

application {
mainClass.set('org.jabref.cli.Launcher')
mainClass.set('org.jabref.Launcher')
mainModule.set('org.jabref')
}

Expand Down
2 changes: 1 addition & 1 deletion docs/code-howtos/jpackage.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,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

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

4. Open your IDE and add a "Remote Debugging Configuration" for `localhost:8000`
Expand Down
2 changes: 1 addition & 1 deletion docs/code-howtos/tools.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ This page lists some software we consider useful.
* [Refined GitHub](https://github.com/sindresorhus/refined-github) - GitHub on steroids
* [GitHub Issue Link Status](https://github.com/fregante/github-issue-link-status) - proper coloring of linked issues and PRs.
* [Codecov Browser Extension](https://github.com/codecov/browser-extension) - displaying code coverage directly when browsing GitHub
* [Sourcegraph Browser Extension](https://docs.sourcegraph.com/integration/browser\_extension) - Navigate through source on GitHub
* [Sourcegraph Browser Extension](https://sourcegraph.com/docs/integration/browser_extension) - Navigate through source on GitHub

## git hints

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Always make sure your Eclipse installation us up to date.
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.cli.Launcher` and/or for `org.jabref.gui.JabRefMain` (both can be used equivalently)
4. Create a run/debug configuration for the main class `org.jabref.Launcher` 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. `Launcher` or JabRefMain) otherwise it will not work.

![Creating the run/debug configuration by right-clicking on the class](../../images/eclipse-create-run-config.png)
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ Now, `BibEntryTest` should appear first:

Press <kbd>Enter</kbd> to jump to that class.

Hover on the green play button on `testDefaultConstructor`:
Hover on the green play button on `defaultConstructor`:

{% figure caption:"However on green play button" %}
![However on green play button](guidelines-intellij-run-single-test.png)
Expand Down
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.cli.Launcher "$@"
"$DIR/java" -p "$DIR/../app" -m org.jabref/org.jabref.Launcher "$@"
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.jabref.cli;
package org.jabref;

import java.io.File;
import java.io.IOException;
Expand All @@ -11,8 +11,11 @@
import java.util.List;
import java.util.Map;

import org.jabref.architecture.AllowedToUseStandardStreams;
import org.jabref.cli.ArgumentProcessor;
import org.jabref.cli.JabRefCLI;
import org.jabref.gui.Globals;
import org.jabref.gui.MainApplication;
import org.jabref.gui.JabRefGUI;
import org.jabref.logic.UiCommand;
import org.jabref.logic.journals.JournalAbbreviationLoader;
import org.jabref.logic.journals.predatory.PredatoryJournalListLoader;
Expand Down Expand Up @@ -45,20 +48,19 @@
* - Handle the command line arguments
* - Start the JavaFX application (if not in cli mode)
*/
@AllowedToUseStandardStreams("Direct output to the user")
public class Launcher {
private static Logger LOGGER;
private static String[] ARGUMENTS;
private static boolean isDebugEnabled;

public static void main(String[] args) {
routeLoggingToSlf4J();
ARGUMENTS = args;

// We must configure logging as soon as possible, which is why we cannot wait for the usual
// argument parsing workflow to parse logging options .e.g. --debug
JabRefCLI jabRefCLI;
try {
jabRefCLI = new JabRefCLI(ARGUMENTS);
jabRefCLI = new JabRefCLI(args);
isDebugEnabled = jabRefCLI.isDebugLogging();
} catch (ParseException e) {
isDebugEnabled = false;
Expand All @@ -73,7 +75,7 @@ public static void main(String[] args) {
final JabRefPreferences preferences = JabRefPreferences.getInstance();

// Early exit in case another instance is already running
if (!handleMultipleAppInstances(ARGUMENTS, preferences.getRemotePreferences())) {
if (!handleMultipleAppInstances(args, preferences.getRemotePreferences())) {
return;
}

Expand All @@ -91,7 +93,7 @@ public static void main(String[] args) {

// Process arguments
ArgumentProcessor argumentProcessor = new ArgumentProcessor(
ARGUMENTS,
args,
ArgumentProcessor.Mode.INITIAL_START,
preferences,
fileUpdateMonitor,
Expand All @@ -105,7 +107,8 @@ public static void main(String[] args) {
}

List<UiCommand> uiCommands = new ArrayList<>(argumentProcessor.getUiCommands());
MainApplication.main(uiCommands, preferences, fileUpdateMonitor, ARGUMENTS);
JabRefGUI.setup(uiCommands, preferences, fileUpdateMonitor);
JabRefGUI.launch(JabRefGUI.class, args);
} catch (ParseException e) {
LOGGER.error("Problem parsing arguments", e);
JabRefCLI.printUsage(preferences);
Expand Down Expand Up @@ -148,7 +151,7 @@ private static void addLogToDisk() {
}

private static void initializeLogger() {
LOGGER = LoggerFactory.getLogger(MainApplication.class);
LOGGER = LoggerFactory.getLogger(Launcher.class);
}

/**
Expand All @@ -167,6 +170,7 @@ private static boolean handleMultipleAppInstances(String[] args, RemotePreferenc
if (remoteClient.sendCommandLineArguments(args)) {
// So we assume it's all taken care of, and quit.
LOGGER.debug("Arguments passed on to running JabRef instance.");
// Used for script-use output etc. to the user
System.out.println(Localization.lang("Arguments passed on to running JabRef instance. Shutting down."));
return false;
} else {
Expand Down
4 changes: 1 addition & 3 deletions src/main/java/org/jabref/cli/ArgumentProcessor.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
import org.jabref.logic.importer.ImportFormatPreferences;
import org.jabref.logic.importer.ImportFormatReader;
import org.jabref.logic.importer.OpenDatabase;
import org.jabref.logic.importer.OutputPrinter;
import org.jabref.logic.importer.ParseException;
import org.jabref.logic.importer.ParserResult;
import org.jabref.logic.importer.SearchBasedFetcher;
Expand Down Expand Up @@ -156,8 +155,7 @@ private Optional<ParserResult> importFile(String argument) {
Optional<ParserResult> importResult = importFile(file, importFormat);
importResult.ifPresent(result -> {
if (result.hasWarnings()) {
OutputPrinter printer = new SystemOutputPrinter();
printer.showMessage(result.getErrorMessage());
System.out.println(result.getErrorMessage());
}
});
return importResult;
Expand Down
21 changes: 0 additions & 21 deletions src/main/java/org/jabref/cli/SystemOutputPrinter.java

This file was deleted.

47 changes: 33 additions & 14 deletions src/main/java/org/jabref/gui/JabRefGUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.util.List;
import java.util.Optional;

import javafx.application.Application;
import javafx.application.Platform;
import javafx.scene.Scene;
import javafx.scene.input.KeyEvent;
Expand All @@ -13,6 +14,7 @@
import org.jabref.gui.help.VersionWorker;
import org.jabref.gui.icon.IconTheme;
import org.jabref.gui.keyboard.TextInputKeyBindings;
import org.jabref.gui.openoffice.OOBibBaseConnect;
import org.jabref.gui.theme.ThemeManager;
import org.jabref.logic.UiCommand;
import org.jabref.logic.l10n.Localization;
Expand All @@ -21,7 +23,7 @@
import org.jabref.model.strings.StringUtil;
import org.jabref.model.util.FileUpdateMonitor;
import org.jabref.preferences.GuiPreferences;
import org.jabref.preferences.PreferencesService;
import org.jabref.preferences.JabRefPreferences;

import com.tobiasdiez.easybind.EasyBind;
import impl.org.controlsfx.skin.DecorationPane;
Expand All @@ -31,29 +33,34 @@
/**
* Represents the outer stage and the scene of the JabRef window.
*/
public class JabRefGUI {
public class JabRefGUI extends Application {

private static final Logger LOGGER = LoggerFactory.getLogger(JabRefGUI.class);

private static List<UiCommand> uiCommands;
private static JabRefPreferences preferencesService;
private static FileUpdateMonitor fileUpdateMonitor;
private static JabRefFrame mainFrame;
private static DialogService dialogService;
private static ThemeManager themeManager;

private final Stage mainStage;
private final PreferencesService preferencesService;
private boolean correctedWindowPos = false;
private Stage mainStage;

private final List<UiCommand> uiCommands;
private boolean correctedWindowPos;
public static void setup(List<UiCommand> uiCommands,
JabRefPreferences preferencesService,
FileUpdateMonitor fileUpdateMonitor) {
JabRefGUI.uiCommands = uiCommands;
JabRefGUI.preferencesService = preferencesService;
JabRefGUI.fileUpdateMonitor = fileUpdateMonitor;
}

public JabRefGUI(Stage mainStage,
List<UiCommand> uiCommands,
PreferencesService preferencesService,
FileUpdateMonitor fileUpdateMonitor) {
this.mainStage = mainStage;
this.uiCommands = uiCommands;
this.preferencesService = preferencesService;
@Override
public void start(Stage stage) {
this.mainStage = stage;

this.correctedWindowPos = false;
FallbackExceptionHandler.installExceptionHandler();
Globals.startBackgroundTasks();

WebViewStore.init();

Expand Down Expand Up @@ -90,6 +97,18 @@ public JabRefGUI(Stage mainStage,
setupProxy();
}

@Override
public void stop() {
OOBibBaseConnect.closeOfficeConnection();
Globals.stopBackgroundTasks();
Globals.shutdownThreadPools();
try {
Globals.predatoryJournalRepository.close();
} catch (Exception e) {
LOGGER.warn("Cloud not shut down predatoryJournalRepository", e);
}
}

private void setupProxy() {
if (!preferencesService.getProxyPreferences().shouldUseProxy()
|| !preferencesService.getProxyPreferences().shouldUseAuthentication()) {
Expand Down
54 changes: 0 additions & 54 deletions src/main/java/org/jabref/gui/MainApplication.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import java.io.IOException;
import java.nio.file.Path;

import org.jabref.Launcher;
import org.jabref.architecture.AllowedToUseAwt;
import org.jabref.cli.Launcher;
import org.jabref.gui.DialogService;
import org.jabref.preferences.FilePreferences;

Expand Down
Loading

0 comments on commit fb12954

Please sign in to comment.