92
92
import org .jabref .model .database .shared .DatabaseLocation ;
93
93
import org .jabref .model .database .shared .DatabaseSynchronizer ;
94
94
import org .jabref .model .entry .BibEntry ;
95
- import org .jabref .model .entry .FieldName ;
96
- import org .jabref .model .entry .InternalBibtexFields ;
97
95
import org .jabref .model .entry .LinkedFile ;
98
96
import org .jabref .model .entry .event .EntryChangedEvent ;
99
97
import org .jabref .model .entry .event .EntryEventSource ;
100
- import org .jabref .model .entry .specialfields .SpecialField ;
101
- import org .jabref .model .entry .specialfields .SpecialFieldValue ;
98
+ import org .jabref .model .entry .field .Field ;
99
+ import org .jabref .model .entry .field .FieldFactory ;
100
+ import org .jabref .model .entry .field .SpecialField ;
101
+ import org .jabref .model .entry .field .SpecialFieldValue ;
102
+ import org .jabref .model .entry .field .StandardField ;
102
103
import org .jabref .preferences .JabRefPreferences ;
103
104
import org .jabref .preferences .PreviewPreferences ;
104
105
@@ -573,13 +574,13 @@ private void openExternalFile() {
573
574
}
574
575
JabRefExecutorService .INSTANCE .execute (() -> {
575
576
final BibEntry entry = selectedEntries .get (0 );
576
- if (!entry .hasField (FieldName .FILE )) {
577
+ if (!entry .hasField (StandardField .FILE )) {
577
578
// no bibtex field
578
579
new SearchAndOpenFile (entry , BasePanel .this ).searchAndOpen ();
579
580
return ;
580
581
}
581
582
FileListTableModel fileListTableModel = new FileListTableModel ();
582
- entry .getField (FieldName .FILE ).ifPresent (fileListTableModel ::setContent );
583
+ entry .getField (StandardField .FILE ).ifPresent (fileListTableModel ::setContent );
583
584
if (fileListTableModel .getRowCount () == 0 ) {
584
585
// content in BibTeX field is not readable
585
586
new SearchAndOpenFile (entry , BasePanel .this ).searchAndOpen ();
@@ -637,7 +638,7 @@ public void insertEntry(final BibEntry bibEntry) {
637
638
638
639
// Create an UndoableInsertEntry object.
639
640
getUndoManager ().addEdit (new UndoableInsertEntry (bibDatabaseContext .getDatabase (), bibEntry ));
640
- output (Localization .lang ("Added new '%0' entry." , bibEntry .getType ()));
641
+ output (Localization .lang ("Added new '%0' entry." , bibEntry .getType (). getDisplayName () ));
641
642
642
643
markBaseChanged (); // The database just changed.
643
644
if (Globals .prefs .getBoolean (JabRefPreferences .AUTO_OPEN_FORM )) {
@@ -650,11 +651,11 @@ public void insertEntry(final BibEntry bibEntry) {
650
651
}
651
652
}
652
653
653
- public void editEntryAndFocusField (BibEntry entry , String fieldName ) {
654
+ public void editEntryAndFocusField (BibEntry entry , Field field ) {
654
655
showAndEdit (entry );
655
656
Platform .runLater (() -> {
656
657
// Focus field and entry in main table (async to give entry editor time to load)
657
- entryEditor .setFocusToField (fieldName );
658
+ entryEditor .setFocusToField (field );
658
659
clearAndSelect (entry );
659
660
});
660
661
}
@@ -808,7 +809,7 @@ public void updateSearchManager() {
808
809
}
809
810
810
811
private void instantiateSearchAutoCompleter () {
811
- searchAutoCompleter = new PersonNameSuggestionProvider (InternalBibtexFields .getPersonNameFields ());
812
+ searchAutoCompleter = new PersonNameSuggestionProvider (FieldFactory .getPersonNameFields ());
812
813
for (BibEntry entry : bibDatabaseContext .getDatabase ().getEntries ()) {
813
814
searchAutoCompleter .indexEntry (entry );
814
815
}
@@ -1300,11 +1301,11 @@ private class OpenURLAction implements BaseAction {
1300
1301
public void action () {
1301
1302
final List <BibEntry > bes = mainTable .getSelectedEntries ();
1302
1303
if (bes .size () == 1 ) {
1303
- String field = FieldName .DOI ;
1304
- Optional <String > link = bes .get (0 ).getField (FieldName .DOI );
1305
- if (bes .get (0 ).hasField (FieldName .URL )) {
1306
- link = bes .get (0 ).getField (FieldName .URL );
1307
- field = FieldName .URL ;
1304
+ Field field = StandardField .DOI ;
1305
+ Optional <String > link = bes .get (0 ).getField (StandardField .DOI );
1306
+ if (bes .get (0 ).hasField (StandardField .URL )) {
1307
+ link = bes .get (0 ).getField (StandardField .URL );
1308
+ field = StandardField .URL ;
1308
1309
}
1309
1310
if (link .isPresent ()) {
1310
1311
try {
@@ -1320,9 +1321,9 @@ public void action() {
1320
1321
List <LinkedFile > files = bes .get (0 ).getFiles ();
1321
1322
1322
1323
Optional <LinkedFile > linkedFile = files .stream ()
1323
- .filter (file -> (FieldName .URL .equalsIgnoreCase (file .getFileType ())
1324
- || FieldName .PS .equalsIgnoreCase (file .getFileType ())
1325
- || FieldName .PDF .equalsIgnoreCase (file .getFileType ())))
1324
+ .filter (file -> (StandardField .URL . getName () .equalsIgnoreCase (file .getFileType ())
1325
+ || StandardField .PS . getName () .equalsIgnoreCase (file .getFileType ())
1326
+ || StandardField .PDF . getName () .equalsIgnoreCase (file .getFileType ())))
1326
1327
.findFirst ();
1327
1328
1328
1329
if (linkedFile .isPresent ()) {
0 commit comments