Skip to content

Commit

Permalink
Merge branch 'master' into improve-sync-language-script
Browse files Browse the repository at this point in the history
  • Loading branch information
simonharrer committed Dec 15, 2015
2 parents f555170 + 4101848 commit 998e01b
Show file tree
Hide file tree
Showing 344 changed files with 3,435 additions and 3,218 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ to [sourceforge feature requests](https://sourceforge.net/p/jabref/features/) by
- Move Bibtex and Biblatex mode switcher to File menu
- Display active edit mode (BibTeX or Biblatex) at window title
- Implements #444: The search is cleared by either clicking the clear-button or by pressing ESC with having focus in the search field.
- Icons are shown as Header for icon columns in the entry table (#315)
- Tooltips are shown for header columns and contents which are too wide to be displayed in the entry table (#384)
- Default order in entry table: # | all file based icons (file, URL/DOI, ...) | all bibtex field based icons (bibtexkey, entrytype, author, title, ...) | all activated special field icons (ranking, quality, ...)

### Fixed
- Fixed #434: Revert to old 'JabRef' installation folder name instead of 'jabref'
Expand All @@ -32,11 +35,14 @@ to [sourceforge feature requests](https://sourceforge.net/p/jabref/features/) by
- Fixes #412: Biblatex preserves capital letters, checking whether letters may be converted to lowercase within the Integrity Check action is obsolete.
- Fixed #437: The toolbar after the search field is now correctly wrapped when using a small window size for JabRef
- Fixed #438: Cut, Copy and Paste are now translated correctly in the menu
- Fixed #443/#445: Fixed sorting and moving special field columns
- Fixed #498: non-working legacy PDF/PS column removed

### Removed
- Removed file history size preference (never available from the UI)
- Removed jstorImporter because it's hardly ever used, even Jstor.org doesn't support/export said format anymore

- Removed option "Show one letter heading for icon columns" which is obsolete with the fix of #315/384
- Removed table column "PDF/PS" which refers to legacy fields "ps" resp. "pdf" which are no longer supported (see also fix #498)



Expand Down
14 changes: 7 additions & 7 deletions src/main/java/net/sf/jabref/JabRef.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@
import net.sf.jabref.logic.l10n.Localization;
import net.sf.jabref.logic.util.OS;
import net.sf.jabref.migrations.PreferencesMigrations;
import net.sf.jabref.model.database.BibtexDatabase;
import net.sf.jabref.model.entry.BibtexEntry;
import net.sf.jabref.model.database.BibDatabase;
import net.sf.jabref.model.entry.BibEntry;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
Expand Down Expand Up @@ -289,9 +289,9 @@ public Vector<ParserResult> processArguments(String[] args, boolean initialStart
String searchTerm = data[0].replace("\\$", " "); //enables blanks within the search term:
//? stands for a blank
ParserResult pr = loaded.elementAt(loaded.size() - 1);
BibtexDatabase dataBase = pr.getDatabase();
BibDatabase dataBase = pr.getDatabase();
SearchManagerNoGUI smng = new SearchManagerNoGUI(searchTerm, dataBase);
BibtexDatabase newBase = smng.getDBfromMatches(); //newBase contains only match entries
BibDatabase newBase = smng.getDBfromMatches(); //newBase contains only match entries

//export database
if ((newBase != null) && (newBase.getEntryCount() > 0)) {
Expand Down Expand Up @@ -425,7 +425,7 @@ public Vector<ParserResult> processArguments(String[] args, boolean initialStart
if (data.length == 2) {
ParserResult pr = loaded.firstElement();
AuxCommandLine acl = new AuxCommandLine(data[0], pr.getDatabase());
BibtexDatabase newBase = acl.perform();
BibDatabase newBase = acl.perform();

boolean notSavedMsg = false;

Expand Down Expand Up @@ -518,7 +518,7 @@ private ParserResult fetch(String fetchCommand) {

System.out.println(Localization.lang("Running Query '%0' with fetcher '%1'.", query, engine) + " "
+ Localization.lang("Please wait..."));
Collection<BibtexEntry> result = new ImportInspectionCommandLine().query(query, fetcher);
Collection<BibEntry> result = new ImportInspectionCommandLine().query(query, fetcher);

if ((result == null) || result.isEmpty()) {
System.out.println(
Expand Down Expand Up @@ -849,7 +849,7 @@ private static ParserResult importFile(String argument) {
if ((data.length > 1) && !"*".equals(data[1])) {
System.out.println(Localization.lang("Importing") + ": " + data[0]);
try {
List<BibtexEntry> entries;
List<BibEntry> entries;
if (OS.WINDOWS) {
entries = Globals.importFormatReader.importFromFile(data[1], data[0], JabRef.jrf);
} else {
Expand Down
7 changes: 2 additions & 5 deletions src/main/java/net/sf/jabref/JabRefPreferences.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
import net.sf.jabref.gui.entryeditor.EntryEditorTabList;
import net.sf.jabref.gui.keyboard.KeyBinding;
import net.sf.jabref.gui.keyboard.KeyBindingRepository;
import net.sf.jabref.gui.maintable.PersistenceTableColumnListener;
import net.sf.jabref.gui.preftabs.ImportSettingsTab;
import net.sf.jabref.importer.fileformat.ImportFormat;
import net.sf.jabref.logic.autocompleter.AutoCompletePreferences;
Expand Down Expand Up @@ -193,7 +194,6 @@ public class JabRefPreferences {
public static final String FILE_COLUMN = "fileColumn";
public static final String PREFER_URL_DOI = "preferUrlDoi";
public static final String URL_COLUMN = "urlColumn";
public static final String PDF_COLUMN = "pdfColumn";
public static final String DISABLE_ON_MULTIPLE_SELECTION = "disableOnMultipleSelection";
public static final String CTRL_CLICK = "ctrlClick";
public static final String INCOMPLETE_ENTRY_BACKGROUND = "incompleteEntryBackground";
Expand Down Expand Up @@ -232,7 +232,6 @@ public class JabRefPreferences {
public static final String TOOLBAR_VISIBLE = "toolbarVisible";
public static final String HIGHLIGHT_GROUPS_MATCHING_ALL = "highlightGroupsMatchingAll";
public static final String HIGHLIGHT_GROUPS_MATCHING_ANY = "highlightGroupsMatchingAny";
public static final String SHOW_ONE_LETTER_HEADING_FOR_ICON_COLUMNS = "showOneLetterHeadingForIconColumns";
public static final String UPDATE_TIMESTAMP = "updateTimestamp";
public static final String TIME_STAMP_FIELD = "timeStampField";
public static final String TIME_STAMP_FORMAT = "timeStampFormat";
Expand Down Expand Up @@ -608,7 +607,6 @@ private JabRefPreferences() {

defaults.put(CTRL_CLICK, Boolean.FALSE);
defaults.put(DISABLE_ON_MULTIPLE_SELECTION, Boolean.FALSE);
defaults.put(PDF_COLUMN, Boolean.FALSE);
defaults.put(URL_COLUMN, Boolean.TRUE);
defaults.put(PREFER_URL_DOI, Boolean.FALSE);
defaults.put(FILE_COLUMN, Boolean.TRUE);
Expand All @@ -627,8 +625,6 @@ private JabRefPreferences() {
defaults.put(SpecialFieldsUtils.PREF_AUTOSYNCSPECIALFIELDSTOKEYWORDS, SpecialFieldsUtils.PREF_AUTOSYNCSPECIALFIELDSTOKEYWORDS_DEFAULT);
defaults.put(SpecialFieldsUtils.PREF_SERIALIZESPECIALFIELDS, SpecialFieldsUtils.PREF_SERIALIZESPECIALFIELDS_DEFAULT);

defaults.put(SHOW_ONE_LETTER_HEADING_FOR_ICON_COLUMNS, Boolean.FALSE);

defaults.put(USE_OWNER, Boolean.FALSE);
defaults.put(OVERWRITE_OWNER, Boolean.FALSE);
defaults.put(ALLOW_TABLE_EDITING, Boolean.FALSE);
Expand Down Expand Up @@ -817,6 +813,7 @@ public void setLanguageDependentDefaultValues() {
defaults.put(CUSTOM_TAB_FIELDS + "_def2", "review");
defaults.put(CUSTOM_TAB_NAME + "_def2", Localization.lang("Review"));

defaults.put(EMAIL_SUBJECT, Localization.lang("References"));
}

public boolean putBracesAroundCapitals(String fieldName) {
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/net/sf/jabref/MetaData.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import net.sf.jabref.migrations.VersionHandling;
import net.sf.jabref.logic.labelPattern.AbstractLabelPattern;
import net.sf.jabref.logic.labelPattern.DatabaseLabelPattern;
import net.sf.jabref.model.database.BibtexDatabase;
import net.sf.jabref.model.database.BibDatabase;
import net.sf.jabref.sql.DBStrings;
import net.sf.jabref.logic.util.strings.StringUtil;

Expand All @@ -48,7 +48,7 @@ public class MetaData implements Iterable<String> {
* must simply make sure the appropriate changes are reflected in the Vector
* it has been passed.
*/
public MetaData(HashMap<String, String> inData, BibtexDatabase db) {
public MetaData(HashMap<String, String> inData, BibDatabase db) {
boolean groupsTreePresent = false;
Vector<String> flatGroupsData = null;
Vector<String> treeGroupsData = null;
Expand Down Expand Up @@ -221,11 +221,11 @@ public String[] getFileDirectory(String fieldName) {
* Parse the groups metadata string
*
* @param orderedData The vector of metadata strings
* @param db The BibtexDatabase this metadata belongs to
* @param db The BibDatabase this metadata belongs to
* @param version The group tree version
* @return true if parsing was successful, false otherwise
*/
private void putGroups(Vector<String> orderedData, BibtexDatabase db, int version) {
private void putGroups(Vector<String> orderedData, BibDatabase db, int version) {
try {
groupsRoot = VersionHandling.importGroups(orderedData, db,
version);
Expand Down
18 changes: 9 additions & 9 deletions src/main/java/net/sf/jabref/SearchManagerNoGUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,26 +23,26 @@
import org.apache.commons.logging.LogFactory;

import net.sf.jabref.importer.*;
import net.sf.jabref.model.database.BibtexDatabase;
import net.sf.jabref.model.entry.BibtexEntry;
import net.sf.jabref.model.database.BibDatabase;
import net.sf.jabref.model.entry.BibEntry;

/**
* @author Silberer, Zirn
*/
class SearchManagerNoGUI {

private String searchTerm;
private final BibtexDatabase database;
private BibtexDatabase base;
private final BibDatabase database;
private BibDatabase base;

private static final Log LOGGER = LogFactory.getLog(SearchManagerNoGUI.class);

public SearchManagerNoGUI(String term, BibtexDatabase dataBase) {
public SearchManagerNoGUI(String term, BibDatabase dataBase) {
searchTerm = term;
database = dataBase;
}

public BibtexDatabase getDBfromMatches() {
public BibDatabase getDBfromMatches() {
LOGGER.debug("Search term: " + searchTerm);
if (specifiedYears()) {
searchTerm = fieldYear();
Expand All @@ -56,9 +56,9 @@ public BibtexDatabase getDBfromMatches() {
return base;
}

Collection<BibtexEntry> entries = database.getEntries();
Vector<BibtexEntry> matchEntries = new Vector<>();
for (BibtexEntry entry : entries) {
Collection<BibEntry> entries = database.getEntries();
Vector<BibEntry> matchEntries = new Vector<>();
for (BibEntry entry : entries) {
boolean hit = searchQuery.isMatch(entry);
entry.setSearchHit(hit);
if (hit) {
Expand Down
24 changes: 12 additions & 12 deletions src/main/java/net/sf/jabref/bibtex/BibtexEntryWriter.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import net.sf.jabref.JabRefPreferences;
import net.sf.jabref.exporter.LatexFieldFormatter;
import net.sf.jabref.logic.util.strings.StringUtil;
import net.sf.jabref.model.entry.BibtexEntry;
import net.sf.jabref.model.entry.BibEntry;

import java.io.IOException;
import java.io.Writer;
Expand Down Expand Up @@ -59,7 +59,7 @@ public BibtexEntryWriter(LatexFieldFormatter fieldFormatter, boolean write) {
this.write = write;
}

public void write(BibtexEntry entry, Writer out) throws IOException {
public void write(BibEntry entry, Writer out) throws IOException {
// if the entry has not been modified, write it as it was
if(!entry.hasChanged()){
out.write(entry.getParsedSerialization());
Expand Down Expand Up @@ -87,14 +87,14 @@ public void write(BibtexEntry entry, Writer out) throws IOException {
* @param out
* @throws IOException
*/
private void writeRequiredFieldsFirstOptionalFieldsSecondRemainingFieldsThird(BibtexEntry entry, Writer out) throws IOException {
private void writeRequiredFieldsFirstOptionalFieldsSecondRemainingFieldsThird(BibEntry entry, Writer out) throws IOException {
// Write header with type and bibtex-key.
out.write('@' + entry.getType().getName() + '{');

HashSet<String> writtenFields = new HashSet<>();

writeKeyField(entry, out);
writtenFields.add(BibtexEntry.KEY_FIELD);
writtenFields.add(BibEntry.KEY_FIELD);

// Write required fields first.
// Thereby, write the title field first.
Expand Down Expand Up @@ -140,7 +140,7 @@ private void writeRequiredFieldsFirstOptionalFieldsSecondRemainingFieldsThird(Bi
out.write((hasWritten ? Globals.NEWLINE : "") + '}');
}

private List<String> getRequiredFieldsSorted(BibtexEntry entry) {
private List<String> getRequiredFieldsSorted(BibEntry entry) {
String entryTypeName = entry.getType().getName();
List<String> sortedFields = requiredFieldsSorted.get(entryTypeName);

Expand All @@ -154,7 +154,7 @@ private List<String> getRequiredFieldsSorted(BibtexEntry entry) {
return sortedFields;
}

private List<String> getOptionalFieldsSorted(BibtexEntry entry) {
private List<String> getOptionalFieldsSorted(BibEntry entry) {
String entryTypeName = entry.getType().getName();
List<String> sortedFields = optionalFieldsSorted.get(entryTypeName);

Expand All @@ -175,14 +175,14 @@ private List<String> getOptionalFieldsSorted(BibtexEntry entry) {
* @param out
* @throws IOException
*/
private void writeRequiredFieldsFirstRemainingFieldsSecond(BibtexEntry entry, Writer out) throws IOException {
private void writeRequiredFieldsFirstRemainingFieldsSecond(BibEntry entry, Writer out) throws IOException {
// Write header with type and bibtex-key.
out.write('@' + entry.getType().getName().toUpperCase(Locale.US) + '{');

writeKeyField(entry, out);

HashSet<String> written = new HashSet<>();
written.add(BibtexEntry.KEY_FIELD);
written.add(BibEntry.KEY_FIELD);
boolean hasWritten = false;
// Write required fields first.
List<String> fields = entry.getRequiredFieldsFlat();
Expand Down Expand Up @@ -219,13 +219,13 @@ private void writeRequiredFieldsFirstRemainingFieldsSecond(BibtexEntry entry, Wr
out.write((hasWritten ? Globals.NEWLINE : "") + '}');
}

private void writeUserDefinedOrder(BibtexEntry entry, Writer out) throws IOException {
private void writeUserDefinedOrder(BibEntry entry, Writer out) throws IOException {
// Write header with type and bibtex-key.
out.write('@' + entry.getType().getName() + '{');

writeKeyField(entry, out);
HashMap<String, String> written = new HashMap<>();
written.put(BibtexEntry.KEY_FIELD, null);
written.put(BibEntry.KEY_FIELD, null);
boolean hasWritten = false;

// Write user defined fields first.
Expand Down Expand Up @@ -265,7 +265,7 @@ private void writeUserDefinedOrder(BibtexEntry entry, Writer out) throws IOExcep

}

private void writeKeyField(BibtexEntry entry, Writer out) throws IOException {
private void writeKeyField(BibEntry entry, Writer out) throws IOException {
String keyField = StringUtil.shaveString(entry.getCiteKey());
out.write((keyField == null ? "" : keyField) + ',' + Globals.NEWLINE);
}
Expand All @@ -281,7 +281,7 @@ private void writeKeyField(BibtexEntry entry, Writer out) throws IOException {
* it was not set
* @throws IOException In case of an IO error
*/
private boolean writeField(BibtexEntry entry, Writer out, String name, boolean prependWhiteSpace) throws IOException {
private boolean writeField(BibEntry entry, Writer out, String name, boolean prependWhiteSpace) throws IOException {
String field = entry.getField(name);
// only write field if is is not empty or if empty fields should be included
// the first condition mirrors mirror behavior of com.jgoodies.common.base.Strings.isNotBlank(str)
Expand Down
22 changes: 11 additions & 11 deletions src/main/java/net/sf/jabref/bibtex/DuplicateCheck.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
package net.sf.jabref.bibtex;

import net.sf.jabref.model.entry.AuthorList;
import net.sf.jabref.model.database.BibtexDatabase;
import net.sf.jabref.model.entry.BibtexEntry;
import net.sf.jabref.model.database.BibDatabase;
import net.sf.jabref.model.entry.BibEntry;

import java.util.HashMap;
import java.util.HashSet;
Expand Down Expand Up @@ -64,11 +64,11 @@ public class DuplicateCheck {
/**
* Checks if the two entries represent the same publication.
*
* @param one BibtexEntry
* @param two BibtexEntry
* @param one BibEntry
* @param two BibEntry
* @return boolean
*/
public static boolean isDuplicate(BibtexEntry one, BibtexEntry two) {
public static boolean isDuplicate(BibEntry one, BibEntry two) {

// First check if they are of the same type - a necessary condition:
if (one.getType() != two.getType()) {
Expand Down Expand Up @@ -98,7 +98,7 @@ public static boolean isDuplicate(BibtexEntry one, BibtexEntry two) {
return req[0] >= DuplicateCheck.duplicateThreshold;
}

private static double[] compareFieldSet(String[] fields, BibtexEntry one, BibtexEntry two) {
private static double[] compareFieldSet(String[] fields, BibEntry one, BibEntry two) {
double res = 0;
double totWeights = 0.;
for (String field : fields) {
Expand All @@ -122,7 +122,7 @@ private static double[] compareFieldSet(String[] fields, BibtexEntry one, Bibtex
return new double[] {0.5, 0.0};
}

private static int compareSingleField(String field, BibtexEntry one, BibtexEntry two) {
private static int compareSingleField(String field, BibEntry one, BibEntry two) {
String s1 = one.getField(field);
String s2 = two.getField(field);
if (s1 == null) {
Expand Down Expand Up @@ -176,7 +176,7 @@ private static int compareSingleField(String field, BibtexEntry one, BibtexEntry
}
}

public static double compareEntriesStrictly(BibtexEntry one, BibtexEntry two) {
public static double compareEntriesStrictly(BibEntry one, BibEntry two) {
HashSet<String> allFields = new HashSet<>();
allFields.addAll(one.getFieldNames());
allFields.addAll(two.getFieldNames());
Expand All @@ -200,15 +200,15 @@ public static double compareEntriesStrictly(BibtexEntry one, BibtexEntry two) {
/**
* Goes through all entries in the given database, and if at least one of
* them is a duplicate of the given entry, as per
* Util.isDuplicate(BibtexEntry, BibtexEntry), the duplicate is returned.
* Util.isDuplicate(BibEntry, BibEntry), the duplicate is returned.
* The search is terminated when the first duplicate is found.
*
* @param database The database to search.
* @param entry The entry of which we are looking for duplicates.
* @return The first duplicate entry found. null if no duplicates are found.
*/
public static BibtexEntry containsDuplicate(BibtexDatabase database, BibtexEntry entry) {
for (BibtexEntry other : database.getEntries()) {
public static BibEntry containsDuplicate(BibDatabase database, BibEntry entry) {
for (BibEntry other : database.getEntries()) {
if (DuplicateCheck.isDuplicate(entry, other)) {
return other; // Duplicate found.
}
Expand Down
Loading

0 comments on commit 998e01b

Please sign in to comment.