@@ -81,12 +81,12 @@ public class NewEntryViewModel {
81
81
private Task <Optional <List <BibEntry >>> bibtexWorker ;
82
82
83
83
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 ) {
90
90
this .preferences = preferences ;
91
91
this .libraryTab = libraryTab ;
92
92
this .dialogService = dialogService ;
@@ -100,33 +100,33 @@ public NewEntryViewModel(GuiPreferences preferences,
100
100
101
101
idText = new SimpleStringProperty ();
102
102
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." )));
106
106
idFetchers = new SimpleListProperty <>(FXCollections .observableArrayList ());
107
107
idFetchers .addAll (WebFetchers .getIdBasedFetchers (preferences .getImportFormatPreferences (), preferences .getImporterPreferences ()));
108
108
idFetcher = new SimpleObjectProperty <>();
109
109
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." )));
113
113
idLookupWorker = null ;
114
114
115
115
interpretText = new SimpleStringProperty ();
116
116
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." )));
120
120
interpretParsers = new SimpleListProperty <>(FXCollections .observableArrayList ());
121
121
interpretParsers .addAll (PlainCitationParserChoice .values ());
122
122
interpretParser = new SimpleObjectProperty <>();
123
123
interpretWorker = null ;
124
124
125
125
bibtexText = new SimpleStringProperty ();
126
126
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." )));
130
130
bibtexWorker = null ;
131
131
}
132
132
@@ -231,33 +231,30 @@ public void executeLookupIdentifier(boolean searchComposite) {
231
231
232
232
if (exception instanceof FetcherClientException ) {
233
233
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 ));
242
241
} else if (exception instanceof FetcherServerException ) {
243
242
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 ));
252
250
} else {
253
251
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 ));
261
258
}
262
259
263
260
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.
270
267
271
268
if (result .isEmpty ()) {
272
269
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." ));
277
274
executing .set (false );
278
275
return ;
279
276
}
280
277
281
278
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 );
289
286
handler .importEntryWithDuplicateCheck (libraryTab .getBibDatabaseContext (), result .get ());
290
287
291
288
executedSuccessfully .set (true );
@@ -337,20 +334,19 @@ public void executeInterpretCitations() {
337
334
338
335
if (exception instanceof FetcherException ) {
339
336
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 ));
347
343
} else {
348
344
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 ));
354
350
}
355
351
356
352
LOGGER .error ("An exception occurred with the '{}' parser." , parserName , exception );
@@ -363,23 +359,23 @@ public void executeInterpretCitations() {
363
359
364
360
if (result .isEmpty ()) {
365
361
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." ));
370
366
LOGGER .error ("An invalid result was returned when parsing citations." );
371
367
executing .set (false );
372
368
return ;
373
369
}
374
370
375
371
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 );
383
379
handler .importEntriesWithDuplicateCheck (libraryTab .getBibDatabaseContext (), result .get ());
384
380
385
381
executedSuccessfully .set (true );
@@ -423,20 +419,19 @@ public void executeSpecifyBibtex() {
423
419
424
420
if (exception instanceof ParseException ) {
425
421
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 ));
433
428
} else {
434
429
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 ));
440
435
}
441
436
442
437
LOGGER .error ("An exception occurred when parsing Bib(La)Tex entries." , exception );
@@ -449,23 +444,23 @@ public void executeSpecifyBibtex() {
449
444
450
445
if (result .isEmpty ()) {
451
446
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." ));
456
451
LOGGER .error ("An invalid result was returned when parsing Bib(La)Tex entries." );
457
452
executing .set (false );
458
453
return ;
459
454
}
460
455
461
456
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 );
469
464
handler .importEntriesWithDuplicateCheck (libraryTab .getBibDatabaseContext (), result .get ());
470
465
471
466
executedSuccessfully .set (true );
0 commit comments