Skip to content

Commit b844e0f

Browse files
committed
fix: resolve issues in LocalizationConsistencyCheck
1 parent 0ff44ac commit b844e0f

File tree

1 file changed

+93
-98
lines changed

1 file changed

+93
-98
lines changed

jabgui/src/main/java/org/jabref/gui/newentry/NewEntryViewModel.java

Lines changed: 93 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,12 @@ public class NewEntryViewModel {
8181
private Task<Optional<List<BibEntry>>> bibtexWorker;
8282

8383
public NewEntryViewModel(GuiPreferences preferences,
84-
LibraryTab libraryTab,
85-
DialogService dialogService,
86-
StateManager stateManager,
87-
UiTaskExecutor taskExecutor,
88-
AiService aiService,
89-
FileUpdateMonitor fileUpdateMonitor) {
84+
LibraryTab libraryTab,
85+
DialogService dialogService,
86+
StateManager stateManager,
87+
UiTaskExecutor taskExecutor,
88+
AiService aiService,
89+
FileUpdateMonitor fileUpdateMonitor) {
9090
this.preferences = preferences;
9191
this.libraryTab = libraryTab;
9292
this.dialogService = dialogService;
@@ -100,33 +100,33 @@ public NewEntryViewModel(GuiPreferences preferences,
100100

101101
idText = new SimpleStringProperty();
102102
idTextValidator = new FunctionBasedValidator<>(
103-
idText,
104-
StringUtil::isNotBlank,
105-
ValidationMessage.error(Localization.lang("You must specify an identifier.")));
103+
idText,
104+
StringUtil::isNotBlank,
105+
ValidationMessage.error(Localization.lang("You must specify an identifier.")));
106106
idFetchers = new SimpleListProperty<>(FXCollections.observableArrayList());
107107
idFetchers.addAll(WebFetchers.getIdBasedFetchers(preferences.getImportFormatPreferences(), preferences.getImporterPreferences()));
108108
idFetcher = new SimpleObjectProperty<>();
109109
idFetcherValidator = new FunctionBasedValidator<>(
110-
idFetcher,
111-
Objects::nonNull,
112-
ValidationMessage.error(Localization.lang("You must select an identifier type.")));
110+
idFetcher,
111+
Objects::nonNull,
112+
ValidationMessage.error(Localization.lang("You must select an identifier type.")));
113113
idLookupWorker = null;
114114

115115
interpretText = new SimpleStringProperty();
116116
interpretTextValidator = new FunctionBasedValidator<>(
117-
interpretText,
118-
StringUtil::isNotBlank,
119-
ValidationMessage.error(Localization.lang("You must specify one (or more) citations.")));
117+
interpretText,
118+
StringUtil::isNotBlank,
119+
ValidationMessage.error(Localization.lang("You must specify one (or more) citations.")));
120120
interpretParsers = new SimpleListProperty<>(FXCollections.observableArrayList());
121121
interpretParsers.addAll(PlainCitationParserChoice.values());
122122
interpretParser = new SimpleObjectProperty<>();
123123
interpretWorker = null;
124124

125125
bibtexText = new SimpleStringProperty();
126126
bibtexTextValidator = new FunctionBasedValidator<>(
127-
bibtexText,
128-
StringUtil::isNotBlank,
129-
ValidationMessage.error(Localization.lang("You must specify a Bib(La)TeX source.")));
127+
bibtexText,
128+
StringUtil::isNotBlank,
129+
ValidationMessage.error(Localization.lang("You must specify a Bib(La)TeX source.")));
130130
bibtexWorker = null;
131131
}
132132

@@ -231,33 +231,30 @@ public void executeLookupIdentifier(boolean searchComposite) {
231231

232232
if (exception instanceof FetcherClientException) {
233233
dialogService.showInformationDialogAndWait(
234-
dialogTitle,
235-
Localization.lang(
236-
"""
237-
Bibliographic data could not be retrieved.
238-
This is likely due to an issue with your input, or your network connection.
239-
Check your provided identifier (and identifier type), and try again.
240-
%0""",
241-
exceptionMessage));
234+
dialogTitle,
235+
Localization.lang(
236+
"Bibliographic data could not be retrieved.\n" +
237+
"This is likely due to an issue with your input, or your network connection.\n" +
238+
"Check your provided identifier (and identifier type), and try again.\n" +
239+
"%0",
240+
exceptionMessage));
242241
} else if (exception instanceof FetcherServerException) {
243242
dialogService.showInformationDialogAndWait(
244-
dialogTitle,
245-
Localization.lang(
246-
"""
247-
Bibliographic data could not be retrieved.
248-
This is likely due to an issue being experienced by the server.
249-
Try again later.
250-
%0""",
251-
exceptionMessage));
243+
dialogTitle,
244+
Localization.lang(
245+
"Bibliographic data could not be retrieved.\n" +
246+
"This is likely due to an issue being experienced by the server.\n" +
247+
"Try again later.\n" +
248+
"%0",
249+
exceptionMessage));
252250
} else {
253251
dialogService.showInformationDialogAndWait(
254-
dialogTitle,
255-
Localization.lang(
256-
"""
257-
Bibliographic data could not be retrieved.
258-
The following error was encountered:
259-
%0""",
260-
exceptionMessage));
252+
dialogTitle,
253+
Localization.lang(
254+
"Bibliographic data could not be retrieved.\n" +
255+
"The following error was encountered:\n" +
256+
"%0",
257+
exceptionMessage));
261258
}
262259

263260
LOGGER.error("An exception occurred with the '{}' fetcher when resolving '{}'.", fetcherName, textString, exception);
@@ -270,22 +267,22 @@ Check your provided identifier (and identifier type), and try again.
270267

271268
if (result.isEmpty()) {
272269
dialogService.showWarningDialogAndWait(
273-
Localization.lang("Invalid result returned"),
274-
Localization.lang(
275-
"An unknown error has occurred.\n" +
276-
"This entry may need to be added manually."));
270+
Localization.lang("Invalid result returned"),
271+
Localization.lang(
272+
"An unknown error has occurred.\n" +
273+
"This entry may need to be added manually."));
277274
executing.set(false);
278275
return;
279276
}
280277

281278
final ImportHandler handler = new ImportHandler(
282-
libraryTab.getBibDatabaseContext(),
283-
preferences,
284-
fileUpdateMonitor,
285-
libraryTab.getUndoManager(),
286-
stateManager,
287-
dialogService,
288-
taskExecutor);
279+
libraryTab.getBibDatabaseContext(),
280+
preferences,
281+
fileUpdateMonitor,
282+
libraryTab.getUndoManager(),
283+
stateManager,
284+
dialogService,
285+
taskExecutor);
289286
handler.importEntryWithDuplicateCheck(libraryTab.getBibDatabaseContext(), result.get());
290287

291288
executedSuccessfully.set(true);
@@ -337,20 +334,19 @@ public void executeInterpretCitations() {
337334

338335
if (exception instanceof FetcherException) {
339336
dialogService.showInformationDialogAndWait(
340-
dialogTitle,
341-
Localization.lang(
342-
"""
343-
Failed to interpret citations.
344-
The following error was encountered:
345-
%0""",
346-
exceptionMessage));
337+
dialogTitle,
338+
Localization.lang(
339+
"Failed to interpret citations.\n" +
340+
"The following error was encountered:\n" +
341+
"%0",
342+
exceptionMessage));
347343
} else {
348344
dialogService.showInformationDialogAndWait(
349-
dialogTitle,
350-
Localization.lang(
351-
"The following error occurred:\n" +
352-
"%0",
353-
exceptionMessage));
345+
dialogTitle,
346+
Localization.lang(
347+
"The following error occurred:\n" +
348+
"%0",
349+
exceptionMessage));
354350
}
355351

356352
LOGGER.error("An exception occurred with the '{}' parser.", parserName, exception);
@@ -363,23 +359,23 @@ public void executeInterpretCitations() {
363359

364360
if (result.isEmpty()) {
365361
dialogService.showWarningDialogAndWait(
366-
Localization.lang("Invalid result"),
367-
Localization.lang(
368-
"An unknown error has occurred.\n" +
369-
"Entries may need to be added manually."));
362+
Localization.lang("Invalid result"),
363+
Localization.lang(
364+
"An unknown error has occurred.\n" +
365+
"Entries may need to be added manually."));
370366
LOGGER.error("An invalid result was returned when parsing citations.");
371367
executing.set(false);
372368
return;
373369
}
374370

375371
final ImportHandler handler = new ImportHandler(
376-
libraryTab.getBibDatabaseContext(),
377-
preferences,
378-
fileUpdateMonitor,
379-
libraryTab.getUndoManager(),
380-
stateManager,
381-
dialogService,
382-
taskExecutor);
372+
libraryTab.getBibDatabaseContext(),
373+
preferences,
374+
fileUpdateMonitor,
375+
libraryTab.getUndoManager(),
376+
stateManager,
377+
dialogService,
378+
taskExecutor);
383379
handler.importEntriesWithDuplicateCheck(libraryTab.getBibDatabaseContext(), result.get());
384380

385381
executedSuccessfully.set(true);
@@ -423,20 +419,19 @@ public void executeSpecifyBibtex() {
423419

424420
if (exception instanceof ParseException) {
425421
dialogService.showInformationDialogAndWait(
426-
dialogTitle,
427-
Localization.lang(
428-
"""
429-
Failed to parse entries.
430-
The following error was encountered:
431-
%0""",
432-
exceptionMessage));
422+
dialogTitle,
423+
Localization.lang(
424+
"Failed to parse entries.\n" +
425+
"The following error was encountered:\n" +
426+
"%0",
427+
exceptionMessage));
433428
} else {
434429
dialogService.showInformationDialogAndWait(
435-
dialogTitle,
436-
Localization.lang(
437-
"The following error occurred:\n" +
438-
"%0",
439-
exceptionMessage));
430+
dialogTitle,
431+
Localization.lang(
432+
"The following error occurred:\n" +
433+
"%0",
434+
exceptionMessage));
440435
}
441436

442437
LOGGER.error("An exception occurred when parsing Bib(La)Tex entries.", exception);
@@ -449,23 +444,23 @@ public void executeSpecifyBibtex() {
449444

450445
if (result.isEmpty()) {
451446
dialogService.showWarningDialogAndWait(
452-
Localization.lang("Invalid result"),
453-
Localization.lang(
454-
"An unknown error has occurred.\n" +
455-
"Entries may need to be added manually."));
447+
Localization.lang("Invalid result"),
448+
Localization.lang(
449+
"An unknown error has occurred.\n" +
450+
"Entries may need to be added manually."));
456451
LOGGER.error("An invalid result was returned when parsing Bib(La)Tex entries.");
457452
executing.set(false);
458453
return;
459454
}
460455

461456
final ImportHandler handler = new ImportHandler(
462-
libraryTab.getBibDatabaseContext(),
463-
preferences,
464-
fileUpdateMonitor,
465-
libraryTab.getUndoManager(),
466-
stateManager,
467-
dialogService,
468-
taskExecutor);
457+
libraryTab.getBibDatabaseContext(),
458+
preferences,
459+
fileUpdateMonitor,
460+
libraryTab.getUndoManager(),
461+
stateManager,
462+
dialogService,
463+
taskExecutor);
469464
handler.importEntriesWithDuplicateCheck(libraryTab.getBibDatabaseContext(), result.get());
470465

471466
executedSuccessfully.set(true);

0 commit comments

Comments
 (0)