Skip to content
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[master]
- Perform syntax improvements enabled by Java 1.7+ (diamond operator, try-with-resources)
- List of authors is now auto generated `scripts/generate-authors.sh` and inserted into L10N About.html
- Remove Mr.DLib support as MR.DLib will be shut down in 2015
- Streamline logging API: Replace usages of java.util.logging with commons.logging
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/net/sf/jabref/CustomEntryType.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public class CustomEntryType extends BibtexEntryType {


public CustomEntryType(String name_, String[] req_, String[] priOpt_, String[] secOpt_) {
name = StringUtil.nCase(name_);
name = StringUtil.capitalizeFirst(name_);
parseRequiredFields(req_);
priOpt = priOpt_;
opt = Util.arrayConcat(priOpt_, secOpt_);
Expand All @@ -53,7 +53,7 @@ public CustomEntryType(String name_, String[] req_, String[] opt_) {
}

private CustomEntryType(String name_, String reqStr, String optStr) {
name = StringUtil.nCase(name_);
name = StringUtil.capitalizeFirst(name_);
if (reqStr.isEmpty()) {
req = new String[0];
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/net/sf/jabref/EntryTypeDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public void windowClosing(WindowEvent e) {

for (BibtexEntryType tp : BibtexEntryType.getAllValues()) {
if (tp.isVisibleAtNewEntryDialog()) {
TypeButton b = new TypeButton(StringUtil.nCase(tp.getName()), tp);
TypeButton b = new TypeButton(StringUtil.capitalizeFirst(tp.getName()), tp);
b.addActionListener(this);
// Check if we should finish the row.
col++;
Expand Down
7 changes: 3 additions & 4 deletions src/main/java/net/sf/jabref/JabRefFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
import java.awt.event.WindowEvent;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.Method;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
Expand Down Expand Up @@ -1233,13 +1232,13 @@ public NewEntryAction(KeyStroke key) {

public NewEntryAction(String type_) {
// This action leads to the creation of a specific entry.
putValue(Action.NAME, StringUtil.nCase(type_));
putValue(Action.NAME, StringUtil.capitalizeFirst(type_));
type = type_;
}

public NewEntryAction(String type_, KeyStroke key) {
// This action leads to the creation of a specific entry.
putValue(Action.NAME, StringUtil.nCase(type_));
putValue(Action.NAME, StringUtil.capitalizeFirst(type_));
putValue(Action.ACCELERATOR_KEY, key);
type = type_;
}
Expand Down Expand Up @@ -2558,7 +2557,7 @@ class EditAction extends MnemonicAwareAction {
public EditAction(String command, URL icon) {
super(new ImageIcon(icon));
this.command = command;
String nName = StringUtil.nCase(command);
String nName = StringUtil.capitalizeFirst(command);
putValue(Action.NAME, nName);
putValue(Action.ACCELERATOR_KEY, prefs.getKey(nName));
putValue(Action.SHORT_DESCRIPTION, Globals.lang(nName));
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/net/sf/jabref/JabRefPreferences.java
Original file line number Diff line number Diff line change
Expand Up @@ -1383,10 +1383,10 @@ public CustomEntryType getCustomEntryType(int number) {
return null;
}
if (priOpt == null) {
return new CustomEntryType(StringUtil.nCase(name), req, opt);
return new CustomEntryType(StringUtil.capitalizeFirst(name), req, opt);
}
String[] secOpt = Util.getRemainder(opt, priOpt);
return new CustomEntryType(StringUtil.nCase(name), req, priOpt, secOpt);
return new CustomEntryType(StringUtil.capitalizeFirst(name), req, priOpt, secOpt);

}

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/net/sf/jabref/gui/AttachFileDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@ public void actionPerformed(ActionEvent event) {

FormLayout layout = new FormLayout("fill:160dlu, 4dlu, fill:pref", "");
DefaultFormBuilder builder = new DefaultFormBuilder(layout);
//builder.append(Util.nCase(fieldName));//(editor.getLabel());
builder.appendSeparator(StringUtil.nCase(fieldName));
//builder.append(Util.capitalizeFirst(fieldName));//(editor.getLabel());
builder.appendSeparator(StringUtil.capitalizeFirst(fieldName));
builder.append(editor.getTextComponent());
builder.append(browse);

Expand Down
10 changes: 5 additions & 5 deletions src/main/java/net/sf/jabref/gui/EntryCustomizationDialog2.java
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ private void applyChanges() {
if (defaulted.contains(stringListEntry.getKey())) {
// This type should be reverted to its default setup.
//System.out.println("Defaulting: "+typeName);
String nm = StringUtil.nCase(stringListEntry.getKey());
String nm = StringUtil.capitalizeFirst(stringListEntry.getKey());
BibtexEntryType.removeType(nm);

updateTypesForEntries(nm);
Expand All @@ -294,8 +294,8 @@ private void applyChanges() {
if (changesMade) {
//System.out.println("Updating: "+typeName);
CustomEntryType typ = biblatexMode ?
new CustomEntryType(StringUtil.nCase(stringListEntry.getKey()), reqStr, optStr, opt2Str) :
new CustomEntryType(StringUtil.nCase(stringListEntry.getKey()), reqStr, optStr);
new CustomEntryType(StringUtil.capitalizeFirst(stringListEntry.getKey()), reqStr, optStr, opt2Str) :
new CustomEntryType(StringUtil.capitalizeFirst(stringListEntry.getKey()), reqStr, optStr);

BibtexEntryType.addOrModifyCustomEntryType(typ);
updateTypesForEntries(typ.getName());
Expand Down Expand Up @@ -329,14 +329,14 @@ private void typeDeletion(String name) {
+ "type will be declared "
+ "typeless. Continue?"),
Globals.lang("Delete custom format") +
" '" + StringUtil.nCase(name) + '\'', JOptionPane.YES_NO_OPTION,
" '" + StringUtil.capitalizeFirst(name) + '\'', JOptionPane.YES_NO_OPTION,
JOptionPane.WARNING_MESSAGE);
if (reply != JOptionPane.YES_OPTION) {
return;
}
}
BibtexEntryType.removeType(name);
updateTypesForEntries(StringUtil.nCase(name));
updateTypesForEntries(StringUtil.capitalizeFirst(name));
changed.remove(name);
reqLists.remove(name);
optLists.remove(name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1522,7 +1522,7 @@ public String getColumnName(int i) {
return Globals.lang("Keep");
}
if (i >= PAD) {
return StringUtil.nCase(fields[i - PAD]);
return StringUtil.capitalizeFirst(fields[i - PAD]);
}
return "";
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/net/sf/jabref/gui/MainTableFormat.java
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public String getColumnName(int col) {
if (disName != null) {
sb.append(disName);
} else {
sb.append(StringUtil.nCase(fld[i]));
sb.append(StringUtil.capitalizeFirst(fld[i]));
}
}
return sb.toString();
Expand All @@ -128,7 +128,7 @@ public String getColumnName(int col) {
return disName ;
} */
}
//return Util.nCase(columns[col - padleft]);
//return Util.capitalizeFirst(columns[col - padleft]);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/net/sf/jabref/gui/SearchResultsDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ public int getColumnCount() {
@Override
public String getColumnName(int column) {
if (column >= PAD) {
return StringUtil.nCase(fields[column - PAD]);
return StringUtil.capitalizeFirst(fields[column - PAD]);
} else {
return "";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public FieldTextArea(String fieldName, String content) {
setWrapStyleWord(true);
this.fieldName = fieldName;

label = new FieldNameLabel(' ' + StringUtil.nCase(this.fieldName) + ' ');
label = new FieldNameLabel(' ' + StringUtil.capitalizeFirst(this.fieldName) + ' ');
setBackground(GUIGlobals.validFieldBackgroundColor);
setForeground(GUIGlobals.editorTextColor);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public FieldTextField(String fieldName, String content, boolean changeColorOnFoc
addFocusListener(new FieldEditorFocusListener());
}
this.fieldName = fieldName;
label = new FieldNameLabel(' ' + StringUtil.nCase(this.fieldName) + ' ');
label = new FieldNameLabel(' ' + StringUtil.capitalizeFirst(this.fieldName) + ' ');
setBackground(GUIGlobals.validFieldBackgroundColor);
setForeground(GUIGlobals.editorTextColor);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
import javax.swing.JTable;
import javax.swing.KeyStroke;
import javax.swing.TransferHandler;
import javax.swing.event.UndoableEditListener;

import net.sf.jabref.*;
import net.sf.jabref.external.*;
Expand Down Expand Up @@ -78,7 +77,7 @@ public FileListEditor(JabRefFrame frame, MetaData metaData, String fieldName, St
this.metaData = metaData;
this.fieldName = fieldName;
this.entryEditor = entryEditor;
label = new FieldNameLabel(" " + StringUtil.nCase(fieldName) + " ");
label = new FieldNameLabel(" " + StringUtil.capitalizeFirst(fieldName) + " ");
tableModel = new FileListTableModel();
setText(content);
setModel(tableModel);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ public void actionPerformed(ActionEvent arg0) {

private JTextField addEntryType(Container c, String name, int y) {

JLabel lab = new JLabel(StringUtil.nCase(name));
JLabel lab = new JLabel(StringUtil.capitalizeFirst(name));
name = name.toLowerCase();
con.gridx = 0;
con.gridy = y;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (C) 2003-2012 JabRef contributors.
/* Copyright (C) 2003-2015 JabRef contributors.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
Expand Down Expand Up @@ -36,13 +36,13 @@ abstract class AbstractAutoCompleter implements AutoCompleter {
private static final int SHORTEST_WORD = 4;

// stores the strings as is
private final TreeSet<String> indexCaseSensitive = new TreeSet<String>();
private final TreeSet<String> indexCaseSensitive = new TreeSet<>();

// stores strings in lowercase
private final TreeSet<String> indexCaseInsensitive = new TreeSet<String>();
private final TreeSet<String> indexCaseInsensitive = new TreeSet<>();

// stores for a lowercase string the possible expanded strings
private final HashMap<String, TreeSet<String>> possibleStringsForSearchString = new HashMap<String, TreeSet<String>>();
private final HashMap<String, TreeSet<String>> possibleStringsForSearchString = new HashMap<>();



Expand All @@ -56,29 +56,29 @@ abstract class AbstractAutoCompleter implements AutoCompleter {
*
* @see AbstractAutoCompleter#addBibtexEntry(BibtexEntry)
*/
public String[] complete(String str) {
if (AbstractAutoCompleter.stringMinLength(str)) {
public String[] complete(String toComplete) {
if (AbstractAutoCompleter.stringMinLength(toComplete)) {
return null;
}
String lstr = str.toLowerCase();
String lowerCase = toComplete.toLowerCase();

if (lstr.equals(str)) {
if (lowerCase.equals(toComplete)) {
// user typed in lower case word -> we do an case-insenstive search
String ender = AbstractAutoCompleter.incrementLastCharacter(lstr);
SortedSet<String> subset = indexCaseInsensitive.subSet(lstr, ender);
String ender = AbstractAutoCompleter.incrementLastCharacter(lowerCase);
SortedSet<String> subset = indexCaseInsensitive.subSet(lowerCase, ender);

// As subset only contains lower case strings,
// we have to to determine possible strings for each hit
ArrayList<String> res = new ArrayList<String>();
ArrayList<String> result = new ArrayList<>();
for (String s : subset) {
res.addAll(possibleStringsForSearchString.get(s));
result.addAll(possibleStringsForSearchString.get(s));
}
return res.toArray(new String[res.size()]);
return result.toArray(new String[result.size()]);
} else {
// user typed in a mix of upper case and lower case,
// we assume user wants to have exact search
String ender = AbstractAutoCompleter.incrementLastCharacter(str);
SortedSet<String> subset = indexCaseSensitive.subSet(str, ender);
String ender = AbstractAutoCompleter.incrementLastCharacter(toComplete);
SortedSet<String> subset = indexCaseSensitive.subSet(toComplete, ender);
return subset.toArray(new String[subset.size()]);
}
}
Expand All @@ -88,13 +88,13 @@ public String[] complete(String str) {
*
* Example: incrementLastCharacter("abc") returns "abd".
*/
private static String incrementLastCharacter(String str) {
char lastChar = str.charAt(str.length() - 1);
return str.substring(0, str.length() - 1) + Character.toString((char) (lastChar + 1));
private static String incrementLastCharacter(String toIncrement) {
char lastChar = toIncrement.charAt(toIncrement.length() - 1);
return toIncrement.substring(0, toIncrement.length() - 1) + Character.toString((char) (lastChar + 1));
}

private static boolean stringMinLength(String str) {
return str.length() < AutoCompleterFactory.SHORTEST_TO_COMPLETE;
private static boolean stringMinLength(String toCheck) {
return toCheck.length() < AutoCompleterFactory.SHORTEST_TO_COMPLETE;
}

public void addWordToIndex(String word) {
Expand All @@ -104,14 +104,14 @@ public void addWordToIndex(String word) {
// insensitive treatment
// first, add the lower cased word to search index
// second, add a mapping from the lower cased word to the real word
String word_lcase = word.toLowerCase();
indexCaseInsensitive.add(word_lcase);
TreeSet<String> set = possibleStringsForSearchString.get(word_lcase);
String lowerCase = word.toLowerCase();
indexCaseInsensitive.add(lowerCase);
TreeSet<String> set = possibleStringsForSearchString.get(lowerCase);
if (set == null) {
set = new TreeSet<String>();
set = new TreeSet<>();
}
set.add(word);
possibleStringsForSearchString.put(word_lcase, set);
possibleStringsForSearchString.put(lowerCase, set);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public interface AutoCompleter {

String getPrefix();

String[] complete(String str);
String[] complete(String toComplete);

boolean indexContainsWord(String word);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (C) 2003-2011 JabRef contributors.
/* Copyright (C) 2003-2015 JabRef contributors.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

class AutoCompleters {

final HashMap<String, AutoCompleter> autoCompleters = new HashMap<String, AutoCompleter>();
final HashMap<String, AutoCompleter> autoCompleters = new HashMap<>();
// Hashtable that holds as keys the names of the fields where
// autocomplete is active, and references to the autocompleter objects.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (C) 2003-2011 JabRef contributors.
/* Copyright (C) 2003-2015 JabRef contributors.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (C) 2003-2012 JabRef contributors.
/* Copyright (C) 2003-2015 JabRef contributors.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (C) 2003-2011 JabRef contributors.
/* Copyright (C) 2003-2015 JabRef contributors.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,15 +135,15 @@ private String determinePrefixAndReturnRemainder(String str, String delimiter) {
}

@Override
public String[] complete(String str) {
public String[] complete(String toComplete) {
// Normally, one would implement that using
// class inheritance. But this seemed overengineered
if (this.lastNameOnlyAndSeparationBySpace) {
str = determinePrefixAndReturnRemainder(str, " ");
toComplete = determinePrefixAndReturnRemainder(toComplete, " ");
} else {
str = determinePrefixAndReturnRemainder(str, " and ");
toComplete = determinePrefixAndReturnRemainder(toComplete, " and ");
}
return super.complete(str);
return super.complete(toComplete);
}

public String getFieldName() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public void setSaveInSpecifiedOrder() {
* Outputs the current configuration to be consumed later by the constructor
*/
public Vector<String> getVector() {
Vector<String> res = new Vector<String>(7);
Vector<String> res = new Vector<>(7);
if (saveInOriginalOrder) {
res.insertElementAt("original", 0);
} else {
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/net/sf/jabref/logic/journals/Abbreviation.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ public boolean hasIsoAndMedlineAbbreviationsAreSame() {
}

@Override
public int compareTo(Abbreviation o) {
return name.compareTo(o.name);
public int compareTo(Abbreviation toCompare) {
return name.compareTo(toCompare.name);
}

public String getNext(String current) {
Expand Down
Loading