diff --git a/src/main/java/org/jabref/gui/EntryTypeView.java b/src/main/java/org/jabref/gui/EntryTypeView.java index e7ffea9fe14..52dac1b4bfe 100644 --- a/src/main/java/org/jabref/gui/EntryTypeView.java +++ b/src/main/java/org/jabref/gui/EntryTypeView.java @@ -12,7 +12,9 @@ import javafx.scene.control.ComboBox; import javafx.scene.control.TextField; import javafx.scene.control.TitledPane; +import javafx.scene.control.Tooltip; import javafx.scene.layout.FlowPane; +import javafx.stage.Screen; import org.jabref.Globals; import org.jabref.gui.util.BaseDialog; @@ -26,6 +28,8 @@ import org.jabref.model.entry.types.BibtexEntryTypeDefinitions; import org.jabref.model.entry.types.EntryType; import org.jabref.model.entry.types.IEEETranEntryTypeDefinitions; +import org.jabref.model.entry.types.StandardEntryType; +import org.jabref.model.strings.StringUtil; import org.jabref.preferences.JabRefPreferences; import com.airhacks.afterburner.views.ViewLoader; @@ -92,6 +96,17 @@ private void addEntriesToPane(FlowPane pane, Collection entryButton.setUserData(entryType); entryButton.setOnAction(event -> setEntryTypeForReturnAndClose(Optional.of(entryType))); pane.getChildren().add(entryButton); + + EntryType selectedType = entryType.getType(); + String description = getDescription(selectedType); + if (StringUtil.isNotBlank(description)) { + Screen currentScreen = Screen.getPrimary(); + double maxWidth = currentScreen.getBounds().getWidth(); + Tooltip tooltip = new Tooltip(description); + tooltip.setMaxWidth((maxWidth * 2) / 3); + tooltip.setWrapText(true); + entryButton.setTooltip(tooltip); + } } } @@ -168,4 +183,116 @@ private void setEntryTypeForReturnAndClose(Optional entryType) { viewModel.stopFetching(); this.close(); } + + //The description is coming from biblatex manual chapter 2 + //Biblatex documentation is favored over the bibtex, + //since bibtex is a subset of biblatex and biblatex is better documented. + public static String getDescription(EntryType selectedType) { + if (selectedType instanceof StandardEntryType) { + switch ((StandardEntryType) selectedType) { + case Article -> { + return Localization.lang("An article in a journal, magazine, newspaper, or other periodical which forms a self-contained unit with its own title."); + } + case Book -> { + return Localization.lang("A single-volume book with one or more authors where the authors share credit for the work as a whole."); + } + case Booklet -> { + return Localization.lang("A book-like work without a formal publisher or sponsoring institution."); + } + case Collection -> { + return Localization.lang("A single-volume collection with multiple, self-contained contributions by distinct authors which have their own title. The work as a whole has no overall author but it will usually have an editor."); + } + case Conference -> { + return Localization.lang("A legacy alias for \"InProceedings\"."); + } + case InBook -> { + return Localization.lang("A part of a book which forms a self-contained unit with its own title."); + } + case InCollection -> { + return Localization.lang("A contribution to a collection which forms a self-contained unit with a distinct author and title."); + } + case InProceedings -> { + return Localization.lang("An article in a conference proceedings."); + } + case Manual -> { + return Localization.lang("Technical or other documentation, not necessarily in printed form."); + } + case MastersThesis -> { + return Localization.lang("Similar to \"Thesis\" except that the type field is optional and defaults to the localised term Master's thesis."); + } + case Misc -> { + return Localization.lang("A fallback type for entries which do not fit into any other category."); + } + case PhdThesis -> { + return Localization.lang("Similar to \"Thesis\" except that the type field is optional and defaults to the localised term PhD thesis."); + } + case Proceedings -> { + return Localization.lang("A single-volume conference proceedings. This type is very similar to \"Collection\"."); + } + case TechReport -> { + return Localization.lang("Similar to \"Report\" except that the type field is optional and defaults to the localised term technical report."); + } + case Unpublished -> { + return Localization.lang("A work with an author and a title which has not been formally published, such as a manuscript or the script of a talk."); + } + case BookInBook -> { + return Localization.lang("This type is similar to \"InBook\" but intended for works originally published as a stand-alone book."); + } + case InReference -> { + return Localization.lang("An article in a work of reference. This is a more specific variant of the generic \"InCollection\" entry type."); + } + case MvBook -> { + return Localization.lang("A multi-volume \"Book\"."); + } + case MvCollection -> { + return Localization.lang("A multi-volume \"Collection\"."); + } + case MvProceedings -> { + return Localization.lang("A multi-volume \"Proceedings\" entry."); + } + case MvReference -> { + return Localization.lang("A multi-volume \"Reference\" entry. The standard styles will treat this entry type as an alias for \"MvCollection\"."); + } + case Online -> { + return Localization.lang("This entry type is intended for sources such as web sites which are intrinsically online resources."); + } + case Reference -> { + return Localization.lang("A single-volume work of reference such as an encyclopedia or a dictionary."); + } + case Report -> { + return Localization.lang("A technical report, research report, or white paper published by a university or some other institution."); + } + case Set -> { + return Localization.lang("An entry set is a group of entries which are cited as a single reference and listed as a single item in the bibliography."); + } + case SuppBook -> { + return Localization.lang("Supplemental material in a \"Book\". This type is provided for elements such as prefaces, introductions, forewords, afterwords, etc. which often have a generic title only."); + } + case SuppCollection -> { + return Localization.lang("Supplemental material in a \"Collection\"."); + } + case SuppPeriodical -> { + return Localization.lang("Supplemental material in a \"Periodical\". This type may be useful when referring to items such as regular columns, obituaries, letters to the editor, etc. which only have a generic title."); + } + case Thesis -> { + return Localization.lang("A thesis written for an educational institution to satisfy the requirements for a degree."); + } + case WWW -> { + return Localization.lang("An alias for \"Online\", provided for jurabib compatibility."); + } + case Software -> { + return Localization.lang("Computer software. The standard styles will treat this entry type as an alias for \"Misc\"."); + } + case Dataset -> { + return Localization.lang("A data set or a similar collection of (mostly) raw data."); + } + default -> { + return ""; + } + } + } else { + return ""; + } + } + } diff --git a/src/main/java/org/jabref/gui/menus/ChangeEntryTypeMenu.java b/src/main/java/org/jabref/gui/menus/ChangeEntryTypeMenu.java index bf574cf411a..e5625178f81 100644 --- a/src/main/java/org/jabref/gui/menus/ChangeEntryTypeMenu.java +++ b/src/main/java/org/jabref/gui/menus/ChangeEntryTypeMenu.java @@ -7,11 +7,15 @@ import javafx.collections.ObservableList; import javafx.scene.control.ContextMenu; +import javafx.scene.control.CustomMenuItem; +import javafx.scene.control.Label; import javafx.scene.control.Menu; import javafx.scene.control.MenuItem; import javafx.scene.control.SeparatorMenuItem; +import javafx.scene.control.Tooltip; import org.jabref.Globals; +import org.jabref.gui.EntryTypeView; import org.jabref.gui.undo.CountingUndoManager; import org.jabref.gui.undo.NamedCompound; import org.jabref.gui.undo.UndoableChangeType; @@ -23,6 +27,7 @@ import org.jabref.model.entry.types.BibtexEntryTypeDefinitions; import org.jabref.model.entry.types.EntryType; import org.jabref.model.entry.types.IEEETranEntryTypeDefinitions; +import org.jabref.model.strings.StringUtil; public class ChangeEntryTypeMenu { @@ -31,13 +36,18 @@ public ChangeEntryTypeMenu() { } public static MenuItem createMenuItem(EntryType type, BibEntry entry, UndoManager undoManager) { - MenuItem menuItem = new MenuItem(type.getDisplayName()); + CustomMenuItem menuItem = new CustomMenuItem(new Label(type.getDisplayName())); menuItem.setOnAction(event -> { NamedCompound compound = new NamedCompound(Localization.lang("Change entry type")); entry.setType(type) .ifPresent(change -> compound.addEdit(new UndoableChangeType(change))); undoManager.addEdit(compound); }); + String description = EntryTypeView.getDescription(type); + if (StringUtil.isNotBlank(description)) { + Tooltip tooltip = new Tooltip(description); + Tooltip.install(menuItem.getContent(), tooltip); + } return menuItem; } @@ -92,4 +102,5 @@ private void populate(ObservableList items, Collection t private void populate(Menu menu, Collection types, BibEntry entry, UndoManager undoManager) { populate(menu.getItems(), types, entry, undoManager); } + } 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 874db26a41a..3f23b717932 100644 --- a/src/main/java/org/jabref/model/entry/types/BiblatexEntryTypeDefinitions.java +++ b/src/main/java/org/jabref/model/entry/types/BiblatexEntryTypeDefinitions.java @@ -427,7 +427,7 @@ public class BiblatexEntryTypeDefinitions { .build(); private static final BibEntryType DATASET = new BibEntryTypeBuilder() - .withType(StandardEntryType.DATESET) + .withType(StandardEntryType.Dataset) .withImportantFields( StandardField.SUBTITLE, StandardField.TITLEADDON, StandardField.HOWPUBLISHED, StandardField.LOCATION, StandardField.DOI, StandardField.EPRINT, StandardField.EPRINTCLASS, StandardField.EPRINTTYPE, StandardField.URL, StandardField.URLDATE) diff --git a/src/main/java/org/jabref/model/entry/types/StandardEntryType.java b/src/main/java/org/jabref/model/entry/types/StandardEntryType.java index 9b2f87d1674..8a01a87cb32 100644 --- a/src/main/java/org/jabref/model/entry/types/StandardEntryType.java +++ b/src/main/java/org/jabref/model/entry/types/StandardEntryType.java @@ -36,7 +36,7 @@ public enum StandardEntryType implements EntryType { Thesis("Thesis"), WWW("WWW"), Software("Software"), - DATESET("DataSet"); + Dataset("Dataset"); diff --git a/src/main/resources/l10n/JabRef_en.properties b/src/main/resources/l10n/JabRef_en.properties index 51c0637f60d..c81ad5f95b3 100644 --- a/src/main/resources/l10n/JabRef_en.properties +++ b/src/main/resources/l10n/JabRef_en.properties @@ -2199,4 +2199,37 @@ User-specific\ relevance\ flag,\ in\ case\ the\ entry\ is\ relevant.=User-specif Remove\ formatter\ for\ %0=Remove formatter for %0 Remove\ formatter\ '%0'=Remove formatter '%0' + +An\ article\ in\ a\ journal,\ magazine,\ newspaper,\ or\ other\ periodical\ which\ forms\ a\ self-contained\ unit\ with\ its\ own\ title.=An article in a journal, magazine, newspaper, or other periodical which forms a self-contained unit with its own title. +A\ single-volume\ book\ with\ one\ or\ more\ authors\ where\ the\ authors\ share\ credit\ for\ the\ work\ as\ a\ whole.=A single-volume book with one or more authors where the authors share credit for the work as a whole. +A\ book-like\ work\ without\ a\ formal\ publisher\ or\ sponsoring\ institution.=A book-like work without a formal publisher or sponsoring institution. +A\ single-volume\ collection\ with\ multiple,\ self-contained\ contributions\ by\ distinct\ authors\ which\ have\ their\ own\ title.\ The\ work\ as\ a\ whole\ has\ no\ overall\ author\ but\ it\ will\ usually\ have\ an\ editor.=A single-volume collection with multiple, self-contained contributions by distinct authors which have their own title. The work as a whole has no overall author but it will usually have an editor. +A\ legacy\ alias\ for\ "InProceedings".=A legacy alias for "InProceedings". +A\ part\ of\ a\ book\ which\ forms\ a\ self-contained\ unit\ with\ its\ own\ title.=A part of a book which forms a self-contained unit with its own title. +A\ contribution\ to\ a\ collection\ which\ forms\ a\ self-contained\ unit\ with\ a\ distinct\ author\ and\ title.=A contribution to a collection which forms a self-contained unit with a distinct author and title. +An\ article\ in\ a\ conference\ proceedings.=An article in a conference proceedings. +Technical\ or\ other\ documentation,\ not\ necessarily\ in\ printed\ form.=Technical or other documentation, not necessarily in printed form. +A\ fallback\ type\ for\ entries\ which\ do\ not\ fit\ into\ any\ other\ category.=A fallback type for entries which do not fit into any other category. +Similar\ to\ "Thesis"\ except\ that\ the\ type\ field\ is\ optional\ and\ defaults\ to\ the\ localised\ term\ PhD\ thesis.=Similar to "Thesis" except that the type field is optional and defaults to the localised term PhD thesis. +A\ single-volume\ conference\ proceedings.\ This\ type\ is\ very\ similar\ to\ "Collection".=A single-volume conference proceedings. This type is very similar to "Collection". +Similar\ to\ "Report"\ except\ that\ the\ type\ field\ is\ optional\ and\ defaults\ to\ the\ localised\ term\ technical\ report.=Similar to "Report" except that the type field is optional and defaults to the localised term technical report. +A\ work\ with\ an\ author\ and\ a\ title\ which\ has\ not\ been\ formally\ published,\ such\ as\ a\ manuscript\ or\ the\ script\ of\ a\ talk.=A work with an author and a title which has not been formally published, such as a manuscript or the script of a talk. +This\ type\ is\ similar\ to\ "InBook"\ but\ intended\ for\ works\ originally\ published\ as\ a\ stand-alone\ book.=This type is similar to "InBook" but intended for works originally published as a stand-alone book. +An\ article\ in\ a\ work\ of\ reference.\ This\ is\ a\ more\ specific\ variant\ of\ the\ generic\ "InCollection"\ entry\ type.=An article in a work of reference. This is a more specific variant of the generic "InCollection" entry type. +A\ multi-volume\ "Book".=A multi-volume "Book". +A\ multi-volume\ "Collection".=A multi-volume "Collection". +A\ multi-volume\ "Proceedings"\ entry.=A multi-volume "Proceedings" entry. +A\ multi-volume\ "Reference"\ entry.\ The\ standard\ styles\ will\ treat\ this\ entry\ type\ as\ an\ alias\ for\ "MvCollection".=A multi-volume "Reference" entry. The standard styles will treat this entry type as an alias for "MvCollection". +This\ entry\ type\ is\ intended\ for\ sources\ such\ as\ web\ sites\ which\ are\ intrinsically\ online\ resources.=This entry type is intended for sources such as web sites which are intrinsically online resources. +A\ single-volume\ work\ of\ reference\ such\ as\ an\ encyclopedia\ or\ a\ dictionary.=A single-volume work of reference such as an encyclopedia or a dictionary. +A\ technical\ report,\ research\ report,\ or\ white\ paper\ published\ by\ a\ university\ or\ some\ other\ institution.=A technical report, research report, or white paper published by a university or some other institution. +An\ entry\ set\ is\ a\ group\ of\ entries\ which\ are\ cited\ as\ a\ single\ reference\ and\ listed\ as\ a\ single\ item\ in\ the\ bibliography.=An entry set is a group of entries which are cited as a single reference and listed as a single item in the bibliography. +Supplemental\ material\ in\ a\ "Book".\ This\ type\ is\ provided\ for\ elements\ such\ as\ prefaces,\ introductions,\ forewords,\ afterwords,\ etc.\ which\ often\ have\ a\ generic\ title\ only.=Supplemental material in a "Book". This type is provided for elements such as prefaces, introductions, forewords, afterwords, etc. which often have a generic title only. +Supplemental\ material\ in\ a\ "Collection".=Supplemental material in a "Collection". +Supplemental\ material\ in\ a\ "Periodical".\ This\ type\ may\ be\ useful\ when\ referring\ to\ items\ such\ as\ regular\ columns,\ obituaries,\ letters\ to\ the\ editor,\ etc.\ which\ only\ have\ a\ generic\ title.=Supplemental material in a "Periodical". This type may be useful when referring to items such as regular columns, obituaries, letters to the editor, etc. which only have a generic title. +A\ thesis\ written\ for\ an\ educational\ institution\ to\ satisfy\ the\ requirements\ for\ a\ degree.=A thesis written for an educational institution to satisfy the requirements for a degree. +An\ alias\ for\ "Online",\ provided\ for\ jurabib\ compatibility.=An alias for "Online", provided for jurabib compatibility. +Computer\ software.\ The\ standard\ styles\ will\ treat\ this\ entry\ type\ as\ an\ alias\ for\ "Misc".=Computer software. The standard styles will treat this entry type as an alias for "Misc". +A\ data\ set\ or\ a\ similar\ collection\ of\ (mostly)\ raw\ data.=A data set or a similar collection of (mostly) raw data. + Display\ count\ of\ items\ in\ group=Display count of items in group