From 11f3797dc97c0859f20eb87d81050cb885ad7513 Mon Sep 17 00:00:00 2001 From: mrcstan Date: Fri, 10 Dec 2021 17:27:34 -0800 Subject: [PATCH] Added javadocs comments for #7870 --- .../java/org/jabref/gui/EntryTypeViewModel.java | 9 +++++++-- .../gui/importer/GenerateEntryFromIdAction.java | 14 ++++++++++++-- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/jabref/gui/EntryTypeViewModel.java b/src/main/java/org/jabref/gui/EntryTypeViewModel.java index f58f758e14b..8b9fb164187 100644 --- a/src/main/java/org/jabref/gui/EntryTypeViewModel.java +++ b/src/main/java/org/jabref/gui/EntryTypeViewModel.java @@ -180,10 +180,15 @@ public void runFetcherWorker() { } else if (StringUtil.isBlank(idText.getValue())) { dialogService.showWarningDialogAndWait(Localization.lang("Empty search ID"), Localization.lang("The given search ID was empty.")); } else if (result.isEmpty()) { + /** + * When the result return by the fetcher is empty, a dialog box with the following two options appear: + *(1)add entries manually + * (2) return to original dialog box + * @author Marcus Tan + * @since 2021-11-07 + */ String fetcher = selectedItemProperty().getValue().getName(); String searchId = idText.getValue(); - // When DOI ID is not found, allow the user to either return to the dialog or - // add entry manually boolean addEntryFlag = dialogService.showConfirmationDialogAndWait(Localization.lang("DOI not found"), Localization.lang("Fetcher '%0' did not find an entry for id '%1'.", fetcher, searchId), Localization.lang("Add entry manually"), diff --git a/src/main/java/org/jabref/gui/importer/GenerateEntryFromIdAction.java b/src/main/java/org/jabref/gui/importer/GenerateEntryFromIdAction.java index d0f86008ab1..41382a9e5b4 100644 --- a/src/main/java/org/jabref/gui/importer/GenerateEntryFromIdAction.java +++ b/src/main/java/org/jabref/gui/importer/GenerateEntryFromIdAction.java @@ -38,6 +38,11 @@ public GenerateEntryFromIdAction(LibraryTab libraryTab, DialogService dialogServ this.identifier = identifier; this.taskExecutor = taskExecutor; this.entryFromIdPopOver = entryFromIdPopOver; + /** + * stateManger injected for access by NewEntryAction + * @author Marcus Tan + * @since 2021-11-07 + */ this.stateManager = stateManager; } @@ -47,13 +52,18 @@ public void execute() { backgroundTask.titleProperty().set(Localization.lang("Import by ID")); backgroundTask.showToUser(true); backgroundTask.onRunning(() -> dialogService.notify("%s".formatted(backgroundTask.messageProperty().get()))); + /** + * Upon failure to import by ID, a dialog box with the following two options appear: + * (1)add entries manually + * (2) return to original dialog box + * @author Marcus Tan + * @since 2021-11-07 + */ backgroundTask.onFailure((e) -> { - // When unable to import by ID, present the user options to cancel or add entry manually boolean addEntryFlag = dialogService.showConfirmationDialogAndWait(Localization.lang("Failed to import by ID"), e.getMessage(), Localization.lang("Add entry manually")); if (addEntryFlag) { - // add entry manually new NewEntryAction(libraryTab.frame(), StandardEntryType.Article, dialogService, preferencesService, stateManager).execute(); }