diff --git a/CHANGELOG.md b/CHANGELOG.md index 53009b56126..60bab79799a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,8 @@ to [sourceforge feature requests](https://sourceforge.net/p/jabref/features/) by - Moved default bibliography mode to general preferences tab - Add dialog to show all preferences in their raw form plus some filtering - Added Ordinal formatter (1 -> 1st etc) +- [#492](https://github.com/JabRef/jabref/issues/492): If no text is marked, the whole field is copied. Preview of pasted text in tool tip +- [#454](https://github.com/JabRef/jabref/issues/454) Add a tab that shows all remaining entry fields that are not displayed in any other tab - The LaTeX to Unicode/HTML functionality is much improved by covering many more cases - Ability to convert from LaTeX to Unicode in right-click field menu diff --git a/src/main/java/net/sf/jabref/JabRefPreferences.java b/src/main/java/net/sf/jabref/JabRefPreferences.java index 6ff86dc6abf..66e55f93681 100644 --- a/src/main/java/net/sf/jabref/JabRefPreferences.java +++ b/src/main/java/net/sf/jabref/JabRefPreferences.java @@ -814,6 +814,24 @@ private JabRefPreferences() { } } + public List getCustomTabFieldNames() { + List customFields = new ArrayList<>(); + + int defNumber = 0; + while(true) { + // saved as CUSTOMTABNAME_def{number} and ; separated + String fields = (String) defaults.get(CUSTOM_TAB_FIELDS + "_def" + defNumber); + + if(fields == null || fields.isEmpty()) { + break; + } + + customFields.addAll(Arrays.asList(fields.split(";"))); + defNumber++; + } + return customFields; + } + public void setLanguageDependentDefaultValues() { // Entry editor tab 0: defaults.put(CUSTOM_TAB_NAME + "_def0", Localization.lang("General")); diff --git a/src/main/java/net/sf/jabref/gui/GenFieldsCustomizer.java b/src/main/java/net/sf/jabref/gui/GenFieldsCustomizer.java index b562e4de16e..a83c8d2bfd9 100644 --- a/src/main/java/net/sf/jabref/gui/GenFieldsCustomizer.java +++ b/src/main/java/net/sf/jabref/gui/GenFieldsCustomizer.java @@ -29,15 +29,6 @@ import net.sf.jabref.logic.l10n.Localization; import net.sf.jabref.logic.labelpattern.LabelPatternUtil; -/** - *

Title:

- *

Description:

- *

Copyright: Copyright (c) 2003

- *

Company:

- * @author not attributable - * @version 1.0 - */ - public class GenFieldsCustomizer extends JDialog { private final JPanel buttons = new JPanel(); @@ -55,8 +46,7 @@ public class GenFieldsCustomizer extends JDialog { private final JabRefFrame parentFrame; private final JButton revert = new JButton(); - - public GenFieldsCustomizer(JabRefFrame frame/*, EntryCustomizationDialog diag*/) { + public GenFieldsCustomizer(JabRefFrame frame) { super(frame, Localization.lang("Set general fields"), false); parentFrame = frame; helpBut = new HelpAction(HelpFiles.generalFieldsHelp).getHelpButton(); @@ -181,4 +171,4 @@ private void revertActionPerformed() { fieldsArea.setText(sb.toString()); } -} +} \ No newline at end of file diff --git a/src/main/java/net/sf/jabref/gui/entryeditor/EntryEditor.java b/src/main/java/net/sf/jabref/gui/entryeditor/EntryEditor.java index 83aa84ac31e..570c53d71f4 100644 --- a/src/main/java/net/sf/jabref/gui/entryeditor/EntryEditor.java +++ b/src/main/java/net/sf/jabref/gui/entryeditor/EntryEditor.java @@ -34,6 +34,8 @@ import java.io.IOException; import java.io.StringWriter; import java.util.*; +import java.util.stream.Collectors; +import java.util.stream.Stream; import javax.swing.*; import javax.swing.event.ChangeEvent; @@ -193,27 +195,35 @@ private void setupFieldPanels() { EntryType type = EntryTypes.getTypeOrDefault(entry.getType(), this.frame.getCurrentBasePanel().getBibDatabaseContext().getMode()); - List fieldList = type.getRequiredFieldsFlat(); + // required fields + List requiredFields = type.getRequiredFieldsFlat(); - EntryEditorTab reqPan = new EntryEditorTab(frame, panel, fieldList, this, true, false, Localization.lang("Required fields")); - if (reqPan.fileListEditor != null) { - fileListEditor = reqPan.fileListEditor; + EntryEditorTab requiredPanel = new EntryEditorTab(frame, panel, requiredFields, this, true, false, Localization.lang("Required fields")); + if (requiredPanel.fileListEditor != null) { + fileListEditor = requiredPanel.fileListEditor; } - tabbed.addTab(Localization.lang("Required fields"), IconTheme.JabRefIcon.REQUIRED.getSmallIcon(), reqPan + tabbed.addTab(Localization.lang("Required fields"), IconTheme.JabRefIcon.REQUIRED.getSmallIcon(), requiredPanel .getPane(), Localization.lang("Show required fields")); - tabs.add(reqPan); + tabs.add(requiredPanel); + + // optional fields + List displayedOptionalFields = new ArrayList<>(); if ((type.getOptionalFields() != null) && (type.getOptionalFields().size() >= 1)) { EntryEditorTab optPan; - if (this.frame.getCurrentBasePanel().getBibDatabaseContext().isBiblatexMode()) { - optPan = new EntryEditorTab(frame, panel, type.getPrimaryOptionalFields(), this, - false, true, Localization.lang("Optional fields")); + + if (!this.frame.getCurrentBasePanel().getBibDatabaseContext().isBiblatexMode()) { + optPan = new EntryEditorTab(frame, panel, type.getOptionalFields(), this, + false, false, Localization.lang("Optional fields")); if (optPan.fileListEditor != null) { fileListEditor = optPan.fileListEditor; } tabbed.addTab(Localization.lang("Optional fields"), IconTheme.JabRefIcon.OPTIONAL.getSmallIcon(), optPan .getPane(), Localization.lang("Show optional fields")); tabs.add(optPan); + } else { + displayedOptionalFields.addAll(type.getPrimaryOptionalFields()); + displayedOptionalFields.addAll(type.getSecondaryOptionalFields()); Set deprecatedFields = new HashSet<>(EntryConverter.FIELD_ALIASES_TEX_TO_LTX.keySet()); deprecatedFields.add("year"); @@ -256,18 +266,26 @@ private void setupFieldPanels() { .getPane(), Localization.lang("Show deprecated bibtex fields")); tabs.add(optPan3); } - } else { - optPan = new EntryEditorTab(frame, panel, type.getOptionalFields(), this, false, false, - Localization.lang("Optional fields")); - if (optPan.fileListEditor != null) { - fileListEditor = optPan.fileListEditor; - } - tabbed.addTab(Localization.lang("Optional fields"), IconTheme.JabRefIcon.OPTIONAL.getSmallIcon(), - optPan.getPane(), Localization.lang("Show optional fields")); - tabs.add(optPan); } } + // other fields + List displayedFields = Stream.concat(requiredFields.stream(), displayedOptionalFields.stream()).map(String::toLowerCase).collect(Collectors.toList()); + List otherFields = this.entry.getFieldNames().stream().map(String::toLowerCase).filter(f -> !displayedFields.contains(f)).collect(Collectors.toList()); + otherFields.remove("bibtexkey"); + otherFields.removeAll(Globals.prefs.getCustomTabFieldNames()); + + if(!otherFields.isEmpty()) { + EntryEditorTab otherPanel = new EntryEditorTab(frame, panel, otherFields, this, + false, false, Localization.lang("Other fields")); + if (otherPanel.fileListEditor != null) { + fileListEditor = otherPanel.fileListEditor; + } + tabbed.addTab(Localization.lang("Other fields"), IconTheme.JabRefIcon.OPTIONAL.getSmallIcon(), otherPanel + .getPane(), Localization.lang("Show remaining fields")); + tabs.add(otherPanel); + } + EntryEditorTabList tabList = Globals.prefs.getEntryEditorTabList(); for (int i = 0; i < tabList.getTabCount(); i++) { EntryEditorTab newTab = new EntryEditorTab(frame, panel, tabList.getTabFields(i), this, false, diff --git a/src/main/resources/l10n/JabRef_da.properties b/src/main/resources/l10n/JabRef_da.properties index 41a8d580cd5..d33760eb6a0 100644 --- a/src/main/resources/l10n/JabRef_da.properties +++ b/src/main/resources/l10n/JabRef_da.properties @@ -1764,6 +1764,8 @@ value= Show_preferences= Enter_field_name_(e.g.,_title,_author)= +Other_fields= +Show_remaining_fields= link_should_refer_to_a_correct_file_path= abbreviation_detected= diff --git a/src/main/resources/l10n/JabRef_de.properties b/src/main/resources/l10n/JabRef_de.properties index f52978e4bcd..c8cafff9b6f 100644 --- a/src/main/resources/l10n/JabRef_de.properties +++ b/src/main/resources/l10n/JabRef_de.properties @@ -2474,6 +2474,9 @@ Show_preferences= Enter_field_name_(e.g.,_title,_author)= +Other_fields= +Show_remaining_fields= + link_should_refer_to_a_correct_file_path= abbreviation_detected= diff --git a/src/main/resources/l10n/JabRef_en.properties b/src/main/resources/l10n/JabRef_en.properties index 12dc4474743..e47cbfa5dd3 100644 --- a/src/main/resources/l10n/JabRef_en.properties +++ b/src/main/resources/l10n/JabRef_en.properties @@ -2448,7 +2448,12 @@ Show_preferences=Show_preferences Save_actions=Save_actions Enable_save_actions=Enable_save_actions Enter_field_name_(e.g.,_title,_author)=Enter_field_name_(e.g.,_title,_author) + +Other_fields=Other_fields +Show_remaining_fields=Show_remaining_fields + link_should_refer_to_a_correct_file_path=link_should_refer_to_a_correct_file_path abbreviation_detected=abbreviation_detected wrong_entry_type_as_proceedings_has_page_numbers=wrong_entry_type_as_proceedings_has_page_numbers Copy_special=Copy_special + diff --git a/src/main/resources/l10n/JabRef_es.properties b/src/main/resources/l10n/JabRef_es.properties index 83c0cecba5d..aaed3c0daec 100644 --- a/src/main/resources/l10n/JabRef_es.properties +++ b/src/main/resources/l10n/JabRef_es.properties @@ -1664,8 +1664,12 @@ Show_preferences= Enter_field_name_(e.g.,_title,_author)= +Other_fields= +Show_remaining_fields= + link_should_refer_to_a_correct_file_path= abbreviation_detected= wrong_entry_type_as_proceedings_has_page_numbers= Copy_special= + diff --git a/src/main/resources/l10n/JabRef_fa.properties b/src/main/resources/l10n/JabRef_fa.properties index ecb2eecf0e1..9127d75e925 100644 --- a/src/main/resources/l10n/JabRef_fa.properties +++ b/src/main/resources/l10n/JabRef_fa.properties @@ -2451,8 +2451,12 @@ Show_preferences= Enter_field_name_(e.g.,_title,_author)= +Other_fields= +Show_remaining_fields= + link_should_refer_to_a_correct_file_path= abbreviation_detected= wrong_entry_type_as_proceedings_has_page_numbers= Copy_special= + diff --git a/src/main/resources/l10n/JabRef_fr.properties b/src/main/resources/l10n/JabRef_fr.properties index 7632e0e914f..30b7754b6fb 100644 --- a/src/main/resources/l10n/JabRef_fr.properties +++ b/src/main/resources/l10n/JabRef_fr.properties @@ -1703,8 +1703,12 @@ Show_preferences= Enter_field_name_(e.g.,_title,_author)= +Other_fields= +Show_remaining_fields= + link_should_refer_to_a_correct_file_path= abbreviation_detected= wrong_entry_type_as_proceedings_has_page_numbers= Copy_special= + diff --git a/src/main/resources/l10n/JabRef_in.properties b/src/main/resources/l10n/JabRef_in.properties index a38b3eab850..7652ea89260 100644 --- a/src/main/resources/l10n/JabRef_in.properties +++ b/src/main/resources/l10n/JabRef_in.properties @@ -1685,8 +1685,13 @@ Show_preferences= Enter_field_name_(e.g.,_title,_author)= + +Other_fields= +Show_remaining_fields= + link_should_refer_to_a_correct_file_path= abbreviation_detected= wrong_entry_type_as_proceedings_has_page_numbers= Copy_special= + diff --git a/src/main/resources/l10n/JabRef_it.properties b/src/main/resources/l10n/JabRef_it.properties index 0c7ec6cd139..95983c4dbd6 100644 --- a/src/main/resources/l10n/JabRef_it.properties +++ b/src/main/resources/l10n/JabRef_it.properties @@ -1783,6 +1783,9 @@ Show_preferences= Enter_field_name_(e.g.,_title,_author)= +Other_fields= +Show_remaining_fields= + link_should_refer_to_a_correct_file_path= abbreviation_detected= diff --git a/src/main/resources/l10n/JabRef_ja.properties b/src/main/resources/l10n/JabRef_ja.properties index 4223ee4c123..022da4c3f5c 100644 --- a/src/main/resources/l10n/JabRef_ja.properties +++ b/src/main/resources/l10n/JabRef_ja.properties @@ -2457,8 +2457,13 @@ Show_preferences= Enter_field_name_(e.g.,_title,_author)= + +Other_fields= +Show_remaining_fields= + link_should_refer_to_a_correct_file_path= abbreviation_detected= wrong_entry_type_as_proceedings_has_page_numbers= Copy_special= + diff --git a/src/main/resources/l10n/JabRef_nl.properties b/src/main/resources/l10n/JabRef_nl.properties index cf5eebe3b77..2c59ca97584 100644 --- a/src/main/resources/l10n/JabRef_nl.properties +++ b/src/main/resources/l10n/JabRef_nl.properties @@ -2458,6 +2458,9 @@ Show_preferences= Enter_field_name_(e.g.,_title,_author)= +Other_fields= +Show_remaining_fields= + link_should_refer_to_a_correct_file_path= abbreviation_detected= diff --git a/src/main/resources/l10n/JabRef_no.properties b/src/main/resources/l10n/JabRef_no.properties index 9ddee3277a7..86a44360e0a 100644 --- a/src/main/resources/l10n/JabRef_no.properties +++ b/src/main/resources/l10n/JabRef_no.properties @@ -2857,6 +2857,9 @@ Show_preferences= Enter_field_name_(e.g.,_title,_author)= +Other_fields= +Show_remaining_fields= + link_should_refer_to_a_correct_file_path= abbreviation_detected= diff --git a/src/main/resources/l10n/JabRef_pt_BR.properties b/src/main/resources/l10n/JabRef_pt_BR.properties index 05c6f10d203..b43bf370f39 100644 --- a/src/main/resources/l10n/JabRef_pt_BR.properties +++ b/src/main/resources/l10n/JabRef_pt_BR.properties @@ -1677,6 +1677,9 @@ Show_preferences= Enter_field_name_(e.g.,_title,_author)= +Other_fields= +Show_remaining_fields= + link_should_refer_to_a_correct_file_path= abbreviation_detected= diff --git a/src/main/resources/l10n/JabRef_ru.properties b/src/main/resources/l10n/JabRef_ru.properties index 1b072ecfc06..cb21b0183dd 100644 --- a/src/main/resources/l10n/JabRef_ru.properties +++ b/src/main/resources/l10n/JabRef_ru.properties @@ -2458,6 +2458,9 @@ Show_preferences= Enter_field_name_(e.g.,_title,_author)= +Other_fields= +Show_remaining_fields= + link_should_refer_to_a_correct_file_path= abbreviation_detected= diff --git a/src/main/resources/l10n/JabRef_tr.properties b/src/main/resources/l10n/JabRef_tr.properties index 6f4c6cd6eb9..90a1b98e4d9 100644 --- a/src/main/resources/l10n/JabRef_tr.properties +++ b/src/main/resources/l10n/JabRef_tr.properties @@ -1698,6 +1698,9 @@ Show_preferences= Enter_field_name_(e.g.,_title,_author)= +Other_fields= +Show_remaining_fields= + link_should_refer_to_a_correct_file_path= abbreviation_detected= diff --git a/src/main/resources/l10n/JabRef_vi.properties b/src/main/resources/l10n/JabRef_vi.properties index 7286040b9da..ce1f868a862 100644 --- a/src/main/resources/l10n/JabRef_vi.properties +++ b/src/main/resources/l10n/JabRef_vi.properties @@ -2455,6 +2455,8 @@ Show_preferences= Enter_field_name_(e.g.,_title,_author)= +Other_fields= +Show_remaining_fields= link_should_refer_to_a_correct_file_path= abbreviation_detected= diff --git a/src/main/resources/l10n/JabRef_zh.properties b/src/main/resources/l10n/JabRef_zh.properties index 5551d0513ed..686c6402b42 100644 --- a/src/main/resources/l10n/JabRef_zh.properties +++ b/src/main/resources/l10n/JabRef_zh.properties @@ -2452,6 +2452,8 @@ Show_preferences= Enter_field_name_(e.g.,_title,_author)= +Other_fields= +Show_remaining_fields= link_should_refer_to_a_correct_file_path= abbreviation_detected=