Skip to content

Commit

Permalink
Treat unknown fields as multi-line fields (#5230)
Browse files Browse the repository at this point in the history
Fixes #5021. Unknown fields are now treated as multi-line fields. In the future, we should provide an UI interface to specify or change properties of fields.
  • Loading branch information
tobiasdiez authored and stefan-kolb committed Aug 25, 2019
1 parent 71a23e7 commit b5002e0
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 27 deletions.
8 changes: 3 additions & 5 deletions src/main/java/org/jabref/gui/fieldeditors/FieldEditors.java
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,12 @@ public static FieldEditorFX getForField(final Field field,
return new PersonsEditor(field, suggestionProvider, preferences, fieldCheckers, isSingleLine);
} else if (StandardField.KEYWORDS.equals(field)) {
return new KeywordsEditor(field, suggestionProvider, fieldCheckers, preferences);
} else if (fieldProperties.contains(FieldProperty.MULTILINE_TEXT)) {
return new MultilineEditor(field, suggestionProvider, fieldCheckers, preferences);
} else if (field == InternalField.KEY_FIELD) {
return new BibtexKeyEditor(field, preferences, suggestionProvider, fieldCheckers, databaseContext, undoManager, dialogService);
} else {
// default
return new SimpleEditor(field, suggestionProvider, fieldCheckers, preferences, isSingleLine);
}

// default
return new SimpleEditor(field, suggestionProvider, fieldCheckers, preferences, isSingleLine);
}

@SuppressWarnings("unchecked")
Expand Down
18 changes: 0 additions & 18 deletions src/main/java/org/jabref/gui/fieldeditors/MultilineEditor.java

This file was deleted.

8 changes: 7 additions & 1 deletion src/main/java/org/jabref/model/entry/field/FieldFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,13 @@ public static List<Field> getDefaultGeneralFields() {
return defaultGeneralFields;
}

// TODO: Move somewhere more appropriate and make user-configurable
public static boolean isSingleLineField(final Field field) {
return !field.getProperties().contains(FieldProperty.MULTILINE_TEXT);
if (field.equals(StandardField.ABSTRACT) || field.equals(StandardField.COMMENT)) {
return false;
}

// Treat unknown fields as multi-line fields
return !(field instanceof UnknownField);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ public enum FieldProperty {
JOURNAL_NAME,
LANGUAGE,
MONTH,
MULTILINE_TEXT,
MULTIPLE_ENTRY_LINK,
NUMERIC,
PAGES,
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/jabref/model/entry/field/StandardField.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*/
public enum StandardField implements Field {

ABSTRACT("abstract", FieldProperty.MULTILINE_TEXT),
ABSTRACT("abstract"),
ADDENDUM("addendum"),
ADDRESS("address"),
AFTERWORD("afterword", FieldProperty.PERSON_NAMES),
Expand All @@ -28,7 +28,7 @@ public enum StandardField implements Field {
BOOKTITLEADDON("booktitleaddon"),
CHAPTER("chapter"),
COMMENTATOR("commentator", FieldProperty.PERSON_NAMES),
COMMENT("comment", FieldProperty.MULTILINE_TEXT),
COMMENT("comment"),
CROSSREF("crossref", FieldProperty.SINGLE_ENTRY_LINK),
DATE("date", FieldProperty.DATE),
DAY("day"),
Expand Down

0 comments on commit b5002e0

Please sign in to comment.