diff --git a/src/main/java/org/jabref/gui/EntryType.fxml b/src/main/java/org/jabref/gui/EntryType.fxml index 43f6a88c39b..6919a33747b 100644 --- a/src/main/java/org/jabref/gui/EntryType.fxml +++ b/src/main/java/org/jabref/gui/EntryType.fxml @@ -21,16 +21,6 @@ - - - - - - - - - - diff --git a/src/main/java/org/jabref/gui/EntryTypeView.java b/src/main/java/org/jabref/gui/EntryTypeView.java index aca314aabdb..b82df361511 100644 --- a/src/main/java/org/jabref/gui/EntryTypeView.java +++ b/src/main/java/org/jabref/gui/EntryTypeView.java @@ -51,16 +51,12 @@ public class EntryTypeView extends BaseDialog { @FXML private ButtonType generateButton; @FXML private TextField idTextField; @FXML private ComboBox idBasedFetchers; - @FXML private FlowPane biblatexPane; @FXML private FlowPane recommendedEntriesPane; @FXML private FlowPane otherEntriesPane; @FXML private FlowPane customPane; - @FXML private FlowPane biblatexSoftwarePane; - @FXML private TitledPane biblatexTitlePane; @FXML private TitledPane recommendedEntriesTitlePane; @FXML private TitledPane otherEntriesTitlePane; @FXML private TitledPane customTitlePane; - @FXML private TitledPane biblatexSoftwareTitlePane; private final LibraryTab libraryTab; private final DialogService dialogService; @@ -141,9 +137,7 @@ public void initialize() { // avoids removing and adding from the scence graph recommendedEntriesTitlePane.managedProperty().bind(recommendedEntriesTitlePane.visibleProperty()); otherEntriesTitlePane.managedProperty().bind(otherEntriesTitlePane.visibleProperty()); - biblatexTitlePane.managedProperty().bind(biblatexTitlePane.visibleProperty()); customTitlePane.managedProperty().bind(customTitlePane.visibleProperty()); - biblatexSoftwareTitlePane.managedProperty().bind(biblatexSoftwareTitlePane.visibleProperty()); otherEntriesTitlePane.expandedProperty().addListener((obs, wasExpanded, isNowExpanded) -> { if (isNowExpanded) { @@ -153,36 +147,33 @@ public void initialize() { } }); - if (libraryTab.getBibDatabaseContext().isBiblatexMode()) { - addEntriesToPane(biblatexPane, BiblatexEntryTypeDefinitions.ALL); - addEntriesToPane(biblatexSoftwarePane, BiblatexSoftwareEntryTypeDefinitions.ALL); - - recommendedEntriesTitlePane.setVisible(false); - otherEntriesTitlePane.setVisible(false); - - List customTypes = Globals.entryTypesManager.getAllCustomTypes(BibDatabaseMode.BIBLATEX); - if (customTypes.isEmpty()) { - customTitlePane.setVisible(false); - } else { - addEntriesToPane(customPane, customTypes); - } + boolean isBiblatexMode = libraryTab.getBibDatabaseContext().isBiblatexMode(); + List recommendedEntries; + List otherEntries; + if (isBiblatexMode) { + recommendedEntries = BiblatexEntryTypeDefinitions.RECOMMENDED; + otherEntries = BiblatexEntryTypeDefinitions.ALL + .stream() + .filter(e -> !recommendedEntries.contains(e)) + .collect(Collectors.toList()); + otherEntries.addAll(BiblatexSoftwareEntryTypeDefinitions.ALL); } else { - biblatexTitlePane.setVisible(false); - biblatexSoftwareTitlePane.setVisible(false); - addEntriesToPane(recommendedEntriesPane, BibtexEntryTypeDefinitions.RECOMMENDED); - addEntriesToPane(otherEntriesPane, IEEETranEntryTypeDefinitions.ALL); - List otherEntriesBibtex = BibtexEntryTypeDefinitions.ALL + recommendedEntries = BibtexEntryTypeDefinitions.RECOMMENDED; + otherEntries = BibtexEntryTypeDefinitions.ALL .stream() - .filter(e -> !BibtexEntryTypeDefinitions.RECOMMENDED.contains(e)) + .filter(e -> !recommendedEntries.contains(e)) .collect(Collectors.toList()); - addEntriesToPane(otherEntriesPane, otherEntriesBibtex); + otherEntries.addAll(IEEETranEntryTypeDefinitions.ALL); + } + addEntriesToPane(recommendedEntriesPane, recommendedEntries); + addEntriesToPane(otherEntriesPane, otherEntries); - List customTypes = Globals.entryTypesManager.getAllCustomTypes(BibDatabaseMode.BIBTEX); - if (customTypes.isEmpty()) { - customTitlePane.setVisible(false); - } else { - addEntriesToPane(customPane, customTypes); - } + BibDatabaseMode customTypeDatabaseMode = isBiblatexMode ? BibDatabaseMode.BIBLATEX : BibDatabaseMode.BIBTEX; + List customTypes = Globals.entryTypesManager.getAllCustomTypes(customTypeDatabaseMode); + if (customTypes.isEmpty()) { + customTitlePane.setVisible(false); + } else { + addEntriesToPane(customPane, customTypes); } viewModel.idTextProperty().addListener((obs, oldValue, newValue) -> diff --git a/src/main/java/org/jabref/model/entry/types/BiblatexEntryTypeDefinitions.java b/src/main/java/org/jabref/model/entry/types/BiblatexEntryTypeDefinitions.java index f065c0b3289..87db17e110d 100644 --- a/src/main/java/org/jabref/model/entry/types/BiblatexEntryTypeDefinitions.java +++ b/src/main/java/org/jabref/model/entry/types/BiblatexEntryTypeDefinitions.java @@ -442,4 +442,6 @@ public class BiblatexEntryTypeDefinitions { BOOKLET, COLLECTION, MVCOLLECTION, INCOLLECTION, SUPPCOLLECTION, MANUAL, MISC, ONLINE, PATENT, PERIODICAL, SUPPPERIODICAL, PROCEEDINGS, MVPROCEEDINGS, INPROCEEDINGS, REFERENCE, MVREFERENCE, INREFERENCE, REPORT, SET, THESIS, UNPUBLISHED, CONFERENCE, ELECTRONIC, MASTERSTHESIS, PHDTHESIS, TECHREPORT, WWW, SOFTWARE, DATASET); + + public static final List RECOMMENDED = Arrays.asList(ARTICLE, BOOK, INPROCEEDINGS, REPORT, MISC); }