From 67d35cbc4d6c7a93f9392d95eea37cd0e84d785d Mon Sep 17 00:00:00 2001 From: motokito Date: Sat, 24 Sep 2016 13:14:38 +0200 Subject: [PATCH 01/12] Fixing: Sensible default settings for "Enable save actions" and "Cleanup" --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index df10b7b3c15..07449726481 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -104,6 +104,8 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `# - Fixed [#2104](https://github.com/JabRef/jabref/issues/#2104): Crash after saving BibTeX source with parsing error - Fixed [#2109](https://github.com/JabRef/jabref/issues/#2109): Ctrl-s doesn't trigger parsing error message - Fixed RTFChars would only use "?" for characters with unicode over the value of 127, now it uses the base character (é -> e instead of ?) +- Fixed [#1996](https://github.com/JabRef/jabref/issues/1996): Unnecessary other fields tab in entry editor removed (BibTeX mode) +- Fixed [#128](https://github.com/koppor/jabref/issues/128): Sensible default settings for "Enable save actions" and "Cleanup" ### Removed - Removed 2nd preview style From e3c0031119c696294cb61f1f58f239d1149d7607 Mon Sep 17 00:00:00 2001 From: motokito Date: Wed, 28 Sep 2016 16:29:38 +0200 Subject: [PATCH 02/12] Sensible default settings for "Enable save actions" in database properties and "Cleanup entries" in menu are now identical --- .../exporter/FieldFormatterCleanups.java | 245 ++++++++++++++++++ 1 file changed, 245 insertions(+) create mode 100644 src/main/java/net/sf/jabref/logic/exporter/FieldFormatterCleanups.java diff --git a/src/main/java/net/sf/jabref/logic/exporter/FieldFormatterCleanups.java b/src/main/java/net/sf/jabref/logic/exporter/FieldFormatterCleanups.java new file mode 100644 index 00000000000..2fcdb503255 --- /dev/null +++ b/src/main/java/net/sf/jabref/logic/exporter/FieldFormatterCleanups.java @@ -0,0 +1,245 @@ +package net.sf.jabref.logic.exporter; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import java.util.StringJoiner; + +import net.sf.jabref.logic.cleanup.FieldFormatterCleanup; +import net.sf.jabref.logic.formatter.Formatter; +import net.sf.jabref.logic.formatter.Formatters; +import net.sf.jabref.logic.formatter.IdentityFormatter; +import net.sf.jabref.logic.formatter.bibtexfields.HtmlToLatexFormatter; +import net.sf.jabref.logic.formatter.bibtexfields.LatexCleanupFormatter; +import net.sf.jabref.logic.formatter.bibtexfields.NormalizeDateFormatter; +import net.sf.jabref.logic.formatter.bibtexfields.NormalizeMonthFormatter; +import net.sf.jabref.logic.formatter.bibtexfields.NormalizePagesFormatter; +import net.sf.jabref.logic.formatter.bibtexfields.UnitsToLatexFormatter; +import net.sf.jabref.logic.formatter.casechanger.ProtectTermsFormatter; +import net.sf.jabref.logic.util.OS; +import net.sf.jabref.model.FieldChange; +import net.sf.jabref.model.entry.BibEntry; +import net.sf.jabref.model.entry.FieldName; +import net.sf.jabref.model.metadata.MetaData; +import net.sf.jabref.model.strings.StringUtil; + +public class FieldFormatterCleanups { + + public static final String ENABLED = "enabled"; + public static final String DISABLED = "disabled"; + + private final List actions; + + private static List availableFormatters; + + private final boolean enabled; + + public static final FieldFormatterCleanups DEFAULT_SAVE_ACTIONS; + + static { + availableFormatters = new ArrayList<>(); + availableFormatters.addAll(Formatters.ALL); + + List defaultFormatters = new ArrayList<>(); + defaultFormatters.add(new FieldFormatterCleanup(FieldName.PAGES, new NormalizePagesFormatter())); + defaultFormatters.add(new FieldFormatterCleanup(FieldName.DATE, new NormalizeDateFormatter())); + defaultFormatters.add(new FieldFormatterCleanup(FieldName.MONTH, new NormalizeMonthFormatter())); + defaultFormatters.add(new FieldFormatterCleanup(FieldName.TITLE, new ProtectTermsFormatter())); + defaultFormatters.add(new FieldFormatterCleanup(FieldName.TITLE, new UnitsToLatexFormatter())); + defaultFormatters.add(new FieldFormatterCleanup(FieldName.TITLE, new LatexCleanupFormatter())); + defaultFormatters.add(new FieldFormatterCleanup(FieldName.TITLE, new HtmlToLatexFormatter())); + DEFAULT_SAVE_ACTIONS = new FieldFormatterCleanups(false, defaultFormatters); + } + + public FieldFormatterCleanups(boolean enabled, String formatterString) { + this(enabled, parse(formatterString)); + } + + public FieldFormatterCleanups(boolean enabled, List actions) { + this.enabled = enabled; + this.actions = Objects.requireNonNull(actions); + } + + public boolean isEnabled() { + return enabled; + } + + public List getConfiguredActions() { + return Collections.unmodifiableList(actions); + } + + public List getAvailableFormatters() { + return Collections.unmodifiableList(availableFormatters); + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if ((o == null) || (getClass() != o.getClass())) { + return false; + } + + FieldFormatterCleanups that = (FieldFormatterCleanups) o; + + if (enabled != that.enabled) { + return false; + } + return actions.equals(that.actions); + + } + + @Override + public int hashCode() { + return Objects.hash(actions, enabled); + } + + public static List parse(String formatterString) { + + if ((formatterString == null) || formatterString.isEmpty()) { + // no save actions defined in the meta data + return new ArrayList<>(); + } + + List actions = new ArrayList<>(); + + //read concrete actions + int startIndex = 0; + + // first remove all newlines for easier parsing + String remainingString = formatterString; + + remainingString = StringUtil.unifyLineBreaks(remainingString, ""); + try { + while (startIndex < formatterString.length()) { + // read the field name + int currentIndex = remainingString.indexOf('['); + String fieldKey = remainingString.substring(0, currentIndex); + int endIndex = remainingString.indexOf(']'); + startIndex += endIndex + 1; + + //read each formatter + int tokenIndex = remainingString.indexOf(','); + do { + boolean doBreak = false; + if ((tokenIndex == -1) || (tokenIndex > endIndex)) { + tokenIndex = remainingString.indexOf(']'); + doBreak = true; + } + + String formatterKey = remainingString.substring(currentIndex + 1, tokenIndex); + actions.add(new FieldFormatterCleanup(fieldKey, getFormatterFromString(formatterKey))); + + remainingString = remainingString.substring(tokenIndex + 1); + if (remainingString.startsWith("]") || doBreak) { + break; + } + tokenIndex = remainingString.indexOf(','); + + currentIndex = -1; + } while (true); + + + } + } catch (StringIndexOutOfBoundsException ignore) { + // if this exception occurs, the remaining part of the save actions string is invalid. + // Thus we stop parsing and take what we have parsed until now + return actions; + } + return actions; + } + + public List applySaveActions(BibEntry entry) { + if (enabled) { + return applyAllActions(entry); + } else { + return new ArrayList<>(); + } + } + + private List applyAllActions(BibEntry entry) { + List result = new ArrayList<>(); + + for (FieldFormatterCleanup action : actions) { + result.addAll(action.cleanup(entry)); + } + + return result; + } + + private static Formatter getFormatterFromString(String formatterName) { + for (Formatter formatter : availableFormatters) { + if (formatterName.equals(formatter.getKey())) { + return formatter; + } + } + return new IdentityFormatter(); + } + + private static String getMetaDataString(List actionList) { + //first, group all formatters by the field for which they apply + Map> groupedByField = new HashMap<>(); + for (FieldFormatterCleanup cleanup : actionList) { + String key = cleanup.getField(); + + // add new list into the hashmap if needed + if (!groupedByField.containsKey(key)) { + groupedByField.put(key, new ArrayList<>()); + } + + //add the formatter to the map if it is not already there + List formattersForKey = groupedByField.get(key); + if (!formattersForKey.contains(cleanup.getFormatter().getKey())) { + formattersForKey.add(cleanup.getFormatter().getKey()); + } + } + + // convert the contents of the hashmap into the correct serialization + StringBuilder result = new StringBuilder(); + for (Map.Entry> entry : groupedByField.entrySet()) { + result.append(entry.getKey()); + + StringJoiner joiner = new StringJoiner(",", "[", "]" + OS.NEWLINE); + entry.getValue().forEach(joiner::add); + result.append(joiner.toString()); + } + + return result.toString(); + } + + public List getAsStringList() { + List stringRepresentation = new ArrayList<>(); + + if (enabled) { + stringRepresentation.add(ENABLED); + } else { + stringRepresentation.add(DISABLED); + } + + String formatterString = FieldFormatterCleanups.getMetaDataString(actions); + stringRepresentation.add(formatterString); + return stringRepresentation; + } + + public static FieldFormatterCleanups parse(List formatterMetaList) { + + if ((formatterMetaList != null) && (formatterMetaList.size() >= 2)) { + boolean enablementStatus = ENABLED.equals(formatterMetaList.get(0)); + String formatterString = formatterMetaList.get(1); + return new FieldFormatterCleanups(enablementStatus, formatterString); + } else { + // return default actions + return FieldFormatterCleanups.DEFAULT_SAVE_ACTIONS; + } + + } + + public static Optional fromMetaData(MetaData metadata) { + return metadata.getSaveActions().map(FieldFormatterCleanups::parse); + } +} From 0a3d8238eeca593afdf5c52562556381d8692f4a Mon Sep 17 00:00:00 2001 From: motokito Date: Thu, 6 Oct 2016 20:21:36 +0200 Subject: [PATCH 03/12] Insert allTextField fieldName and refactoring the reset entries of database properties --- .../gui/cleanup/CleanupPresetPanel.java | 3 +- .../cleanup/FieldFormatterCleanupsPanel.java | 5 +- .../net/sf/jabref/logic/cleanup/Cleanups.java | 13 +- .../exporter/FieldFormatterCleanups.java | 245 ------------------ .../model/cleanup/FieldFormatterCleanup.java | 18 +- .../net/sf/jabref/model/entry/FieldName.java | 3 + .../jabref/preferences/JabRefPreferences.java | 40 +-- 7 files changed, 47 insertions(+), 280 deletions(-) delete mode 100644 src/main/java/net/sf/jabref/logic/exporter/FieldFormatterCleanups.java diff --git a/src/main/java/net/sf/jabref/gui/cleanup/CleanupPresetPanel.java b/src/main/java/net/sf/jabref/gui/cleanup/CleanupPresetPanel.java index f69e46ec8e7..b53fa6e0c67 100644 --- a/src/main/java/net/sf/jabref/gui/cleanup/CleanupPresetPanel.java +++ b/src/main/java/net/sf/jabref/gui/cleanup/CleanupPresetPanel.java @@ -10,6 +10,7 @@ import net.sf.jabref.Globals; import net.sf.jabref.logic.cleanup.CleanupPreset; +import net.sf.jabref.logic.cleanup.Cleanups; import net.sf.jabref.logic.l10n.Localization; import net.sf.jabref.model.database.BibDatabaseContext; import net.sf.jabref.model.entry.FieldName; @@ -68,7 +69,7 @@ private void init() { "Convert to BibLatex format (for example, move the value of the 'journal' field to 'journaltitle')")); cleanUpFormatters = new FieldFormatterCleanupsPanel(Localization.lang("Run field formatter:"), - JabRefPreferences.CLEANUP_DEFAULT_PRESET.getFormatterCleanups()); + Cleanups.DEFAULT_SAVE_ACTIONS); updateDisplay(cleanupPreset); diff --git a/src/main/java/net/sf/jabref/gui/cleanup/FieldFormatterCleanupsPanel.java b/src/main/java/net/sf/jabref/gui/cleanup/FieldFormatterCleanupsPanel.java index f11ba16da25..64d8ff15597 100644 --- a/src/main/java/net/sf/jabref/gui/cleanup/FieldFormatterCleanupsPanel.java +++ b/src/main/java/net/sf/jabref/gui/cleanup/FieldFormatterCleanupsPanel.java @@ -7,6 +7,7 @@ import java.awt.event.MouseEvent; import java.awt.event.MouseMotionAdapter; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.Objects; @@ -31,6 +32,7 @@ import net.sf.jabref.model.cleanup.FieldFormatterCleanups; import net.sf.jabref.model.cleanup.Formatter; import net.sf.jabref.model.entry.BibEntry; +import net.sf.jabref.model.entry.FieldName; import net.sf.jabref.model.entry.InternalBibtexFields; import net.sf.jabref.model.metadata.MetaData; @@ -193,8 +195,7 @@ private JPanel getSelectorPanel() { "pref, 2dlu, pref:grow, 2dlu")); List fieldNames = InternalBibtexFields.getAllPublicFieldNames(); - fieldNames.add(BibEntry.KEY_FIELD); - fieldNames.add("all"); + fieldNames.addAll(Arrays.asList(BibEntry.KEY_FIELD, FieldName.ABSTRACT_ALL_FIELD, FieldName.ABSTRACT_ALL_TEXT_FIELDS_FIELD)); Collections.sort(fieldNames); String[] allPlusKey = fieldNames.toArray(new String[fieldNames.size()]); diff --git a/src/main/java/net/sf/jabref/logic/cleanup/Cleanups.java b/src/main/java/net/sf/jabref/logic/cleanup/Cleanups.java index 321e345c1ef..b5257f3123f 100644 --- a/src/main/java/net/sf/jabref/logic/cleanup/Cleanups.java +++ b/src/main/java/net/sf/jabref/logic/cleanup/Cleanups.java @@ -6,9 +6,14 @@ import net.sf.jabref.logic.formatter.Formatters; import net.sf.jabref.logic.formatter.IdentityFormatter; +import net.sf.jabref.logic.formatter.bibtexfields.HtmlToLatexFormatter; +import net.sf.jabref.logic.formatter.bibtexfields.LatexCleanupFormatter; +import net.sf.jabref.logic.formatter.bibtexfields.NormalizeDateFormatter; import net.sf.jabref.logic.formatter.bibtexfields.NormalizeMonthFormatter; import net.sf.jabref.logic.formatter.bibtexfields.NormalizePagesFormatter; import net.sf.jabref.logic.formatter.bibtexfields.OrdinalsToSuperscriptFormatter; +import net.sf.jabref.logic.formatter.bibtexfields.UnitsToLatexFormatter; +import net.sf.jabref.logic.formatter.casechanger.ProtectTermsFormatter; import net.sf.jabref.model.cleanup.FieldFormatterCleanup; import net.sf.jabref.model.cleanup.FieldFormatterCleanups; import net.sf.jabref.model.cleanup.Formatter; @@ -20,14 +25,20 @@ public class Cleanups { public static final FieldFormatterCleanups DEFAULT_SAVE_ACTIONS; public static List availableFormatters; + static { availableFormatters = new ArrayList<>(); availableFormatters.addAll(Formatters.ALL); List defaultFormatters = new ArrayList<>(); defaultFormatters.add(new FieldFormatterCleanup(FieldName.PAGES, new NormalizePagesFormatter())); + defaultFormatters.add(new FieldFormatterCleanup(FieldName.DATE, new NormalizeDateFormatter())); defaultFormatters.add(new FieldFormatterCleanup(FieldName.MONTH, new NormalizeMonthFormatter())); - defaultFormatters.add(new FieldFormatterCleanup(FieldName.BOOKTITLE, new OrdinalsToSuperscriptFormatter())); + defaultFormatters.add(new FieldFormatterCleanup(FieldName.TITLE, new ProtectTermsFormatter())); + defaultFormatters.add(new FieldFormatterCleanup(FieldName.TITLE, new UnitsToLatexFormatter())); + defaultFormatters.add(new FieldFormatterCleanup(FieldName.TITLE, new LatexCleanupFormatter())); + defaultFormatters.add(new FieldFormatterCleanup(FieldName.TITLE, new HtmlToLatexFormatter())); + defaultFormatters.add(new FieldFormatterCleanup(FieldName.ABSTRACT_ALL_TEXT_FIELDS_FIELD, new OrdinalsToSuperscriptFormatter())); DEFAULT_SAVE_ACTIONS = new FieldFormatterCleanups(false, defaultFormatters); } diff --git a/src/main/java/net/sf/jabref/logic/exporter/FieldFormatterCleanups.java b/src/main/java/net/sf/jabref/logic/exporter/FieldFormatterCleanups.java deleted file mode 100644 index 2fcdb503255..00000000000 --- a/src/main/java/net/sf/jabref/logic/exporter/FieldFormatterCleanups.java +++ /dev/null @@ -1,245 +0,0 @@ -package net.sf.jabref.logic.exporter; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; -import java.util.StringJoiner; - -import net.sf.jabref.logic.cleanup.FieldFormatterCleanup; -import net.sf.jabref.logic.formatter.Formatter; -import net.sf.jabref.logic.formatter.Formatters; -import net.sf.jabref.logic.formatter.IdentityFormatter; -import net.sf.jabref.logic.formatter.bibtexfields.HtmlToLatexFormatter; -import net.sf.jabref.logic.formatter.bibtexfields.LatexCleanupFormatter; -import net.sf.jabref.logic.formatter.bibtexfields.NormalizeDateFormatter; -import net.sf.jabref.logic.formatter.bibtexfields.NormalizeMonthFormatter; -import net.sf.jabref.logic.formatter.bibtexfields.NormalizePagesFormatter; -import net.sf.jabref.logic.formatter.bibtexfields.UnitsToLatexFormatter; -import net.sf.jabref.logic.formatter.casechanger.ProtectTermsFormatter; -import net.sf.jabref.logic.util.OS; -import net.sf.jabref.model.FieldChange; -import net.sf.jabref.model.entry.BibEntry; -import net.sf.jabref.model.entry.FieldName; -import net.sf.jabref.model.metadata.MetaData; -import net.sf.jabref.model.strings.StringUtil; - -public class FieldFormatterCleanups { - - public static final String ENABLED = "enabled"; - public static final String DISABLED = "disabled"; - - private final List actions; - - private static List availableFormatters; - - private final boolean enabled; - - public static final FieldFormatterCleanups DEFAULT_SAVE_ACTIONS; - - static { - availableFormatters = new ArrayList<>(); - availableFormatters.addAll(Formatters.ALL); - - List defaultFormatters = new ArrayList<>(); - defaultFormatters.add(new FieldFormatterCleanup(FieldName.PAGES, new NormalizePagesFormatter())); - defaultFormatters.add(new FieldFormatterCleanup(FieldName.DATE, new NormalizeDateFormatter())); - defaultFormatters.add(new FieldFormatterCleanup(FieldName.MONTH, new NormalizeMonthFormatter())); - defaultFormatters.add(new FieldFormatterCleanup(FieldName.TITLE, new ProtectTermsFormatter())); - defaultFormatters.add(new FieldFormatterCleanup(FieldName.TITLE, new UnitsToLatexFormatter())); - defaultFormatters.add(new FieldFormatterCleanup(FieldName.TITLE, new LatexCleanupFormatter())); - defaultFormatters.add(new FieldFormatterCleanup(FieldName.TITLE, new HtmlToLatexFormatter())); - DEFAULT_SAVE_ACTIONS = new FieldFormatterCleanups(false, defaultFormatters); - } - - public FieldFormatterCleanups(boolean enabled, String formatterString) { - this(enabled, parse(formatterString)); - } - - public FieldFormatterCleanups(boolean enabled, List actions) { - this.enabled = enabled; - this.actions = Objects.requireNonNull(actions); - } - - public boolean isEnabled() { - return enabled; - } - - public List getConfiguredActions() { - return Collections.unmodifiableList(actions); - } - - public List getAvailableFormatters() { - return Collections.unmodifiableList(availableFormatters); - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if ((o == null) || (getClass() != o.getClass())) { - return false; - } - - FieldFormatterCleanups that = (FieldFormatterCleanups) o; - - if (enabled != that.enabled) { - return false; - } - return actions.equals(that.actions); - - } - - @Override - public int hashCode() { - return Objects.hash(actions, enabled); - } - - public static List parse(String formatterString) { - - if ((formatterString == null) || formatterString.isEmpty()) { - // no save actions defined in the meta data - return new ArrayList<>(); - } - - List actions = new ArrayList<>(); - - //read concrete actions - int startIndex = 0; - - // first remove all newlines for easier parsing - String remainingString = formatterString; - - remainingString = StringUtil.unifyLineBreaks(remainingString, ""); - try { - while (startIndex < formatterString.length()) { - // read the field name - int currentIndex = remainingString.indexOf('['); - String fieldKey = remainingString.substring(0, currentIndex); - int endIndex = remainingString.indexOf(']'); - startIndex += endIndex + 1; - - //read each formatter - int tokenIndex = remainingString.indexOf(','); - do { - boolean doBreak = false; - if ((tokenIndex == -1) || (tokenIndex > endIndex)) { - tokenIndex = remainingString.indexOf(']'); - doBreak = true; - } - - String formatterKey = remainingString.substring(currentIndex + 1, tokenIndex); - actions.add(new FieldFormatterCleanup(fieldKey, getFormatterFromString(formatterKey))); - - remainingString = remainingString.substring(tokenIndex + 1); - if (remainingString.startsWith("]") || doBreak) { - break; - } - tokenIndex = remainingString.indexOf(','); - - currentIndex = -1; - } while (true); - - - } - } catch (StringIndexOutOfBoundsException ignore) { - // if this exception occurs, the remaining part of the save actions string is invalid. - // Thus we stop parsing and take what we have parsed until now - return actions; - } - return actions; - } - - public List applySaveActions(BibEntry entry) { - if (enabled) { - return applyAllActions(entry); - } else { - return new ArrayList<>(); - } - } - - private List applyAllActions(BibEntry entry) { - List result = new ArrayList<>(); - - for (FieldFormatterCleanup action : actions) { - result.addAll(action.cleanup(entry)); - } - - return result; - } - - private static Formatter getFormatterFromString(String formatterName) { - for (Formatter formatter : availableFormatters) { - if (formatterName.equals(formatter.getKey())) { - return formatter; - } - } - return new IdentityFormatter(); - } - - private static String getMetaDataString(List actionList) { - //first, group all formatters by the field for which they apply - Map> groupedByField = new HashMap<>(); - for (FieldFormatterCleanup cleanup : actionList) { - String key = cleanup.getField(); - - // add new list into the hashmap if needed - if (!groupedByField.containsKey(key)) { - groupedByField.put(key, new ArrayList<>()); - } - - //add the formatter to the map if it is not already there - List formattersForKey = groupedByField.get(key); - if (!formattersForKey.contains(cleanup.getFormatter().getKey())) { - formattersForKey.add(cleanup.getFormatter().getKey()); - } - } - - // convert the contents of the hashmap into the correct serialization - StringBuilder result = new StringBuilder(); - for (Map.Entry> entry : groupedByField.entrySet()) { - result.append(entry.getKey()); - - StringJoiner joiner = new StringJoiner(",", "[", "]" + OS.NEWLINE); - entry.getValue().forEach(joiner::add); - result.append(joiner.toString()); - } - - return result.toString(); - } - - public List getAsStringList() { - List stringRepresentation = new ArrayList<>(); - - if (enabled) { - stringRepresentation.add(ENABLED); - } else { - stringRepresentation.add(DISABLED); - } - - String formatterString = FieldFormatterCleanups.getMetaDataString(actions); - stringRepresentation.add(formatterString); - return stringRepresentation; - } - - public static FieldFormatterCleanups parse(List formatterMetaList) { - - if ((formatterMetaList != null) && (formatterMetaList.size() >= 2)) { - boolean enablementStatus = ENABLED.equals(formatterMetaList.get(0)); - String formatterString = formatterMetaList.get(1); - return new FieldFormatterCleanups(enablementStatus, formatterString); - } else { - // return default actions - return FieldFormatterCleanups.DEFAULT_SAVE_ACTIONS; - } - - } - - public static Optional fromMetaData(MetaData metadata) { - return metadata.getSaveActions().map(FieldFormatterCleanups::parse); - } -} diff --git a/src/main/java/net/sf/jabref/model/cleanup/FieldFormatterCleanup.java b/src/main/java/net/sf/jabref/model/cleanup/FieldFormatterCleanup.java index 07fd0453946..313814c1884 100644 --- a/src/main/java/net/sf/jabref/model/cleanup/FieldFormatterCleanup.java +++ b/src/main/java/net/sf/jabref/model/cleanup/FieldFormatterCleanup.java @@ -1,12 +1,15 @@ package net.sf.jabref.model.cleanup; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.Objects; +import java.util.Set; import net.sf.jabref.model.FieldChange; import net.sf.jabref.model.entry.BibEntry; +import net.sf.jabref.model.entry.FieldName; import net.sf.jabref.model.entry.event.EntryEventSource; /** @@ -24,8 +27,10 @@ public FieldFormatterCleanup(String field, Formatter formatter) { @Override public List cleanup(BibEntry entry) { - if ("all".equalsIgnoreCase(field)) { + if (FieldName.ABSTRACT_ALL_FIELD.equalsIgnoreCase(field)) { return cleanupAllFields(entry); + } else if (FieldName.ABSTRACT_ALL_TEXT_FIELDS_FIELD.equalsIgnoreCase(field)) { + return cleanupAllTextFields(entry); } else { return cleanupSingleField(field, entry); } @@ -73,6 +78,17 @@ private List cleanupAllFields(BibEntry entry) { return fieldChanges; } + private List cleanupAllTextFields(BibEntry entry) { + List fieldChanges = new ArrayList<>(); + Set fields = entry.getFieldNames(); + fields.removeAll(Arrays.asList(FieldName.DOI, FieldName.FILE, FieldName.URL, FieldName.URI)); + for (String fieldKey : fields) { + fieldChanges.addAll(cleanupSingleField(fieldKey, entry)); + } + + return fieldChanges; + } + public String getField() { return field; } diff --git a/src/main/java/net/sf/jabref/model/entry/FieldName.java b/src/main/java/net/sf/jabref/model/entry/FieldName.java index 5bf96d79640..9f21aecfbb8 100644 --- a/src/main/java/net/sf/jabref/model/entry/FieldName.java +++ b/src/main/java/net/sf/jabref/model/entry/FieldName.java @@ -17,6 +17,9 @@ public class FieldName { // author is not set): public static final String FIELD_SEPARATOR = "/"; + public static final String ABSTRACT_ALL_FIELD = "all"; + public static final String ABSTRACT_ALL_TEXT_FIELDS_FIELD = "all_text_fields"; + // Field name constants public static final String ABSTRACT = "abstract"; public static final String ADDENDUM = "addendum"; diff --git a/src/main/java/net/sf/jabref/preferences/JabRefPreferences.java b/src/main/java/net/sf/jabref/preferences/JabRefPreferences.java index 62340c72a46..fdccecd4c02 100644 --- a/src/main/java/net/sf/jabref/preferences/JabRefPreferences.java +++ b/src/main/java/net/sf/jabref/preferences/JabRefPreferences.java @@ -45,17 +45,10 @@ import net.sf.jabref.logic.citationstyle.CitationStyle; import net.sf.jabref.logic.cleanup.CleanupPreferences; import net.sf.jabref.logic.cleanup.CleanupPreset; +import net.sf.jabref.logic.cleanup.Cleanups; import net.sf.jabref.logic.exporter.CustomExportList; import net.sf.jabref.logic.exporter.ExportComparator; -import net.sf.jabref.logic.formatter.bibtexfields.HtmlToLatexFormatter; -import net.sf.jabref.logic.formatter.bibtexfields.LatexCleanupFormatter; -import net.sf.jabref.logic.formatter.bibtexfields.NormalizeDateFormatter; -import net.sf.jabref.logic.formatter.bibtexfields.NormalizeMonthFormatter; -import net.sf.jabref.logic.formatter.bibtexfields.NormalizePagesFormatter; -import net.sf.jabref.logic.formatter.bibtexfields.UnitsToLatexFormatter; -import net.sf.jabref.logic.formatter.casechanger.ProtectTermsFormatter; import net.sf.jabref.logic.importer.ImportFormatPreferences; -import net.sf.jabref.logic.importer.Importer; import net.sf.jabref.logic.journals.JournalAbbreviationLoader; import net.sf.jabref.logic.journals.JournalAbbreviationPreferences; import net.sf.jabref.logic.l10n.Localization; @@ -76,8 +69,6 @@ import net.sf.jabref.logic.xmp.XMPPreferences; import net.sf.jabref.model.bibtexkeypattern.AbstractBibtexKeyPattern; import net.sf.jabref.model.bibtexkeypattern.GlobalBibtexKeyPattern; -import net.sf.jabref.model.cleanup.FieldFormatterCleanup; -import net.sf.jabref.model.cleanup.FieldFormatterCleanups; import net.sf.jabref.model.database.BibDatabaseMode; import net.sf.jabref.model.entry.BibEntry; import net.sf.jabref.model.entry.CustomEntryType; @@ -346,24 +337,6 @@ public class JabRefPreferences { public static final String CLEANUP_CONVERT_TO_BIBLATEX = "CleanUpConvertToBiblatex"; public static final String CLEANUP_FIX_FILE_LINKS = "CleanUpFixFileLinks"; public static final String CLEANUP_FORMATTERS = "CleanUpFormatters"; - public static final CleanupPreset CLEANUP_DEFAULT_PRESET; - static { - EnumSet deactivedJobs = EnumSet.of( - CleanupPreset.CleanupStep.CLEAN_UP_UPGRADE_EXTERNAL_LINKS, - CleanupPreset.CleanupStep.RENAME_PDF_ONLY_RELATIVE_PATHS, - CleanupPreset.CleanupStep.CONVERT_TO_BIBLATEX); - - List activeFormatterCleanups = new ArrayList<>(); - activeFormatterCleanups.add(new FieldFormatterCleanup(FieldName.PAGES, new NormalizePagesFormatter())); - activeFormatterCleanups.add(new FieldFormatterCleanup(FieldName.DATE, new NormalizeDateFormatter())); - activeFormatterCleanups.add(new FieldFormatterCleanup(FieldName.MONTH, new NormalizeMonthFormatter())); - activeFormatterCleanups.add(new FieldFormatterCleanup(FieldName.TITLE, new ProtectTermsFormatter())); - activeFormatterCleanups.add(new FieldFormatterCleanup(FieldName.TITLE, new UnitsToLatexFormatter())); - activeFormatterCleanups.add(new FieldFormatterCleanup(FieldName.TITLE, new LatexCleanupFormatter())); - activeFormatterCleanups.add(new FieldFormatterCleanup(FieldName.TITLE, new HtmlToLatexFormatter())); - FieldFormatterCleanups formatterCleanups = new FieldFormatterCleanups(true, activeFormatterCleanups); - CLEANUP_DEFAULT_PRESET = new CleanupPreset(EnumSet.complementOf(deactivedJobs), formatterCleanups); - } public static final String IMPORT_DEFAULT_PDF_IMPORT_STYLE = "importDefaultPDFimportStyle"; public static final String IMPORT_ALWAYSUSE = "importAlwaysUsePDFImportStyle"; @@ -797,7 +770,7 @@ private JabRefPreferences() { defaults.put(DB_CONNECT_USERNAME, "root"); defaults.put(ASK_AUTO_NAMING_PDFS_AGAIN, Boolean.TRUE); - insertCleanupPreset(defaults, CLEANUP_DEFAULT_PRESET); + insertCleanupPreset(defaults); // defaults for DroppedFileHandler UI defaults.put(DROPPEDFILEHANDLER_LEAVE, Boolean.FALSE); @@ -1352,7 +1325,14 @@ public void setDefaultEncoding(Charset encoding) { put(DEFAULT_ENCODING, encoding.name()); } - private static void insertCleanupPreset(Map storage, CleanupPreset preset) { + private static void insertCleanupPreset(Map storage) { + EnumSet deactivedJobs = EnumSet.of( + CleanupPreset.CleanupStep.CLEAN_UP_UPGRADE_EXTERNAL_LINKS, + CleanupPreset.CleanupStep.RENAME_PDF_ONLY_RELATIVE_PATHS, + CleanupPreset.CleanupStep.CONVERT_TO_BIBLATEX); + + CleanupPreset preset = new CleanupPreset(EnumSet.complementOf(deactivedJobs), Cleanups.DEFAULT_SAVE_ACTIONS); + storage.put(CLEANUP_DOI, preset.isCleanUpDOI()); storage.put(CLEANUP_ISSN, preset.isCleanUpISSN()); storage.put(CLEANUP_MOVE_PDF, preset.isMovePDF()); From e209e5ae38b1e0e928ccdf53636a9d7908b05e7d Mon Sep 17 00:00:00 2001 From: motokito Date: Sun, 9 Oct 2016 11:41:53 +0200 Subject: [PATCH 04/12] CHANGELOG Fixing --- CHANGELOG.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 07449726481..ef0741cc5d3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -104,8 +104,7 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `# - Fixed [#2104](https://github.com/JabRef/jabref/issues/#2104): Crash after saving BibTeX source with parsing error - Fixed [#2109](https://github.com/JabRef/jabref/issues/#2109): Ctrl-s doesn't trigger parsing error message - Fixed RTFChars would only use "?" for characters with unicode over the value of 127, now it uses the base character (é -> e instead of ?) -- Fixed [#1996](https://github.com/JabRef/jabref/issues/1996): Unnecessary other fields tab in entry editor removed (BibTeX mode) -- Fixed [#128](https://github.com/koppor/jabref/issues/128): Sensible default settings for "Enable save actions" and "Cleanup" +- Fixed [koppor/#128](https://github.com/koppor/jabref/issues/128): Sensible default settings for "Enable save actions" and "Cleanup" ### Removed - Removed 2nd preview style From d597ad93e445f614a5d43810b7816a0f5ff0340d Mon Sep 17 00:00:00 2001 From: motokito Date: Wed, 12 Oct 2016 15:46:36 +0200 Subject: [PATCH 05/12] Feedback * rename all_text_fields to all-text-fields * remove ISBN and ISSN, MONTH, DATE, YEAR form all-text-fields --- .../java/net/sf/jabref/model/cleanup/FieldFormatterCleanup.java | 2 +- src/main/java/net/sf/jabref/model/entry/FieldName.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/sf/jabref/model/cleanup/FieldFormatterCleanup.java b/src/main/java/net/sf/jabref/model/cleanup/FieldFormatterCleanup.java index 313814c1884..45a2e3dac24 100644 --- a/src/main/java/net/sf/jabref/model/cleanup/FieldFormatterCleanup.java +++ b/src/main/java/net/sf/jabref/model/cleanup/FieldFormatterCleanup.java @@ -81,7 +81,7 @@ private List cleanupAllFields(BibEntry entry) { private List cleanupAllTextFields(BibEntry entry) { List fieldChanges = new ArrayList<>(); Set fields = entry.getFieldNames(); - fields.removeAll(Arrays.asList(FieldName.DOI, FieldName.FILE, FieldName.URL, FieldName.URI)); + fields.removeAll(Arrays.asList(FieldName.DOI, FieldName.FILE, FieldName.URL, FieldName.URI, FieldName.ISBN, FieldName.ISSN, FieldName.MONTH, FieldName.DATE, FieldName.YEAR)); for (String fieldKey : fields) { fieldChanges.addAll(cleanupSingleField(fieldKey, entry)); } diff --git a/src/main/java/net/sf/jabref/model/entry/FieldName.java b/src/main/java/net/sf/jabref/model/entry/FieldName.java index 9f21aecfbb8..5af10388f72 100644 --- a/src/main/java/net/sf/jabref/model/entry/FieldName.java +++ b/src/main/java/net/sf/jabref/model/entry/FieldName.java @@ -18,7 +18,7 @@ public class FieldName { public static final String FIELD_SEPARATOR = "/"; public static final String ABSTRACT_ALL_FIELD = "all"; - public static final String ABSTRACT_ALL_TEXT_FIELDS_FIELD = "all_text_fields"; + public static final String ABSTRACT_ALL_TEXT_FIELDS_FIELD = "all-text-fields"; // Field name constants public static final String ABSTRACT = "abstract"; From 897fb9ee222464912077b9a47b7c62a1ab67debf Mon Sep 17 00:00:00 2001 From: motokito Date: Wed, 12 Oct 2016 21:17:17 +0200 Subject: [PATCH 06/12] Create Recommend Button for BibTex and BibLatex and refactor reset button incl. defaut setting --- .../cleanup/FieldFormatterCleanupsPanel.java | 22 ++++++++++++++++ .../net/sf/jabref/logic/cleanup/Cleanups.java | 26 ++++++++++++++----- src/main/resources/l10n/JabRef_da.properties | 2 ++ src/main/resources/l10n/JabRef_de.properties | 2 ++ src/main/resources/l10n/JabRef_en.properties | 2 ++ src/main/resources/l10n/JabRef_es.properties | 2 ++ src/main/resources/l10n/JabRef_fa.properties | 2 ++ src/main/resources/l10n/JabRef_fr.properties | 2 ++ src/main/resources/l10n/JabRef_in.properties | 2 ++ src/main/resources/l10n/JabRef_it.properties | 2 ++ src/main/resources/l10n/JabRef_ja.properties | 2 ++ src/main/resources/l10n/JabRef_nl.properties | 2 ++ src/main/resources/l10n/JabRef_no.properties | 2 ++ .../resources/l10n/JabRef_pt_BR.properties | 2 ++ src/main/resources/l10n/JabRef_ru.properties | 2 ++ src/main/resources/l10n/JabRef_sv.properties | 2 ++ src/main/resources/l10n/JabRef_tr.properties | 2 ++ src/main/resources/l10n/JabRef_vi.properties | 7 +++++ src/main/resources/l10n/JabRef_zh.properties | 2 ++ 19 files changed, 80 insertions(+), 7 deletions(-) diff --git a/src/main/java/net/sf/jabref/gui/cleanup/FieldFormatterCleanupsPanel.java b/src/main/java/net/sf/jabref/gui/cleanup/FieldFormatterCleanupsPanel.java index 64d8ff15597..ebb641cde91 100644 --- a/src/main/java/net/sf/jabref/gui/cleanup/FieldFormatterCleanupsPanel.java +++ b/src/main/java/net/sf/jabref/gui/cleanup/FieldFormatterCleanupsPanel.java @@ -26,6 +26,7 @@ import javax.swing.event.ListDataEvent; import javax.swing.event.ListDataListener; +import net.sf.jabref.JabRefGUI; import net.sf.jabref.logic.cleanup.Cleanups; import net.sf.jabref.logic.l10n.Localization; import net.sf.jabref.model.cleanup.FieldFormatterCleanup; @@ -51,6 +52,7 @@ public class FieldFormatterCleanupsPanel extends JPanel { private JTextArea descriptionAreaText; private JButton removeButton; private JButton resetButton; + private JButton recommendButton; private final FieldFormatterCleanups defaultFormatters; @@ -133,12 +135,32 @@ public void contentsChanged(ListDataEvent e) { resetButton = new JButton(Localization.lang("Reset")); resetButton.addActionListener(e -> ((CleanupActionsListModel) actionsList.getModel()).reset(defaultFormatters)); + boolean isBibTex = !JabRefGUI.getMainFrame().getCurrentBasePanel().getDatabaseContext().isBiblatexMode(); + String mode; + + if (isBibTex) { + mode = "BibTex"; + } else { + mode = "BibLaTex"; + } + + recommendButton = new JButton(Localization.lang("Recommend for %0", mode)); + recommendButton.addActionListener(e -> { + + if (isBibTex) { + ((CleanupActionsListModel) actionsList.getModel()).reset(Cleanups.RECOMMEND_BIBTEX_ACTIONS); + } else { + ((CleanupActionsListModel) actionsList.getModel()).reset(Cleanups.RECOMMEND_BIBLATEX_ACTIONS); + } + }); + removeButton = new JButton(Localization.lang("Remove selected")); removeButton.addActionListener( e -> ((CleanupActionsListModel) actionsList.getModel()).removeAtIndex(actionsList.getSelectedIndex())); builder.add(removeButton).xy(7, 11); builder.add(resetButton).xy(3, 11); + builder.add(recommendButton).xy(5, 11); builder.add(getSelectorPanel()).xyw(3, 15, 5); makeDescriptionTextAreaLikeJLabel(); diff --git a/src/main/java/net/sf/jabref/logic/cleanup/Cleanups.java b/src/main/java/net/sf/jabref/logic/cleanup/Cleanups.java index b5257f3123f..d3cad299118 100644 --- a/src/main/java/net/sf/jabref/logic/cleanup/Cleanups.java +++ b/src/main/java/net/sf/jabref/logic/cleanup/Cleanups.java @@ -7,13 +7,13 @@ import net.sf.jabref.logic.formatter.Formatters; import net.sf.jabref.logic.formatter.IdentityFormatter; import net.sf.jabref.logic.formatter.bibtexfields.HtmlToLatexFormatter; -import net.sf.jabref.logic.formatter.bibtexfields.LatexCleanupFormatter; +import net.sf.jabref.logic.formatter.bibtexfields.HtmlToUnicodeFormatter; import net.sf.jabref.logic.formatter.bibtexfields.NormalizeDateFormatter; import net.sf.jabref.logic.formatter.bibtexfields.NormalizeMonthFormatter; import net.sf.jabref.logic.formatter.bibtexfields.NormalizePagesFormatter; import net.sf.jabref.logic.formatter.bibtexfields.OrdinalsToSuperscriptFormatter; -import net.sf.jabref.logic.formatter.bibtexfields.UnitsToLatexFormatter; -import net.sf.jabref.logic.formatter.casechanger.ProtectTermsFormatter; +import net.sf.jabref.logic.formatter.bibtexfields.UnicodeToLatexFormatter; +import net.sf.jabref.logic.layout.format.LatexToUnicodeFormatter; import net.sf.jabref.model.cleanup.FieldFormatterCleanup; import net.sf.jabref.model.cleanup.FieldFormatterCleanups; import net.sf.jabref.model.cleanup.Formatter; @@ -23,6 +23,8 @@ public class Cleanups { public static final FieldFormatterCleanups DEFAULT_SAVE_ACTIONS; + public static final FieldFormatterCleanups RECOMMEND_BIBTEX_ACTIONS; + public static final FieldFormatterCleanups RECOMMEND_BIBLATEX_ACTIONS; public static List availableFormatters; @@ -34,12 +36,22 @@ public class Cleanups { defaultFormatters.add(new FieldFormatterCleanup(FieldName.PAGES, new NormalizePagesFormatter())); defaultFormatters.add(new FieldFormatterCleanup(FieldName.DATE, new NormalizeDateFormatter())); defaultFormatters.add(new FieldFormatterCleanup(FieldName.MONTH, new NormalizeMonthFormatter())); - defaultFormatters.add(new FieldFormatterCleanup(FieldName.TITLE, new ProtectTermsFormatter())); - defaultFormatters.add(new FieldFormatterCleanup(FieldName.TITLE, new UnitsToLatexFormatter())); - defaultFormatters.add(new FieldFormatterCleanup(FieldName.TITLE, new LatexCleanupFormatter())); - defaultFormatters.add(new FieldFormatterCleanup(FieldName.TITLE, new HtmlToLatexFormatter())); defaultFormatters.add(new FieldFormatterCleanup(FieldName.ABSTRACT_ALL_TEXT_FIELDS_FIELD, new OrdinalsToSuperscriptFormatter())); DEFAULT_SAVE_ACTIONS = new FieldFormatterCleanups(false, defaultFormatters); + + List recommendBibTexFormatters = new ArrayList<>(defaultFormatters); + recommendBibTexFormatters.add(new FieldFormatterCleanup(FieldName.TITLE, new HtmlToLatexFormatter())); + recommendBibTexFormatters.add(new FieldFormatterCleanup(FieldName.TITLE, new UnicodeToLatexFormatter())); + recommendBibTexFormatters.add(new FieldFormatterCleanup(FieldName.BOOKTITLE, new UnicodeToLatexFormatter())); + recommendBibTexFormatters.add(new FieldFormatterCleanup(FieldName.JOURNAL, new UnicodeToLatexFormatter())); + recommendBibTexFormatters.add(new FieldFormatterCleanup(FieldName.AUTHOR, new UnicodeToLatexFormatter())); + recommendBibTexFormatters.add(new FieldFormatterCleanup(FieldName.EDITOR, new UnicodeToLatexFormatter())); + RECOMMEND_BIBTEX_ACTIONS = new FieldFormatterCleanups(false, recommendBibTexFormatters); + + List recommendBibLatexFormatters = new ArrayList<>(defaultFormatters); + recommendBibLatexFormatters.add(new FieldFormatterCleanup(FieldName.TITLE, new HtmlToUnicodeFormatter())); + recommendBibLatexFormatters.add(new FieldFormatterCleanup(FieldName.ABSTRACT_ALL_TEXT_FIELDS_FIELD, new LatexToUnicodeFormatter())); + RECOMMEND_BIBLATEX_ACTIONS = new FieldFormatterCleanups(false, recommendBibLatexFormatters); } public static List getAvailableFormatters() { diff --git a/src/main/resources/l10n/JabRef_da.properties b/src/main/resources/l10n/JabRef_da.properties index c891005e64e..4a3129ac216 100644 --- a/src/main/resources/l10n/JabRef_da.properties +++ b/src/main/resources/l10n/JabRef_da.properties @@ -2303,3 +2303,5 @@ A_backup_file_for_'%0'_was_found.=A_backup_file_for_'%0'_was_found. This_could_indicate_that_JabRef_did_not_shut_down_cleanly_last_time_the_file_was_used.=This_could_indicate_that_JabRef_did_not_shut_down_cleanly_last_time_the_file_was_used. Do_you_want_to_recover_the_database_from_the_backup_file?=Do_you_want_to_recover_the_database_from_the_backup_file? Firstname_Lastname= + +Recommend_for_%0= diff --git a/src/main/resources/l10n/JabRef_de.properties b/src/main/resources/l10n/JabRef_de.properties index ccbbd8669dc..e041c75ce56 100644 --- a/src/main/resources/l10n/JabRef_de.properties +++ b/src/main/resources/l10n/JabRef_de.properties @@ -2303,3 +2303,5 @@ A_backup_file_for_'%0'_was_found.=A_backup_file_for_'%0'_was_found. This_could_indicate_that_JabRef_did_not_shut_down_cleanly_last_time_the_file_was_used.=This_could_indicate_that_JabRef_did_not_shut_down_cleanly_last_time_the_file_was_used. Do_you_want_to_recover_the_database_from_the_backup_file?=Do_you_want_to_recover_the_database_from_the_backup_file? Firstname_Lastname= + +Recommend_for_%0= diff --git a/src/main/resources/l10n/JabRef_en.properties b/src/main/resources/l10n/JabRef_en.properties index 8d0808b3ad5..6f8e4968b4a 100644 --- a/src/main/resources/l10n/JabRef_en.properties +++ b/src/main/resources/l10n/JabRef_en.properties @@ -2303,3 +2303,5 @@ A_backup_file_for_'%0'_was_found.=A_backup_file_for_'%0'_was_found. This_could_indicate_that_JabRef_did_not_shut_down_cleanly_last_time_the_file_was_used.=This_could_indicate_that_JabRef_did_not_shut_down_cleanly_last_time_the_file_was_used. Do_you_want_to_recover_the_database_from_the_backup_file?=Do_you_want_to_recover_the_database_from_the_backup_file? Firstname_Lastname=Firstname_Lastname + +Recommend_for_%0=Recommend_for_%0 diff --git a/src/main/resources/l10n/JabRef_es.properties b/src/main/resources/l10n/JabRef_es.properties index 025eb7b447e..594426d4095 100644 --- a/src/main/resources/l10n/JabRef_es.properties +++ b/src/main/resources/l10n/JabRef_es.properties @@ -2303,3 +2303,5 @@ A_backup_file_for_'%0'_was_found.=A_backup_file_for_'%0'_was_found. This_could_indicate_that_JabRef_did_not_shut_down_cleanly_last_time_the_file_was_used.=This_could_indicate_that_JabRef_did_not_shut_down_cleanly_last_time_the_file_was_used. Do_you_want_to_recover_the_database_from_the_backup_file?=Do_you_want_to_recover_the_database_from_the_backup_file? Firstname_Lastname= + +Recommend_for_%0= diff --git a/src/main/resources/l10n/JabRef_fa.properties b/src/main/resources/l10n/JabRef_fa.properties index 00bde169286..cd7a6c7f95b 100644 --- a/src/main/resources/l10n/JabRef_fa.properties +++ b/src/main/resources/l10n/JabRef_fa.properties @@ -2303,3 +2303,5 @@ A_backup_file_for_'%0'_was_found.=A_backup_file_for_'%0'_was_found. This_could_indicate_that_JabRef_did_not_shut_down_cleanly_last_time_the_file_was_used.=This_could_indicate_that_JabRef_did_not_shut_down_cleanly_last_time_the_file_was_used. Do_you_want_to_recover_the_database_from_the_backup_file?=Do_you_want_to_recover_the_database_from_the_backup_file? Firstname_Lastname= + +Recommend_for_%0= diff --git a/src/main/resources/l10n/JabRef_fr.properties b/src/main/resources/l10n/JabRef_fr.properties index 12fb5cd2bc2..49b18ac915b 100644 --- a/src/main/resources/l10n/JabRef_fr.properties +++ b/src/main/resources/l10n/JabRef_fr.properties @@ -2303,3 +2303,5 @@ A_backup_file_for_'%0'_was_found.=A_backup_file_for_'%0'_was_found. This_could_indicate_that_JabRef_did_not_shut_down_cleanly_last_time_the_file_was_used.=This_could_indicate_that_JabRef_did_not_shut_down_cleanly_last_time_the_file_was_used. Do_you_want_to_recover_the_database_from_the_backup_file?=Do_you_want_to_recover_the_database_from_the_backup_file? Firstname_Lastname= + +Recommend_for_%0= diff --git a/src/main/resources/l10n/JabRef_in.properties b/src/main/resources/l10n/JabRef_in.properties index 70ed76bf516..6f5a82aa3eb 100644 --- a/src/main/resources/l10n/JabRef_in.properties +++ b/src/main/resources/l10n/JabRef_in.properties @@ -2303,3 +2303,5 @@ A_backup_file_for_'%0'_was_found.=A_backup_file_for_'%0'_was_found. This_could_indicate_that_JabRef_did_not_shut_down_cleanly_last_time_the_file_was_used.=This_could_indicate_that_JabRef_did_not_shut_down_cleanly_last_time_the_file_was_used. Do_you_want_to_recover_the_database_from_the_backup_file?=Do_you_want_to_recover_the_database_from_the_backup_file? Firstname_Lastname= + +Recommend_for_%0= diff --git a/src/main/resources/l10n/JabRef_it.properties b/src/main/resources/l10n/JabRef_it.properties index 8bf7b132610..7d0140c6f3f 100644 --- a/src/main/resources/l10n/JabRef_it.properties +++ b/src/main/resources/l10n/JabRef_it.properties @@ -2303,3 +2303,5 @@ A_backup_file_for_'%0'_was_found.=A_backup_file_for_'%0'_was_found. This_could_indicate_that_JabRef_did_not_shut_down_cleanly_last_time_the_file_was_used.=This_could_indicate_that_JabRef_did_not_shut_down_cleanly_last_time_the_file_was_used. Do_you_want_to_recover_the_database_from_the_backup_file?=Do_you_want_to_recover_the_database_from_the_backup_file? Firstname_Lastname= + +Recommend_for_%0= diff --git a/src/main/resources/l10n/JabRef_ja.properties b/src/main/resources/l10n/JabRef_ja.properties index bfbf375ce55..470e682de64 100644 --- a/src/main/resources/l10n/JabRef_ja.properties +++ b/src/main/resources/l10n/JabRef_ja.properties @@ -2303,3 +2303,5 @@ A_backup_file_for_'%0'_was_found.=A_backup_file_for_'%0'_was_found. This_could_indicate_that_JabRef_did_not_shut_down_cleanly_last_time_the_file_was_used.=This_could_indicate_that_JabRef_did_not_shut_down_cleanly_last_time_the_file_was_used. Do_you_want_to_recover_the_database_from_the_backup_file?=Do_you_want_to_recover_the_database_from_the_backup_file? Firstname_Lastname= + +Recommend_for_%0= diff --git a/src/main/resources/l10n/JabRef_nl.properties b/src/main/resources/l10n/JabRef_nl.properties index 5b711353ec1..7aff6ed68dc 100644 --- a/src/main/resources/l10n/JabRef_nl.properties +++ b/src/main/resources/l10n/JabRef_nl.properties @@ -2303,3 +2303,5 @@ A_backup_file_for_'%0'_was_found.=A_backup_file_for_'%0'_was_found. This_could_indicate_that_JabRef_did_not_shut_down_cleanly_last_time_the_file_was_used.=This_could_indicate_that_JabRef_did_not_shut_down_cleanly_last_time_the_file_was_used. Do_you_want_to_recover_the_database_from_the_backup_file?=Do_you_want_to_recover_the_database_from_the_backup_file? Firstname_Lastname= + +Recommend_for_%0= diff --git a/src/main/resources/l10n/JabRef_no.properties b/src/main/resources/l10n/JabRef_no.properties index 1ba98015979..8f58c82b79a 100644 --- a/src/main/resources/l10n/JabRef_no.properties +++ b/src/main/resources/l10n/JabRef_no.properties @@ -2303,3 +2303,5 @@ A_backup_file_for_'%0'_was_found.=A_backup_file_for_'%0'_was_found. This_could_indicate_that_JabRef_did_not_shut_down_cleanly_last_time_the_file_was_used.=This_could_indicate_that_JabRef_did_not_shut_down_cleanly_last_time_the_file_was_used. Do_you_want_to_recover_the_database_from_the_backup_file?=Do_you_want_to_recover_the_database_from_the_backup_file? Firstname_Lastname= + +Recommend_for_%0= diff --git a/src/main/resources/l10n/JabRef_pt_BR.properties b/src/main/resources/l10n/JabRef_pt_BR.properties index 691ede7306e..404cb1898b1 100644 --- a/src/main/resources/l10n/JabRef_pt_BR.properties +++ b/src/main/resources/l10n/JabRef_pt_BR.properties @@ -2303,3 +2303,5 @@ A_backup_file_for_'%0'_was_found.=A_backup_file_for_'%0'_was_found. This_could_indicate_that_JabRef_did_not_shut_down_cleanly_last_time_the_file_was_used.=This_could_indicate_that_JabRef_did_not_shut_down_cleanly_last_time_the_file_was_used. Do_you_want_to_recover_the_database_from_the_backup_file?=Do_you_want_to_recover_the_database_from_the_backup_file? Firstname_Lastname= + +Recommend_for_%0= diff --git a/src/main/resources/l10n/JabRef_ru.properties b/src/main/resources/l10n/JabRef_ru.properties index 3a2acd76772..c63a03d36ed 100644 --- a/src/main/resources/l10n/JabRef_ru.properties +++ b/src/main/resources/l10n/JabRef_ru.properties @@ -2303,3 +2303,5 @@ A_backup_file_for_'%0'_was_found.=A_backup_file_for_'%0'_was_found. This_could_indicate_that_JabRef_did_not_shut_down_cleanly_last_time_the_file_was_used.=This_could_indicate_that_JabRef_did_not_shut_down_cleanly_last_time_the_file_was_used. Do_you_want_to_recover_the_database_from_the_backup_file?=Do_you_want_to_recover_the_database_from_the_backup_file? Firstname_Lastname= + +Recommend_for_%0= diff --git a/src/main/resources/l10n/JabRef_sv.properties b/src/main/resources/l10n/JabRef_sv.properties index 83cc9c199e6..de9c503657e 100644 --- a/src/main/resources/l10n/JabRef_sv.properties +++ b/src/main/resources/l10n/JabRef_sv.properties @@ -2303,3 +2303,5 @@ A_backup_file_for_'%0'_was_found.=A_backup_file_for_'%0'_was_found. This_could_indicate_that_JabRef_did_not_shut_down_cleanly_last_time_the_file_was_used.=This_could_indicate_that_JabRef_did_not_shut_down_cleanly_last_time_the_file_was_used. Do_you_want_to_recover_the_database_from_the_backup_file?=Do_you_want_to_recover_the_database_from_the_backup_file? Firstname_Lastname= + +Recommend_for_%0= diff --git a/src/main/resources/l10n/JabRef_tr.properties b/src/main/resources/l10n/JabRef_tr.properties index 5c526069d5f..d390fb880b1 100644 --- a/src/main/resources/l10n/JabRef_tr.properties +++ b/src/main/resources/l10n/JabRef_tr.properties @@ -2303,3 +2303,5 @@ A_backup_file_for_'%0'_was_found.=A_backup_file_for_'%0'_was_found. This_could_indicate_that_JabRef_did_not_shut_down_cleanly_last_time_the_file_was_used.=This_could_indicate_that_JabRef_did_not_shut_down_cleanly_last_time_the_file_was_used. Do_you_want_to_recover_the_database_from_the_backup_file?=Do_you_want_to_recover_the_database_from_the_backup_file? Firstname_Lastname= + +Recommend_for_%0= diff --git a/src/main/resources/l10n/JabRef_vi.properties b/src/main/resources/l10n/JabRef_vi.properties index 71f4e3300e1..fec8b74b81f 100644 --- a/src/main/resources/l10n/JabRef_vi.properties +++ b/src/main/resources/l10n/JabRef_vi.properties @@ -2303,3 +2303,10 @@ A_backup_file_for_'%0'_was_found.=Bản_sao_lưu_dự_phòng_cho_'%0'_đã_tìm_ This_could_indicate_that_JabRef_did_not_shut_down_cleanly_last_time_the_file_was_used.=Điều_này_cho_thấy_là_JabRef_không_được_kết_thúc_hoàn_chỉnh_khi_sử_dụng_tập_tin_lần_cuối. Do_you_want_to_recover_the_database_from_the_backup_file?=Bạn_có_muốn_phục_hồi_cơ_sở_dữ_liệu_từ_tập_tin_lưu_dự_phòng_không? Firstname_Lastname=Họ_Tên +Backup_found=Backup_found +A_backup_file_for_'%0'_was_found.=A_backup_file_for_'%0'_was_found. +This_could_indicate_that_JabRef_did_not_shut_down_cleanly_last_time_the_file_was_used.=This_could_indicate_that_JabRef_did_not_shut_down_cleanly_last_time_the_file_was_used. +Do_you_want_to_recover_the_database_from_the_backup_file?=Do_you_want_to_recover_the_database_from_the_backup_file? +Firstname_Lastname= + +Recommend_for_%0= diff --git a/src/main/resources/l10n/JabRef_zh.properties b/src/main/resources/l10n/JabRef_zh.properties index a894ae23c8f..5b3b3293983 100644 --- a/src/main/resources/l10n/JabRef_zh.properties +++ b/src/main/resources/l10n/JabRef_zh.properties @@ -2303,3 +2303,5 @@ A_backup_file_for_'%0'_was_found.=A_backup_file_for_'%0'_was_found. This_could_indicate_that_JabRef_did_not_shut_down_cleanly_last_time_the_file_was_used.=This_could_indicate_that_JabRef_did_not_shut_down_cleanly_last_time_the_file_was_used. Do_you_want_to_recover_the_database_from_the_backup_file?=Do_you_want_to_recover_the_database_from_the_backup_file? Firstname_Lastname= + +Recommend_for_%0= From 704eca791e1bbff431fd03adee23374a3ece7df0 Mon Sep 17 00:00:00 2001 From: motokito Date: Thu, 13 Oct 2016 12:06:45 +0200 Subject: [PATCH 07/12] Refactoring: * Rename BibTex and BibLaTex to BibTeX and BibLaTeX * Rename Formatter list of BibTeX and BibLaTeX --- .../cleanup/FieldFormatterCleanupsPanel.java | 12 ++++----- .../net/sf/jabref/logic/cleanup/Cleanups.java | 26 +++++++++---------- src/main/resources/l10n/JabRef_da.properties | 2 +- src/main/resources/l10n/JabRef_de.properties | 2 +- src/main/resources/l10n/JabRef_en.properties | 2 +- src/main/resources/l10n/JabRef_es.properties | 2 +- src/main/resources/l10n/JabRef_fa.properties | 2 +- src/main/resources/l10n/JabRef_fr.properties | 2 +- src/main/resources/l10n/JabRef_in.properties | 2 +- src/main/resources/l10n/JabRef_it.properties | 2 +- src/main/resources/l10n/JabRef_ja.properties | 2 +- src/main/resources/l10n/JabRef_nl.properties | 2 +- src/main/resources/l10n/JabRef_no.properties | 2 +- .../resources/l10n/JabRef_pt_BR.properties | 2 +- src/main/resources/l10n/JabRef_ru.properties | 2 +- src/main/resources/l10n/JabRef_sv.properties | 2 +- src/main/resources/l10n/JabRef_tr.properties | 2 +- src/main/resources/l10n/JabRef_vi.properties | 2 +- src/main/resources/l10n/JabRef_zh.properties | 2 +- 19 files changed, 36 insertions(+), 36 deletions(-) diff --git a/src/main/java/net/sf/jabref/gui/cleanup/FieldFormatterCleanupsPanel.java b/src/main/java/net/sf/jabref/gui/cleanup/FieldFormatterCleanupsPanel.java index ebb641cde91..2794187817b 100644 --- a/src/main/java/net/sf/jabref/gui/cleanup/FieldFormatterCleanupsPanel.java +++ b/src/main/java/net/sf/jabref/gui/cleanup/FieldFormatterCleanupsPanel.java @@ -135,19 +135,19 @@ public void contentsChanged(ListDataEvent e) { resetButton = new JButton(Localization.lang("Reset")); resetButton.addActionListener(e -> ((CleanupActionsListModel) actionsList.getModel()).reset(defaultFormatters)); - boolean isBibTex = !JabRefGUI.getMainFrame().getCurrentBasePanel().getDatabaseContext().isBiblatexMode(); + boolean isBibTeX = !JabRefGUI.getMainFrame().getCurrentBasePanel().getDatabaseContext().isBiblatexMode(); String mode; - if (isBibTex) { - mode = "BibTex"; + if (isBibTeX) { + mode = "BibTeX"; } else { - mode = "BibLaTex"; + mode = "BibLaTeX"; } - recommendButton = new JButton(Localization.lang("Recommend for %0", mode)); + recommendButton = new JButton(Localization.lang("Recommended for %0", mode)); recommendButton.addActionListener(e -> { - if (isBibTex) { + if (isBibTeX) { ((CleanupActionsListModel) actionsList.getModel()).reset(Cleanups.RECOMMEND_BIBTEX_ACTIONS); } else { ((CleanupActionsListModel) actionsList.getModel()).reset(Cleanups.RECOMMEND_BIBLATEX_ACTIONS); diff --git a/src/main/java/net/sf/jabref/logic/cleanup/Cleanups.java b/src/main/java/net/sf/jabref/logic/cleanup/Cleanups.java index d3cad299118..cb76b46f4c7 100644 --- a/src/main/java/net/sf/jabref/logic/cleanup/Cleanups.java +++ b/src/main/java/net/sf/jabref/logic/cleanup/Cleanups.java @@ -39,19 +39,19 @@ public class Cleanups { defaultFormatters.add(new FieldFormatterCleanup(FieldName.ABSTRACT_ALL_TEXT_FIELDS_FIELD, new OrdinalsToSuperscriptFormatter())); DEFAULT_SAVE_ACTIONS = new FieldFormatterCleanups(false, defaultFormatters); - List recommendBibTexFormatters = new ArrayList<>(defaultFormatters); - recommendBibTexFormatters.add(new FieldFormatterCleanup(FieldName.TITLE, new HtmlToLatexFormatter())); - recommendBibTexFormatters.add(new FieldFormatterCleanup(FieldName.TITLE, new UnicodeToLatexFormatter())); - recommendBibTexFormatters.add(new FieldFormatterCleanup(FieldName.BOOKTITLE, new UnicodeToLatexFormatter())); - recommendBibTexFormatters.add(new FieldFormatterCleanup(FieldName.JOURNAL, new UnicodeToLatexFormatter())); - recommendBibTexFormatters.add(new FieldFormatterCleanup(FieldName.AUTHOR, new UnicodeToLatexFormatter())); - recommendBibTexFormatters.add(new FieldFormatterCleanup(FieldName.EDITOR, new UnicodeToLatexFormatter())); - RECOMMEND_BIBTEX_ACTIONS = new FieldFormatterCleanups(false, recommendBibTexFormatters); - - List recommendBibLatexFormatters = new ArrayList<>(defaultFormatters); - recommendBibLatexFormatters.add(new FieldFormatterCleanup(FieldName.TITLE, new HtmlToUnicodeFormatter())); - recommendBibLatexFormatters.add(new FieldFormatterCleanup(FieldName.ABSTRACT_ALL_TEXT_FIELDS_FIELD, new LatexToUnicodeFormatter())); - RECOMMEND_BIBLATEX_ACTIONS = new FieldFormatterCleanups(false, recommendBibLatexFormatters); + List recommendedBibTeXFormatters = new ArrayList<>(defaultFormatters); + recommendedBibTeXFormatters.add(new FieldFormatterCleanup(FieldName.TITLE, new HtmlToLatexFormatter())); + recommendedBibTeXFormatters.add(new FieldFormatterCleanup(FieldName.TITLE, new UnicodeToLatexFormatter())); + recommendedBibTeXFormatters.add(new FieldFormatterCleanup(FieldName.BOOKTITLE, new UnicodeToLatexFormatter())); + recommendedBibTeXFormatters.add(new FieldFormatterCleanup(FieldName.JOURNAL, new UnicodeToLatexFormatter())); + recommendedBibTeXFormatters.add(new FieldFormatterCleanup(FieldName.AUTHOR, new UnicodeToLatexFormatter())); + recommendedBibTeXFormatters.add(new FieldFormatterCleanup(FieldName.EDITOR, new UnicodeToLatexFormatter())); + RECOMMEND_BIBTEX_ACTIONS = new FieldFormatterCleanups(false, recommendedBibTeXFormatters); + + List recommendedBibLaTeXFormatters = new ArrayList<>(defaultFormatters); + recommendedBibLaTeXFormatters.add(new FieldFormatterCleanup(FieldName.TITLE, new HtmlToUnicodeFormatter())); + recommendedBibLaTeXFormatters.add(new FieldFormatterCleanup(FieldName.ABSTRACT_ALL_TEXT_FIELDS_FIELD, new LatexToUnicodeFormatter())); + RECOMMEND_BIBLATEX_ACTIONS = new FieldFormatterCleanups(false, recommendedBibLaTeXFormatters); } public static List getAvailableFormatters() { diff --git a/src/main/resources/l10n/JabRef_da.properties b/src/main/resources/l10n/JabRef_da.properties index 4a3129ac216..dfd722cb33b 100644 --- a/src/main/resources/l10n/JabRef_da.properties +++ b/src/main/resources/l10n/JabRef_da.properties @@ -2304,4 +2304,4 @@ This_could_indicate_that_JabRef_did_not_shut_down_cleanly_last_time_the_file_was Do_you_want_to_recover_the_database_from_the_backup_file?=Do_you_want_to_recover_the_database_from_the_backup_file? Firstname_Lastname= -Recommend_for_%0= +Recommended_for_%0= diff --git a/src/main/resources/l10n/JabRef_de.properties b/src/main/resources/l10n/JabRef_de.properties index e041c75ce56..57c1fe14edf 100644 --- a/src/main/resources/l10n/JabRef_de.properties +++ b/src/main/resources/l10n/JabRef_de.properties @@ -2304,4 +2304,4 @@ This_could_indicate_that_JabRef_did_not_shut_down_cleanly_last_time_the_file_was Do_you_want_to_recover_the_database_from_the_backup_file?=Do_you_want_to_recover_the_database_from_the_backup_file? Firstname_Lastname= -Recommend_for_%0= +Recommended_for_%0= diff --git a/src/main/resources/l10n/JabRef_en.properties b/src/main/resources/l10n/JabRef_en.properties index 6f8e4968b4a..0aea5759cda 100644 --- a/src/main/resources/l10n/JabRef_en.properties +++ b/src/main/resources/l10n/JabRef_en.properties @@ -2304,4 +2304,4 @@ This_could_indicate_that_JabRef_did_not_shut_down_cleanly_last_time_the_file_was Do_you_want_to_recover_the_database_from_the_backup_file?=Do_you_want_to_recover_the_database_from_the_backup_file? Firstname_Lastname=Firstname_Lastname -Recommend_for_%0=Recommend_for_%0 +Recommended_for_%0=Recommended_for_%0 diff --git a/src/main/resources/l10n/JabRef_es.properties b/src/main/resources/l10n/JabRef_es.properties index 594426d4095..39bf51193ea 100644 --- a/src/main/resources/l10n/JabRef_es.properties +++ b/src/main/resources/l10n/JabRef_es.properties @@ -2304,4 +2304,4 @@ This_could_indicate_that_JabRef_did_not_shut_down_cleanly_last_time_the_file_was Do_you_want_to_recover_the_database_from_the_backup_file?=Do_you_want_to_recover_the_database_from_the_backup_file? Firstname_Lastname= -Recommend_for_%0= +Recommended_for_%0= diff --git a/src/main/resources/l10n/JabRef_fa.properties b/src/main/resources/l10n/JabRef_fa.properties index cd7a6c7f95b..5a5c71c2e30 100644 --- a/src/main/resources/l10n/JabRef_fa.properties +++ b/src/main/resources/l10n/JabRef_fa.properties @@ -2304,4 +2304,4 @@ This_could_indicate_that_JabRef_did_not_shut_down_cleanly_last_time_the_file_was Do_you_want_to_recover_the_database_from_the_backup_file?=Do_you_want_to_recover_the_database_from_the_backup_file? Firstname_Lastname= -Recommend_for_%0= +Recommended_for_%0= diff --git a/src/main/resources/l10n/JabRef_fr.properties b/src/main/resources/l10n/JabRef_fr.properties index 49b18ac915b..8fce34b52da 100644 --- a/src/main/resources/l10n/JabRef_fr.properties +++ b/src/main/resources/l10n/JabRef_fr.properties @@ -2304,4 +2304,4 @@ This_could_indicate_that_JabRef_did_not_shut_down_cleanly_last_time_the_file_was Do_you_want_to_recover_the_database_from_the_backup_file?=Do_you_want_to_recover_the_database_from_the_backup_file? Firstname_Lastname= -Recommend_for_%0= +Recommended_for_%0= diff --git a/src/main/resources/l10n/JabRef_in.properties b/src/main/resources/l10n/JabRef_in.properties index 6f5a82aa3eb..3789c97d6a0 100644 --- a/src/main/resources/l10n/JabRef_in.properties +++ b/src/main/resources/l10n/JabRef_in.properties @@ -2304,4 +2304,4 @@ This_could_indicate_that_JabRef_did_not_shut_down_cleanly_last_time_the_file_was Do_you_want_to_recover_the_database_from_the_backup_file?=Do_you_want_to_recover_the_database_from_the_backup_file? Firstname_Lastname= -Recommend_for_%0= +Recommended_for_%0= diff --git a/src/main/resources/l10n/JabRef_it.properties b/src/main/resources/l10n/JabRef_it.properties index 7d0140c6f3f..430319d8127 100644 --- a/src/main/resources/l10n/JabRef_it.properties +++ b/src/main/resources/l10n/JabRef_it.properties @@ -2304,4 +2304,4 @@ This_could_indicate_that_JabRef_did_not_shut_down_cleanly_last_time_the_file_was Do_you_want_to_recover_the_database_from_the_backup_file?=Do_you_want_to_recover_the_database_from_the_backup_file? Firstname_Lastname= -Recommend_for_%0= +Recommended_for_%0= diff --git a/src/main/resources/l10n/JabRef_ja.properties b/src/main/resources/l10n/JabRef_ja.properties index 470e682de64..d3619b80fe3 100644 --- a/src/main/resources/l10n/JabRef_ja.properties +++ b/src/main/resources/l10n/JabRef_ja.properties @@ -2304,4 +2304,4 @@ This_could_indicate_that_JabRef_did_not_shut_down_cleanly_last_time_the_file_was Do_you_want_to_recover_the_database_from_the_backup_file?=Do_you_want_to_recover_the_database_from_the_backup_file? Firstname_Lastname= -Recommend_for_%0= +Recommended_for_%0= diff --git a/src/main/resources/l10n/JabRef_nl.properties b/src/main/resources/l10n/JabRef_nl.properties index 7aff6ed68dc..629de522741 100644 --- a/src/main/resources/l10n/JabRef_nl.properties +++ b/src/main/resources/l10n/JabRef_nl.properties @@ -2304,4 +2304,4 @@ This_could_indicate_that_JabRef_did_not_shut_down_cleanly_last_time_the_file_was Do_you_want_to_recover_the_database_from_the_backup_file?=Do_you_want_to_recover_the_database_from_the_backup_file? Firstname_Lastname= -Recommend_for_%0= +Recommended_for_%0= diff --git a/src/main/resources/l10n/JabRef_no.properties b/src/main/resources/l10n/JabRef_no.properties index 8f58c82b79a..cdd056a85bb 100644 --- a/src/main/resources/l10n/JabRef_no.properties +++ b/src/main/resources/l10n/JabRef_no.properties @@ -2304,4 +2304,4 @@ This_could_indicate_that_JabRef_did_not_shut_down_cleanly_last_time_the_file_was Do_you_want_to_recover_the_database_from_the_backup_file?=Do_you_want_to_recover_the_database_from_the_backup_file? Firstname_Lastname= -Recommend_for_%0= +Recommended_for_%0= diff --git a/src/main/resources/l10n/JabRef_pt_BR.properties b/src/main/resources/l10n/JabRef_pt_BR.properties index 404cb1898b1..c950fb03233 100644 --- a/src/main/resources/l10n/JabRef_pt_BR.properties +++ b/src/main/resources/l10n/JabRef_pt_BR.properties @@ -2304,4 +2304,4 @@ This_could_indicate_that_JabRef_did_not_shut_down_cleanly_last_time_the_file_was Do_you_want_to_recover_the_database_from_the_backup_file?=Do_you_want_to_recover_the_database_from_the_backup_file? Firstname_Lastname= -Recommend_for_%0= +Recommended_for_%0= diff --git a/src/main/resources/l10n/JabRef_ru.properties b/src/main/resources/l10n/JabRef_ru.properties index c63a03d36ed..88025a45616 100644 --- a/src/main/resources/l10n/JabRef_ru.properties +++ b/src/main/resources/l10n/JabRef_ru.properties @@ -2304,4 +2304,4 @@ This_could_indicate_that_JabRef_did_not_shut_down_cleanly_last_time_the_file_was Do_you_want_to_recover_the_database_from_the_backup_file?=Do_you_want_to_recover_the_database_from_the_backup_file? Firstname_Lastname= -Recommend_for_%0= +Recommended_for_%0= diff --git a/src/main/resources/l10n/JabRef_sv.properties b/src/main/resources/l10n/JabRef_sv.properties index de9c503657e..dd6bb84dfd0 100644 --- a/src/main/resources/l10n/JabRef_sv.properties +++ b/src/main/resources/l10n/JabRef_sv.properties @@ -2304,4 +2304,4 @@ This_could_indicate_that_JabRef_did_not_shut_down_cleanly_last_time_the_file_was Do_you_want_to_recover_the_database_from_the_backup_file?=Do_you_want_to_recover_the_database_from_the_backup_file? Firstname_Lastname= -Recommend_for_%0= +Recommended_for_%0= diff --git a/src/main/resources/l10n/JabRef_tr.properties b/src/main/resources/l10n/JabRef_tr.properties index d390fb880b1..2eafffc2bdc 100644 --- a/src/main/resources/l10n/JabRef_tr.properties +++ b/src/main/resources/l10n/JabRef_tr.properties @@ -2304,4 +2304,4 @@ This_could_indicate_that_JabRef_did_not_shut_down_cleanly_last_time_the_file_was Do_you_want_to_recover_the_database_from_the_backup_file?=Do_you_want_to_recover_the_database_from_the_backup_file? Firstname_Lastname= -Recommend_for_%0= +Recommended_for_%0= diff --git a/src/main/resources/l10n/JabRef_vi.properties b/src/main/resources/l10n/JabRef_vi.properties index fec8b74b81f..b447cfac93a 100644 --- a/src/main/resources/l10n/JabRef_vi.properties +++ b/src/main/resources/l10n/JabRef_vi.properties @@ -2309,4 +2309,4 @@ This_could_indicate_that_JabRef_did_not_shut_down_cleanly_last_time_the_file_was Do_you_want_to_recover_the_database_from_the_backup_file?=Do_you_want_to_recover_the_database_from_the_backup_file? Firstname_Lastname= -Recommend_for_%0= +Recommended_for_%0= diff --git a/src/main/resources/l10n/JabRef_zh.properties b/src/main/resources/l10n/JabRef_zh.properties index 5b3b3293983..77c35357c37 100644 --- a/src/main/resources/l10n/JabRef_zh.properties +++ b/src/main/resources/l10n/JabRef_zh.properties @@ -2304,4 +2304,4 @@ This_could_indicate_that_JabRef_did_not_shut_down_cleanly_last_time_the_file_was Do_you_want_to_recover_the_database_from_the_backup_file?=Do_you_want_to_recover_the_database_from_the_backup_file? Firstname_Lastname= -Recommend_for_%0= +Recommended_for_%0= From e4afabf49cb237ed463e07218744b2931fc52b6e Mon Sep 17 00:00:00 2001 From: motokito Date: Sat, 15 Oct 2016 23:43:58 +0200 Subject: [PATCH 08/12] Refactoring_15102016_2343: "Recommended for %0" button is now disabled, if save actions are not enabled --- .../net/sf/jabref/gui/cleanup/FieldFormatterCleanupsPanel.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/net/sf/jabref/gui/cleanup/FieldFormatterCleanupsPanel.java b/src/main/java/net/sf/jabref/gui/cleanup/FieldFormatterCleanupsPanel.java index 2794187817b..6c901ca5215 100644 --- a/src/main/java/net/sf/jabref/gui/cleanup/FieldFormatterCleanupsPanel.java +++ b/src/main/java/net/sf/jabref/gui/cleanup/FieldFormatterCleanupsPanel.java @@ -328,6 +328,7 @@ private void setStatus(boolean status) { addButton.setEnabled(status); removeButton.setEnabled(status); resetButton.setEnabled(status); + recommendButton.setEnabled(status); } } From 75497c16ea6e513e8a1dcfa2a603c17757a92bf2 Mon Sep 17 00:00:00 2001 From: motokito Date: Mon, 17 Oct 2016 10:50:48 +0200 Subject: [PATCH 09/12] Fix LocalizationConsistencyTest FAIL: * Testcase ensureNoDuplicates in JabRef_vi.properties --- src/main/resources/l10n/JabRef_vi.properties | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/main/resources/l10n/JabRef_vi.properties b/src/main/resources/l10n/JabRef_vi.properties index b447cfac93a..0b9e7ec378e 100644 --- a/src/main/resources/l10n/JabRef_vi.properties +++ b/src/main/resources/l10n/JabRef_vi.properties @@ -2303,10 +2303,5 @@ A_backup_file_for_'%0'_was_found.=Bản_sao_lưu_dự_phòng_cho_'%0'_đã_tìm_ This_could_indicate_that_JabRef_did_not_shut_down_cleanly_last_time_the_file_was_used.=Điều_này_cho_thấy_là_JabRef_không_được_kết_thúc_hoàn_chỉnh_khi_sử_dụng_tập_tin_lần_cuối. Do_you_want_to_recover_the_database_from_the_backup_file?=Bạn_có_muốn_phục_hồi_cơ_sở_dữ_liệu_từ_tập_tin_lưu_dự_phòng_không? Firstname_Lastname=Họ_Tên -Backup_found=Backup_found -A_backup_file_for_'%0'_was_found.=A_backup_file_for_'%0'_was_found. -This_could_indicate_that_JabRef_did_not_shut_down_cleanly_last_time_the_file_was_used.=This_could_indicate_that_JabRef_did_not_shut_down_cleanly_last_time_the_file_was_used. -Do_you_want_to_recover_the_database_from_the_backup_file?=Do_you_want_to_recover_the_database_from_the_backup_file? -Firstname_Lastname= Recommended_for_%0= From d18bbce6c4146de76941fa74380113ab5364621d Mon Sep 17 00:00:00 2001 From: motokito Date: Tue, 25 Oct 2016 21:11:01 +0200 Subject: [PATCH 10/12] Refactoring: * create test for fieldformattercleanup * refactoring for default --- .../cleanup/FieldFormatterCleanupsPanel.java | 6 +- .../net/sf/jabref/logic/cleanup/Cleanups.java | 11 ++-- .../model/cleanup/FieldFormatterCleanup.java | 7 +- .../net/sf/jabref/model/entry/FieldName.java | 13 +++- .../model/entry/InternalBibtexFields.java | 16 +++++ .../jabref/preferences/JabRefPreferences.java | 4 +- src/main/resources/l10n/JabRef_tr.properties | 6 -- .../cleanup/FieldFormatterCleanupTest.java | 66 +++++++++++++++++++ 8 files changed, 106 insertions(+), 23 deletions(-) create mode 100644 src/test/java/net/sf/jabref/logic/cleanup/FieldFormatterCleanupTest.java diff --git a/src/main/java/net/sf/jabref/gui/cleanup/FieldFormatterCleanupsPanel.java b/src/main/java/net/sf/jabref/gui/cleanup/FieldFormatterCleanupsPanel.java index 6c901ca5215..c3e8c3cdc3f 100644 --- a/src/main/java/net/sf/jabref/gui/cleanup/FieldFormatterCleanupsPanel.java +++ b/src/main/java/net/sf/jabref/gui/cleanup/FieldFormatterCleanupsPanel.java @@ -7,7 +7,6 @@ import java.awt.event.MouseEvent; import java.awt.event.MouseMotionAdapter; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.Objects; @@ -33,7 +32,6 @@ import net.sf.jabref.model.cleanup.FieldFormatterCleanups; import net.sf.jabref.model.cleanup.Formatter; import net.sf.jabref.model.entry.BibEntry; -import net.sf.jabref.model.entry.FieldName; import net.sf.jabref.model.entry.InternalBibtexFields; import net.sf.jabref.model.metadata.MetaData; @@ -216,8 +214,8 @@ private JPanel getSelectorPanel() { .layout(new FormLayout("left:pref:grow, 4dlu, left:pref:grow, 4dlu, pref:grow, 4dlu, right:pref", "pref, 2dlu, pref:grow, 2dlu")); - List fieldNames = InternalBibtexFields.getAllPublicFieldNames(); - fieldNames.addAll(Arrays.asList(BibEntry.KEY_FIELD, FieldName.ABSTRACT_ALL_FIELD, FieldName.ABSTRACT_ALL_TEXT_FIELDS_FIELD)); + List fieldNames = InternalBibtexFields.getAllPublicAndInteralFieldNames(); + fieldNames.add(BibEntry.KEY_FIELD); Collections.sort(fieldNames); String[] allPlusKey = fieldNames.toArray(new String[fieldNames.size()]); diff --git a/src/main/java/net/sf/jabref/logic/cleanup/Cleanups.java b/src/main/java/net/sf/jabref/logic/cleanup/Cleanups.java index cb76b46f4c7..088b6cff5e1 100644 --- a/src/main/java/net/sf/jabref/logic/cleanup/Cleanups.java +++ b/src/main/java/net/sf/jabref/logic/cleanup/Cleanups.java @@ -11,7 +11,6 @@ import net.sf.jabref.logic.formatter.bibtexfields.NormalizeDateFormatter; import net.sf.jabref.logic.formatter.bibtexfields.NormalizeMonthFormatter; import net.sf.jabref.logic.formatter.bibtexfields.NormalizePagesFormatter; -import net.sf.jabref.logic.formatter.bibtexfields.OrdinalsToSuperscriptFormatter; import net.sf.jabref.logic.formatter.bibtexfields.UnicodeToLatexFormatter; import net.sf.jabref.logic.layout.format.LatexToUnicodeFormatter; import net.sf.jabref.model.cleanup.FieldFormatterCleanup; @@ -36,10 +35,11 @@ public class Cleanups { defaultFormatters.add(new FieldFormatterCleanup(FieldName.PAGES, new NormalizePagesFormatter())); defaultFormatters.add(new FieldFormatterCleanup(FieldName.DATE, new NormalizeDateFormatter())); defaultFormatters.add(new FieldFormatterCleanup(FieldName.MONTH, new NormalizeMonthFormatter())); - defaultFormatters.add(new FieldFormatterCleanup(FieldName.ABSTRACT_ALL_TEXT_FIELDS_FIELD, new OrdinalsToSuperscriptFormatter())); +// defaultFormatters.add(new FieldFormatterCleanup(FieldName.BOOKTITLE, new OrdinalsToSuperscriptFormatter())); DEFAULT_SAVE_ACTIONS = new FieldFormatterCleanups(false, defaultFormatters); - List recommendedBibTeXFormatters = new ArrayList<>(defaultFormatters); + List recommendedBibTeXFormatters = new ArrayList<>(); + recommendedBibTeXFormatters.addAll(defaultFormatters); recommendedBibTeXFormatters.add(new FieldFormatterCleanup(FieldName.TITLE, new HtmlToLatexFormatter())); recommendedBibTeXFormatters.add(new FieldFormatterCleanup(FieldName.TITLE, new UnicodeToLatexFormatter())); recommendedBibTeXFormatters.add(new FieldFormatterCleanup(FieldName.BOOKTITLE, new UnicodeToLatexFormatter())); @@ -48,9 +48,10 @@ public class Cleanups { recommendedBibTeXFormatters.add(new FieldFormatterCleanup(FieldName.EDITOR, new UnicodeToLatexFormatter())); RECOMMEND_BIBTEX_ACTIONS = new FieldFormatterCleanups(false, recommendedBibTeXFormatters); - List recommendedBibLaTeXFormatters = new ArrayList<>(defaultFormatters); + List recommendedBibLaTeXFormatters = new ArrayList<>(); + recommendedBibLaTeXFormatters.addAll(defaultFormatters); recommendedBibLaTeXFormatters.add(new FieldFormatterCleanup(FieldName.TITLE, new HtmlToUnicodeFormatter())); - recommendedBibLaTeXFormatters.add(new FieldFormatterCleanup(FieldName.ABSTRACT_ALL_TEXT_FIELDS_FIELD, new LatexToUnicodeFormatter())); + recommendedBibLaTeXFormatters.add(new FieldFormatterCleanup(FieldName.INTERNAL_ALL_TEXT_FIELDS_FIELD, new LatexToUnicodeFormatter())); RECOMMEND_BIBLATEX_ACTIONS = new FieldFormatterCleanups(false, recommendedBibLaTeXFormatters); } diff --git a/src/main/java/net/sf/jabref/model/cleanup/FieldFormatterCleanup.java b/src/main/java/net/sf/jabref/model/cleanup/FieldFormatterCleanup.java index 45a2e3dac24..2b459d678df 100644 --- a/src/main/java/net/sf/jabref/model/cleanup/FieldFormatterCleanup.java +++ b/src/main/java/net/sf/jabref/model/cleanup/FieldFormatterCleanup.java @@ -1,7 +1,6 @@ package net.sf.jabref.model.cleanup; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.Objects; @@ -27,9 +26,9 @@ public FieldFormatterCleanup(String field, Formatter formatter) { @Override public List cleanup(BibEntry entry) { - if (FieldName.ABSTRACT_ALL_FIELD.equalsIgnoreCase(field)) { + if (FieldName.INTERNAL_ALL_FIELD.equalsIgnoreCase(field)) { return cleanupAllFields(entry); - } else if (FieldName.ABSTRACT_ALL_TEXT_FIELDS_FIELD.equalsIgnoreCase(field)) { + } else if (FieldName.INTERNAL_ALL_TEXT_FIELDS_FIELD.equalsIgnoreCase(field)) { return cleanupAllTextFields(entry); } else { return cleanupSingleField(field, entry); @@ -81,7 +80,7 @@ private List cleanupAllFields(BibEntry entry) { private List cleanupAllTextFields(BibEntry entry) { List fieldChanges = new ArrayList<>(); Set fields = entry.getFieldNames(); - fields.removeAll(Arrays.asList(FieldName.DOI, FieldName.FILE, FieldName.URL, FieldName.URI, FieldName.ISBN, FieldName.ISSN, FieldName.MONTH, FieldName.DATE, FieldName.YEAR)); + fields.removeAll(FieldName.getNotTextFieldNames()); for (String fieldKey : fields) { fieldChanges.addAll(cleanupSingleField(fieldKey, entry)); } diff --git a/src/main/java/net/sf/jabref/model/entry/FieldName.java b/src/main/java/net/sf/jabref/model/entry/FieldName.java index 5af10388f72..b2277b7777e 100644 --- a/src/main/java/net/sf/jabref/model/entry/FieldName.java +++ b/src/main/java/net/sf/jabref/model/entry/FieldName.java @@ -1,5 +1,7 @@ package net.sf.jabref.model.entry; +import java.util.ArrayList; +import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Locale; @@ -17,8 +19,8 @@ public class FieldName { // author is not set): public static final String FIELD_SEPARATOR = "/"; - public static final String ABSTRACT_ALL_FIELD = "all"; - public static final String ABSTRACT_ALL_TEXT_FIELDS_FIELD = "all-text-fields"; + public static final String INTERNAL_ALL_FIELD = "all"; + public static final String INTERNAL_ALL_TEXT_FIELDS_FIELD = "all-text-fields"; // Field name constants public static final String ABSTRACT = "abstract"; @@ -164,4 +166,11 @@ public static String getDisplayName(String field) { } return StringUtil.capitalizeFirst(field); } + + public static ArrayList getNotTextFieldNames() { + ArrayList notTextFieldNames = new ArrayList<>(); + notTextFieldNames.addAll(Arrays.asList(FieldName.DOI, FieldName.FILE, FieldName.URL, FieldName.URI, FieldName.ISBN, FieldName.ISSN, FieldName.MONTH, FieldName.DATE, FieldName.YEAR)); + return notTextFieldNames; + } + } diff --git a/src/main/java/net/sf/jabref/model/entry/InternalBibtexFields.java b/src/main/java/net/sf/jabref/model/entry/InternalBibtexFields.java index 74bf3b46c85..72a78e7885c 100644 --- a/src/main/java/net/sf/jabref/model/entry/InternalBibtexFields.java +++ b/src/main/java/net/sf/jabref/model/entry/InternalBibtexFields.java @@ -492,6 +492,22 @@ public static List getAllPublicFieldNames() { return publicFields; } + /** + * returns a List with all fieldnames incl. internal fieldnames + */ + public static List getAllPublicAndInteralFieldNames() { + //add the internal field names to public fields + List publicAndInternalFields = new ArrayList<>(); + publicAndInternalFields.addAll(InternalBibtexFields.getAllPublicFieldNames()); + publicAndInternalFields.add(FieldName.INTERNAL_ALL_FIELD); + publicAndInternalFields.add(FieldName.INTERNAL_ALL_TEXT_FIELDS_FIELD); + + // sort the entries + Collections.sort(publicAndInternalFields); + + return publicAndInternalFields; + } + public static List getJournalNameFields() { return InternalBibtexFields.getAllPublicFieldNames().stream().filter( fieldName -> InternalBibtexFields.getFieldProperties(fieldName).contains(FieldProperty.JOURNAL_NAME)) diff --git a/src/main/java/net/sf/jabref/preferences/JabRefPreferences.java b/src/main/java/net/sf/jabref/preferences/JabRefPreferences.java index 5c4640a26b2..cb2e868d694 100644 --- a/src/main/java/net/sf/jabref/preferences/JabRefPreferences.java +++ b/src/main/java/net/sf/jabref/preferences/JabRefPreferences.java @@ -770,7 +770,7 @@ private JabRefPreferences() { defaults.put(DB_CONNECT_USERNAME, "root"); defaults.put(ASK_AUTO_NAMING_PDFS_AGAIN, Boolean.TRUE); - insertCleanupPreset(defaults); + insertDefaultCleanupPreset(defaults); // defaults for DroppedFileHandler UI defaults.put(DROPPEDFILEHANDLER_LEAVE, Boolean.FALSE); @@ -1325,7 +1325,7 @@ public void setDefaultEncoding(Charset encoding) { put(DEFAULT_ENCODING, encoding.name()); } - private static void insertCleanupPreset(Map storage) { + private static void insertDefaultCleanupPreset(Map storage) { EnumSet deactivedJobs = EnumSet.of( CleanupPreset.CleanupStep.CLEAN_UP_UPGRADE_EXTERNAL_LINKS, CleanupPreset.CleanupStep.RENAME_PDF_ONLY_RELATIVE_PATHS, diff --git a/src/main/resources/l10n/JabRef_tr.properties b/src/main/resources/l10n/JabRef_tr.properties index eb19b0650ca..8a8a87e34aa 100644 --- a/src/main/resources/l10n/JabRef_tr.properties +++ b/src/main/resources/l10n/JabRef_tr.properties @@ -2290,12 +2290,6 @@ Copy_BibTeX_key_and_link=BibTeX_anahtarı_ve_bağlantısını_kopyala empty_BibTeX_key=boş_BibTeX_anahtarı BibLaTeX_field_only=Yalnızca_BibLaTeX_alanı -Backup_found=Backup_found -A_backup_file_for_'%0'_was_found.=A_backup_file_for_'%0'_was_found. -This_could_indicate_that_JabRef_did_not_shut_down_cleanly_last_time_the_file_was_used.=This_could_indicate_that_JabRef_did_not_shut_down_cleanly_last_time_the_file_was_used. -Do_you_want_to_recover_the_database_from_the_backup_file?=Do_you_want_to_recover_the_database_from_the_backup_file? -Firstname_Lastname= - Recommended_for_%0= Error_while_generating_fetch_URL=URL'den_getirme_oluşturulurken_hata Error_while_parsing_ID_list=ID_listesi_çözümlenirken_hata diff --git a/src/test/java/net/sf/jabref/logic/cleanup/FieldFormatterCleanupTest.java b/src/test/java/net/sf/jabref/logic/cleanup/FieldFormatterCleanupTest.java new file mode 100644 index 00000000000..6710f97a933 --- /dev/null +++ b/src/test/java/net/sf/jabref/logic/cleanup/FieldFormatterCleanupTest.java @@ -0,0 +1,66 @@ +package net.sf.jabref.logic.cleanup; + + +import java.util.HashMap; +import java.util.Map; + +import net.sf.jabref.logic.formatter.casechanger.UpperCaseFormatter; +import net.sf.jabref.model.cleanup.FieldFormatterCleanup; +import net.sf.jabref.model.entry.BibEntry; +import net.sf.jabref.model.entry.BibtexEntryTypes; +import net.sf.jabref.model.entry.FieldName; + +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + +public class FieldFormatterCleanupTest { + + private BibEntry entry; + private Map fieldMap; + + @Before + public void setUp() { + fieldMap = new HashMap<>(); + entry = new BibEntry(); + + entry.setType(BibtexEntryTypes.ARTICLE); + fieldMap.put("title", "JabRef"); + fieldMap.put("booktitle", "JabRefBook"); + fieldMap.put("year", "twohundredsixteen"); + fieldMap.put("month", "october"); + fieldMap.put("abstract", "JabRefAbstract"); + fieldMap.put("doi", "jabrefdoi"); + fieldMap.put("issn", "jabrefissn"); + entry.setField(fieldMap); + + } + + @Test + public void testInternalAllField() throws Exception { + FieldFormatterCleanup cleanup = new FieldFormatterCleanup(FieldName.INTERNAL_ALL_FIELD, new UpperCaseFormatter()); + cleanup.cleanup(entry); + + Assert.assertEquals(fieldMap.get("title").toUpperCase(), entry.getField("title").get()); + Assert.assertEquals(fieldMap.get("booktitle").toUpperCase(), entry.getField("booktitle").get()); + Assert.assertEquals(fieldMap.get("year").toUpperCase(), entry.getField("year").get()); + Assert.assertEquals(fieldMap.get("month").toUpperCase(), entry.getField("month").get()); + Assert.assertEquals(fieldMap.get("abstract").toUpperCase(), entry.getField("abstract").get()); + Assert.assertEquals(fieldMap.get("doi").toUpperCase(), entry.getField("doi").get()); + Assert.assertEquals(fieldMap.get("issn").toUpperCase(), entry.getField("issn").get()); + } + + @Test + public void testInternalAllTextFieldsField() throws Exception { + FieldFormatterCleanup cleanup = new FieldFormatterCleanup(FieldName.INTERNAL_ALL_TEXT_FIELDS_FIELD, new UpperCaseFormatter()); + cleanup.cleanup(entry); + + Assert.assertEquals(fieldMap.get("title").toUpperCase(), entry.getField("title").get()); + Assert.assertEquals(fieldMap.get("booktitle").toUpperCase(), entry.getField("booktitle").get()); + Assert.assertEquals(fieldMap.get("year"), entry.getField("year").get()); + Assert.assertEquals(fieldMap.get("month"), entry.getField("month").get()); + Assert.assertEquals(fieldMap.get("abstract").toUpperCase(), entry.getField("abstract").get()); + Assert.assertEquals(fieldMap.get("doi"), entry.getField("doi").get()); + Assert.assertEquals(fieldMap.get("issn"), entry.getField("issn").get()); + } +} From 5677942f656dd0ce87cc96be19c33e540ef4b411 Mon Sep 17 00:00:00 2001 From: motokito Date: Tue, 25 Oct 2016 21:21:10 +0200 Subject: [PATCH 11/12] add OrdinalsToSuperscriptFormatter to recommand button --- src/main/java/net/sf/jabref/logic/cleanup/Cleanups.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/sf/jabref/logic/cleanup/Cleanups.java b/src/main/java/net/sf/jabref/logic/cleanup/Cleanups.java index 088b6cff5e1..3da31da993a 100644 --- a/src/main/java/net/sf/jabref/logic/cleanup/Cleanups.java +++ b/src/main/java/net/sf/jabref/logic/cleanup/Cleanups.java @@ -11,6 +11,7 @@ import net.sf.jabref.logic.formatter.bibtexfields.NormalizeDateFormatter; import net.sf.jabref.logic.formatter.bibtexfields.NormalizeMonthFormatter; import net.sf.jabref.logic.formatter.bibtexfields.NormalizePagesFormatter; +import net.sf.jabref.logic.formatter.bibtexfields.OrdinalsToSuperscriptFormatter; import net.sf.jabref.logic.formatter.bibtexfields.UnicodeToLatexFormatter; import net.sf.jabref.logic.layout.format.LatexToUnicodeFormatter; import net.sf.jabref.model.cleanup.FieldFormatterCleanup; @@ -35,7 +36,6 @@ public class Cleanups { defaultFormatters.add(new FieldFormatterCleanup(FieldName.PAGES, new NormalizePagesFormatter())); defaultFormatters.add(new FieldFormatterCleanup(FieldName.DATE, new NormalizeDateFormatter())); defaultFormatters.add(new FieldFormatterCleanup(FieldName.MONTH, new NormalizeMonthFormatter())); -// defaultFormatters.add(new FieldFormatterCleanup(FieldName.BOOKTITLE, new OrdinalsToSuperscriptFormatter())); DEFAULT_SAVE_ACTIONS = new FieldFormatterCleanups(false, defaultFormatters); List recommendedBibTeXFormatters = new ArrayList<>(); @@ -46,12 +46,14 @@ public class Cleanups { recommendedBibTeXFormatters.add(new FieldFormatterCleanup(FieldName.JOURNAL, new UnicodeToLatexFormatter())); recommendedBibTeXFormatters.add(new FieldFormatterCleanup(FieldName.AUTHOR, new UnicodeToLatexFormatter())); recommendedBibTeXFormatters.add(new FieldFormatterCleanup(FieldName.EDITOR, new UnicodeToLatexFormatter())); + defaultFormatters.add(new FieldFormatterCleanup(FieldName.INTERNAL_ALL_TEXT_FIELDS_FIELD, new OrdinalsToSuperscriptFormatter())); RECOMMEND_BIBTEX_ACTIONS = new FieldFormatterCleanups(false, recommendedBibTeXFormatters); List recommendedBibLaTeXFormatters = new ArrayList<>(); recommendedBibLaTeXFormatters.addAll(defaultFormatters); recommendedBibLaTeXFormatters.add(new FieldFormatterCleanup(FieldName.TITLE, new HtmlToUnicodeFormatter())); recommendedBibLaTeXFormatters.add(new FieldFormatterCleanup(FieldName.INTERNAL_ALL_TEXT_FIELDS_FIELD, new LatexToUnicodeFormatter())); + defaultFormatters.add(new FieldFormatterCleanup(FieldName.INTERNAL_ALL_TEXT_FIELDS_FIELD, new OrdinalsToSuperscriptFormatter())); RECOMMEND_BIBLATEX_ACTIONS = new FieldFormatterCleanups(false, recommendedBibLaTeXFormatters); } From b593ced1f5c0d4e944d7ad1c2ec44863bb3358e5 Mon Sep 17 00:00:00 2001 From: motokito Date: Thu, 27 Oct 2016 07:50:01 +0200 Subject: [PATCH 12/12] REFACTORING_27102016_0744: * rename the recommended list * change "isBibTex" to "isBibLatex" --- .../gui/cleanup/FieldFormatterCleanupsPanel.java | 14 +++++++------- .../java/net/sf/jabref/logic/cleanup/Cleanups.java | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/main/java/net/sf/jabref/gui/cleanup/FieldFormatterCleanupsPanel.java b/src/main/java/net/sf/jabref/gui/cleanup/FieldFormatterCleanupsPanel.java index c3e8c3cdc3f..5bd4c33c0d7 100644 --- a/src/main/java/net/sf/jabref/gui/cleanup/FieldFormatterCleanupsPanel.java +++ b/src/main/java/net/sf/jabref/gui/cleanup/FieldFormatterCleanupsPanel.java @@ -133,22 +133,22 @@ public void contentsChanged(ListDataEvent e) { resetButton = new JButton(Localization.lang("Reset")); resetButton.addActionListener(e -> ((CleanupActionsListModel) actionsList.getModel()).reset(defaultFormatters)); - boolean isBibTeX = !JabRefGUI.getMainFrame().getCurrentBasePanel().getDatabaseContext().isBiblatexMode(); + boolean isBibLaTeX = JabRefGUI.getMainFrame().getCurrentBasePanel().getDatabaseContext().isBiblatexMode(); String mode; - if (isBibTeX) { - mode = "BibTeX"; - } else { + if (isBibLaTeX) { mode = "BibLaTeX"; + } else { + mode = "BibTeX"; } recommendButton = new JButton(Localization.lang("Recommended for %0", mode)); recommendButton.addActionListener(e -> { - if (isBibTeX) { - ((CleanupActionsListModel) actionsList.getModel()).reset(Cleanups.RECOMMEND_BIBTEX_ACTIONS); - } else { + if (isBibLaTeX) { ((CleanupActionsListModel) actionsList.getModel()).reset(Cleanups.RECOMMEND_BIBLATEX_ACTIONS); + } else { + ((CleanupActionsListModel) actionsList.getModel()).reset(Cleanups.RECOMMEND_BIBTEX_ACTIONS); } }); diff --git a/src/main/java/net/sf/jabref/logic/cleanup/Cleanups.java b/src/main/java/net/sf/jabref/logic/cleanup/Cleanups.java index 3da31da993a..e7adeb4d82a 100644 --- a/src/main/java/net/sf/jabref/logic/cleanup/Cleanups.java +++ b/src/main/java/net/sf/jabref/logic/cleanup/Cleanups.java @@ -46,14 +46,14 @@ public class Cleanups { recommendedBibTeXFormatters.add(new FieldFormatterCleanup(FieldName.JOURNAL, new UnicodeToLatexFormatter())); recommendedBibTeXFormatters.add(new FieldFormatterCleanup(FieldName.AUTHOR, new UnicodeToLatexFormatter())); recommendedBibTeXFormatters.add(new FieldFormatterCleanup(FieldName.EDITOR, new UnicodeToLatexFormatter())); - defaultFormatters.add(new FieldFormatterCleanup(FieldName.INTERNAL_ALL_TEXT_FIELDS_FIELD, new OrdinalsToSuperscriptFormatter())); + recommendedBibTeXFormatters.add(new FieldFormatterCleanup(FieldName.INTERNAL_ALL_TEXT_FIELDS_FIELD, new OrdinalsToSuperscriptFormatter())); RECOMMEND_BIBTEX_ACTIONS = new FieldFormatterCleanups(false, recommendedBibTeXFormatters); List recommendedBibLaTeXFormatters = new ArrayList<>(); recommendedBibLaTeXFormatters.addAll(defaultFormatters); recommendedBibLaTeXFormatters.add(new FieldFormatterCleanup(FieldName.TITLE, new HtmlToUnicodeFormatter())); recommendedBibLaTeXFormatters.add(new FieldFormatterCleanup(FieldName.INTERNAL_ALL_TEXT_FIELDS_FIELD, new LatexToUnicodeFormatter())); - defaultFormatters.add(new FieldFormatterCleanup(FieldName.INTERNAL_ALL_TEXT_FIELDS_FIELD, new OrdinalsToSuperscriptFormatter())); + recommendedBibLaTeXFormatters.add(new FieldFormatterCleanup(FieldName.INTERNAL_ALL_TEXT_FIELDS_FIELD, new OrdinalsToSuperscriptFormatter())); RECOMMEND_BIBLATEX_ACTIONS = new FieldFormatterCleanups(false, recommendedBibLaTeXFormatters); }