diff --git a/CHANGELOG.md b/CHANGELOG.md index ea79b7a3dc9..96db4a75227 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -42,6 +42,7 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv - We changed the duplicate handling in the Import entries dialog. Potential duplicate entries are marked with an icon and importing will now trigger the merge dialog [#10914](https://github.com/JabRef/jabref/pull/10914) - We made the command "Push to TexShop" more robust to allow cite commands with a character before the first slash. [forum#2699](https://discourse.jabref.org/t/push-to-texshop-mac/2699/17?u=siedlerchr) - We only show the notification "Saving library..." if the library contains more than 2000 entries. [#9803](https://github.com/JabRef/jabref/issues/9803) +- JabRef now keeps previous log files upon start. [#11023](https://github.com/JabRef/jabref/pull/11023) - We enhanced the dialog for adding new fields in the content selector with a selection box containing a list of standard fields. [#10912](https://github.com/JabRef/jabref/pull/10912) - We store the citation relations in an LRU cache to avoid bloating the memory and out-of-memory exceptions. [#10958](https://github.com/JabRef/jabref/issues/10958) - Keywords filed are now displayed as tags. [#10910](https://github.com/JabRef/jabref/pull/10910) @@ -53,6 +54,7 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv - We fixed an issue where the preview panel showing the wrong entry (an entry that is not selected in the entry table). [#9172](https://github.com/JabRef/jabref/issues/9172) - We fixed an issue where HTML-reserved characters like '&' and '<', in addition to HTML entities like '&' were not rendered correctly in entry preview. [#10677](https://github.com/JabRef/jabref/issues/10677) - The last page of a PDF is now indexed by the full text search. [#10193](https://github.com/JabRef/jabref/issues/10193) +- The entry editor respects the configured custom tabs when showing "Other fields". [#11012](https://github.com/JabRef/jabref/pull/11012) - The default owner of an entry can be changed again. [#10924](https://github.com/JabRef/jabref/issues/10924) - We fixed an issue where the duplicate check did not take umlauts or other LaTeX-encoded characters into account. [#10744](https://github.com/JabRef/jabref/pull/10744) - We fixed the colors of the icon on hover for unset special fields. [#10431](https://github.com/JabRef/jabref/issues/10431) diff --git a/config/README.md b/config/README.md index d0a6bf89e97..0bea959d5f2 100644 --- a/config/README.md +++ b/config/README.md @@ -20,7 +20,7 @@ Style-checks are done for each pull request and installing this code style confi # Eclipse: The Eclipse code formatter style is stored in the `eclipse.gradle` file and gets imported automatically. -In case the formatter style needs to be adapted, configure it and export in in eclipse. +In case the formatter style needs to be adapted, configure it and export in eclipse. 1. Right click on the eclipse project "JabRef" 2. Select "Export > General > Preferences" diff --git a/src/main/java/org/jabref/Launcher.java b/src/main/java/org/jabref/Launcher.java index ba015659d03..8f1ea3229c7 100644 --- a/src/main/java/org/jabref/Launcher.java +++ b/src/main/java/org/jabref/Launcher.java @@ -11,7 +11,6 @@ import java.util.List; import java.util.Map; -import org.jabref.architecture.AllowedToUseStandardStreams; import org.jabref.cli.ArgumentProcessor; import org.jabref.cli.JabRefCLI; import org.jabref.gui.Globals; @@ -19,7 +18,6 @@ import org.jabref.logic.UiCommand; import org.jabref.logic.journals.JournalAbbreviationLoader; import org.jabref.logic.journals.predatory.PredatoryJournalListLoader; -import org.jabref.logic.l10n.Localization; import org.jabref.logic.net.ProxyAuthenticator; import org.jabref.logic.net.ProxyPreferences; import org.jabref.logic.net.ProxyRegisterer; @@ -48,7 +46,6 @@ * - Handle the command line arguments * - Start the JavaFX application (if not in cli mode) */ -@AllowedToUseStandardStreams("Direct output to the user") public class Launcher { private static Logger LOGGER; private static boolean isDebugEnabled; @@ -140,11 +137,14 @@ private static void addLogToDisk() { // The "Shared File Writer" is explained at // https://tinylog.org/v2/configuration/#shared-file-writer Map configuration = Map.of( - "writerFile", "shared file", - "writerFile.level", isDebugEnabled ? "debug" : "info", "level", isDebugEnabled ? "debug" : "info", - "writerFile.file", directory.resolve("log.txt").toString(), - "writerFile.charset", "UTF-8"); + "writerFile", "rolling file", + "writerFile.level", isDebugEnabled ? "debug" : "info", + // We need to manually join the path, because ".resolve" does not work on Windows, because ":" is not allowed in file names on Windows + "writerFile.file", directory + File.separator + "log_{date:yyyy-MM-dd_HH-mm-ss}.txt", + "writerFile.charset", "UTF-8", + "writerFile.policies", "startup", + "writerFile.backups", "30"); configuration.forEach(Configuration::set); initializeLogger(); @@ -169,9 +169,8 @@ private static boolean handleMultipleAppInstances(String[] args, RemotePreferenc LOGGER.debug("Passing arguments passed on to running JabRef..."); if (remoteClient.sendCommandLineArguments(args)) { // So we assume it's all taken care of, and quit. - LOGGER.debug("Arguments passed on to running JabRef instance."); - // Used for script-use output etc. to the user - System.out.println(Localization.lang("Arguments passed on to running JabRef instance. Shutting down.")); + // Output to both to the log and the screen. Therefore, we do not have an additional System.out.println. + LOGGER.info("Arguments passed on to running JabRef instance. Shutting down."); return false; } else { LOGGER.warn("Could not communicate with other running JabRef instance."); diff --git a/src/main/java/org/jabref/gui/entryeditor/OtherFieldsTab.java b/src/main/java/org/jabref/gui/entryeditor/OtherFieldsTab.java index 4ed6b1434ad..52882b29f5a 100644 --- a/src/main/java/org/jabref/gui/entryeditor/OtherFieldsTab.java +++ b/src/main/java/org/jabref/gui/entryeditor/OtherFieldsTab.java @@ -26,7 +26,6 @@ import org.jabref.model.entry.BibEntry; import org.jabref.model.entry.BibEntryType; import org.jabref.model.entry.BibEntryTypesManager; -import org.jabref.model.entry.field.BibField; import org.jabref.model.entry.field.Field; import org.jabref.model.entry.field.InternalField; import org.jabref.model.entry.field.StandardField; @@ -36,7 +35,7 @@ public class OtherFieldsTab extends FieldsEditorTab { public static final String NAME = "Other fields"; - private final List customTabFieldNames; + private final List customTabsFieldNames; private final BibEntryTypesManager entryTypesManager; public OtherFieldsTab(BibDatabaseContext databaseContext, @@ -63,8 +62,8 @@ public OtherFieldsTab(BibDatabaseContext databaseContext, indexingTaskManager); this.entryTypesManager = entryTypesManager; - this.customTabFieldNames = new ArrayList<>(); - preferences.getEntryEditorPreferences().getDefaultEntryEditorTabs().values().forEach(customTabFieldNames::addAll); + this.customTabsFieldNames = new ArrayList<>(); + preferences.getEntryEditorPreferences().getEntryEditorTabs().values().forEach(customTabsFieldNames::addAll); setText(Localization.lang("Other fields")); setTooltip(new Tooltip(Localization.lang("Show remaining fields"))); @@ -76,15 +75,21 @@ protected SequencedSet determineFieldsToShow(BibEntry entry) { BibDatabaseMode mode = databaseContext.getMode(); Optional entryType = entryTypesManager.enrich(entry.getType(), mode); if (entryType.isPresent()) { + // Get all required and optional fields configured for the entry Set allKnownFields = entryType.get().getAllFields(); + // Remove all fields being required or optional SequencedSet otherFields = entry.getFields().stream() - .filter(field -> !allKnownFields.contains(field) && - !(field.equals(StandardField.COMMENT) || field instanceof UserSpecificCommentField)) + .filter(field -> !allKnownFields.contains(field)) .collect(Collectors.toCollection(LinkedHashSet::new)); - otherFields.removeAll(entryType.get().getDeprecatedFields(mode)); - otherFields.removeAll(entryType.get().getOptionalFields().stream().map(BibField::field).toList()); + // The key field is in the required tab, but has a special treatment otherFields.remove(InternalField.KEY_FIELD); - customTabFieldNames.forEach(otherFields::remove); + // Remove all fields contained in JabRef's tab "Deprecated" + otherFields.removeAll(entryType.get().getDeprecatedFields(mode)); + // Remove all fields contained in the custom tabs + customTabsFieldNames.forEach(otherFields::remove); + // Remove all user-comment fields (tab org.jabref.gui.entryeditor.CommentsTab) + otherFields.removeIf(field -> field.equals(StandardField.COMMENT)); + otherFields.removeIf(field -> field instanceof UserSpecificCommentField); return otherFields; } else { // Entry type unknown -> treat all fields as required (thus no other fields) diff --git a/src/main/java/org/jabref/logic/importer/fetcher/DBLPFetcher.java b/src/main/java/org/jabref/logic/importer/fetcher/DBLPFetcher.java index 1eef08ff5f6..2c67443bb6a 100644 --- a/src/main/java/org/jabref/logic/importer/fetcher/DBLPFetcher.java +++ b/src/main/java/org/jabref/logic/importer/fetcher/DBLPFetcher.java @@ -68,7 +68,7 @@ public void doPostCleanup(BibEntry entry) { FieldFormatterCleanups cleanups = new FieldFormatterCleanups(true, List.of( new FieldFormatterCleanup(StandardField.TIMESTAMP, new ClearFormatter()), - // unescape the the contents of the URL field, e.g., some\_url\_part becomes some_url_part + // unescape the contents of the URL field, e.g., some\_url\_part becomes some_url_part new FieldFormatterCleanup(StandardField.URL, new LayoutFormatterBasedFormatter(new RemoveLatexCommandsFormatter())) )); cleanups.applySaveActions(entry); diff --git a/src/main/java/org/jabref/migrations/PreferencesMigrations.java b/src/main/java/org/jabref/migrations/PreferencesMigrations.java index e9a673f4b3b..e9f30abc050 100644 --- a/src/main/java/org/jabref/migrations/PreferencesMigrations.java +++ b/src/main/java/org/jabref/migrations/PreferencesMigrations.java @@ -16,6 +16,8 @@ import javafx.scene.control.TableColumn; +import org.jabref.gui.entryeditor.CommentsTab; +import org.jabref.gui.entryeditor.EntryEditor; import org.jabref.gui.maintable.ColumnPreferences; import org.jabref.gui.maintable.MainTableColumnModel; import org.jabref.logic.citationkeypattern.GlobalCitationKeyPattern; @@ -57,13 +59,14 @@ public static void runMigrations(JabRefPreferences preferences, BibEntryTypesMan addCrossRefRelatedFieldsForAutoComplete(preferences); upgradePreviewStyle(preferences); // changeColumnVariableNamesFor51 needs to be run before upgradeColumnPre50Preferences to ensure - // backwardcompatibility, as it copies the old values to new variable names and keeps th old sored with the old + // backward compatibility, as it copies the old values to new variable names and keeps th old sored with the old // variable names. However, the variables from 5.0 need to be copied to the new variable name too. changeColumnVariableNamesFor51(preferences); upgradeColumnPreferences(preferences); restoreVariablesForBackwardCompatibility(preferences); upgradeCleanups(preferences); moveApiKeysToKeyring(preferences); + removeCommentsFromCustomEditorTabs(preferences); } /** @@ -545,4 +548,12 @@ static void moveApiKeysToKeyring(JabRefPreferences preferences) { } } } + + /** + * The tab "Comments" is hard coded using {@link CommentsTab} since v5.10 (and thus hard-wired in {@link EntryEditor#createTabs()}. + * Thus, the configuration ih the preferences is obsolete + */ + static void removeCommentsFromCustomEditorTabs(JabRefPreferences preferences) { + preferences.getEntryEditorPreferences().getEntryEditorTabs().remove("Comments"); + } } diff --git a/src/main/java/org/jabref/model/entry/BibEntry.java b/src/main/java/org/jabref/model/entry/BibEntry.java index a8c940fb3bb..56fc9302796 100644 --- a/src/main/java/org/jabref/model/entry/BibEntry.java +++ b/src/main/java/org/jabref/model/entry/BibEntry.java @@ -572,7 +572,7 @@ public Optional getFieldOrAlias(Field field) { } /** - * Return the LaTeX-free contents of the given field or its alias an an Optional + * Return the LaTeX-free contents of the given field or its alias an Optional *

* For details see also {@link #getFieldOrAlias(Field)} * diff --git a/src/main/java/org/jabref/model/entry/field/OrFields.java b/src/main/java/org/jabref/model/entry/field/OrFields.java index b515a5aeb96..a8de739eb7d 100644 --- a/src/main/java/org/jabref/model/entry/field/OrFields.java +++ b/src/main/java/org/jabref/model/entry/field/OrFields.java @@ -16,7 +16,7 @@ *
* The class OrFields is used to model "year/date" in this case. *

- * Example is that a BibEntry requires either an author or an editor, but both can be be present. + * Example is that a BibEntry requires either an author or an editor, but both can be present. */ public class OrFields implements Comparable { diff --git a/src/main/java/org/jabref/preferences/JabRefPreferences.java b/src/main/java/org/jabref/preferences/JabRefPreferences.java index d4a9e64016c..1da58ce0989 100644 --- a/src/main/java/org/jabref/preferences/JabRefPreferences.java +++ b/src/main/java/org/jabref/preferences/JabRefPreferences.java @@ -22,6 +22,7 @@ import java.util.Map; import java.util.Objects; import java.util.Optional; +import java.util.SequencedMap; import java.util.Set; import java.util.TreeSet; import java.util.UUID; @@ -835,10 +836,6 @@ public void setLanguageDependentDefaultValues() { defaults.put(CUSTOM_TAB_FIELDS + "_def1", StandardField.ABSTRACT.getName()); defaults.put(CUSTOM_TAB_NAME + "_def1", Localization.lang("Abstract")); - // Entry editor tab 2: Comments Field - used for research comments, etc. - defaults.put(CUSTOM_TAB_FIELDS + "_def2", StandardField.COMMENT.getName()); - defaults.put(CUSTOM_TAB_NAME + "_def2", Localization.lang("Comments")); - defaults.put(EMAIL_SUBJECT, Localization.lang("References")); } @@ -1508,7 +1505,7 @@ private Map> getEntryEditorTabs() { List tabFields = getSeries(CUSTOM_TAB_FIELDS); if (tabNames.isEmpty() || (tabNames.size() != tabFields.size())) { - // Nothing set, so we use the default values + // Nothing set (or wrong configuration), then we use default values tabNames = getSeries(CUSTOM_TAB_NAME + "_def"); tabFields = getSeries(CUSTOM_TAB_FIELDS + "_def"); } @@ -1543,8 +1540,8 @@ private void storeEntryEditorTabs(Map> customTabs) { getEntryEditorTabs(); } - private Map> getDefaultEntryEditorTabs() { - Map> customTabsMap = new LinkedHashMap<>(); + private SequencedMap> getDefaultEntryEditorTabs() { + SequencedMap> customTabsMap = new LinkedHashMap<>(); int defNumber = 0; while (true) { diff --git a/src/main/resources/l10n/JabRef_en.properties b/src/main/resources/l10n/JabRef_en.properties index 9b6b0a31c45..e6c1342058c 100644 --- a/src/main/resources/l10n/JabRef_en.properties +++ b/src/main/resources/l10n/JabRef_en.properties @@ -77,8 +77,6 @@ Application\ to\ push\ entries\ to=Application to push entries to Apply=Apply -Arguments\ passed\ on\ to\ running\ JabRef\ instance.\ Shutting\ down.=Arguments passed on to running JabRef instance. Shutting down. - Assign\ the\ original\ group's\ entries\ to\ this\ group?=Assign the original group's entries to this group? Assigned\ %0\ entries\ to\ group\ "%1".=Assigned %0 entries to group "%1".