Skip to content

Commit ebd521d

Browse files
committed
Merge pull request #93 from lenhard/logic-improvements
Logic improvements (Java 1.7+)
2 parents 56a8c70 + 2f6fbab commit ebd521d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+913
-1255
lines changed

CHANGELOG

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
[master]
2+
- Perform syntax improvements enabled by Java 1.7+ (diamond operator, try-with-resources)
23
- List of authors is now auto generated `scripts/generate-authors.sh` and inserted into L10N About.html
34
- Remove Mr.DLib support as MR.DLib will be shut down in 2015
45
- Streamline logging API: Replace usages of java.util.logging with commons.logging

src/main/java/net/sf/jabref/CustomEntryType.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public class CustomEntryType extends BibtexEntryType {
4242

4343

4444
public CustomEntryType(String name_, String[] req_, String[] priOpt_, String[] secOpt_) {
45-
name = StringUtil.nCase(name_);
45+
name = StringUtil.capitalizeFirst(name_);
4646
parseRequiredFields(req_);
4747
priOpt = priOpt_;
4848
opt = Util.arrayConcat(priOpt_, secOpt_);
@@ -53,7 +53,7 @@ public CustomEntryType(String name_, String[] req_, String[] opt_) {
5353
}
5454

5555
private CustomEntryType(String name_, String reqStr, String optStr) {
56-
name = StringUtil.nCase(name_);
56+
name = StringUtil.capitalizeFirst(name_);
5757
if (reqStr.isEmpty()) {
5858
req = new String[0];
5959
} else {

src/main/java/net/sf/jabref/EntryTypeDialog.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ public void windowClosing(WindowEvent e) {
103103

104104
for (BibtexEntryType tp : BibtexEntryType.getAllValues()) {
105105
if (tp.isVisibleAtNewEntryDialog()) {
106-
TypeButton b = new TypeButton(StringUtil.nCase(tp.getName()), tp);
106+
TypeButton b = new TypeButton(StringUtil.capitalizeFirst(tp.getName()), tp);
107107
b.addActionListener(this);
108108
// Check if we should finish the row.
109109
col++;

src/main/java/net/sf/jabref/JabRefFrame.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
import java.awt.event.WindowEvent;
3636
import java.io.File;
3737
import java.io.IOException;
38-
import java.lang.reflect.Method;
3938
import java.net.URL;
4039
import java.util.ArrayList;
4140
import java.util.Arrays;
@@ -1233,13 +1232,13 @@ public NewEntryAction(KeyStroke key) {
12331232

12341233
public NewEntryAction(String type_) {
12351234
// This action leads to the creation of a specific entry.
1236-
putValue(Action.NAME, StringUtil.nCase(type_));
1235+
putValue(Action.NAME, StringUtil.capitalizeFirst(type_));
12371236
type = type_;
12381237
}
12391238

12401239
public NewEntryAction(String type_, KeyStroke key) {
12411240
// This action leads to the creation of a specific entry.
1242-
putValue(Action.NAME, StringUtil.nCase(type_));
1241+
putValue(Action.NAME, StringUtil.capitalizeFirst(type_));
12431242
putValue(Action.ACCELERATOR_KEY, key);
12441243
type = type_;
12451244
}
@@ -2558,7 +2557,7 @@ class EditAction extends MnemonicAwareAction {
25582557
public EditAction(String command, URL icon) {
25592558
super(new ImageIcon(icon));
25602559
this.command = command;
2561-
String nName = StringUtil.nCase(command);
2560+
String nName = StringUtil.capitalizeFirst(command);
25622561
putValue(Action.NAME, nName);
25632562
putValue(Action.ACCELERATOR_KEY, prefs.getKey(nName));
25642563
putValue(Action.SHORT_DESCRIPTION, Globals.lang(nName));

src/main/java/net/sf/jabref/JabRefPreferences.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1383,10 +1383,10 @@ public CustomEntryType getCustomEntryType(int number) {
13831383
return null;
13841384
}
13851385
if (priOpt == null) {
1386-
return new CustomEntryType(StringUtil.nCase(name), req, opt);
1386+
return new CustomEntryType(StringUtil.capitalizeFirst(name), req, opt);
13871387
}
13881388
String[] secOpt = Util.getRemainder(opt, priOpt);
1389-
return new CustomEntryType(StringUtil.nCase(name), req, priOpt, secOpt);
1389+
return new CustomEntryType(StringUtil.capitalizeFirst(name), req, priOpt, secOpt);
13901390

13911391
}
13921392

src/main/java/net/sf/jabref/gui/AttachFileDialog.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,8 @@ public void actionPerformed(ActionEvent event) {
140140

141141
FormLayout layout = new FormLayout("fill:160dlu, 4dlu, fill:pref", "");
142142
DefaultFormBuilder builder = new DefaultFormBuilder(layout);
143-
//builder.append(Util.nCase(fieldName));//(editor.getLabel());
144-
builder.appendSeparator(StringUtil.nCase(fieldName));
143+
//builder.append(Util.capitalizeFirst(fieldName));//(editor.getLabel());
144+
builder.appendSeparator(StringUtil.capitalizeFirst(fieldName));
145145
builder.append(editor.getTextComponent());
146146
builder.append(browse);
147147

src/main/java/net/sf/jabref/gui/EntryCustomizationDialog2.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ private void applyChanges() {
268268
if (defaulted.contains(stringListEntry.getKey())) {
269269
// This type should be reverted to its default setup.
270270
//System.out.println("Defaulting: "+typeName);
271-
String nm = StringUtil.nCase(stringListEntry.getKey());
271+
String nm = StringUtil.capitalizeFirst(stringListEntry.getKey());
272272
BibtexEntryType.removeType(nm);
273273

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

300300
BibtexEntryType.addOrModifyCustomEntryType(typ);
301301
updateTypesForEntries(typ.getName());
@@ -329,14 +329,14 @@ private void typeDeletion(String name) {
329329
+ "type will be declared "
330330
+ "typeless. Continue?"),
331331
Globals.lang("Delete custom format") +
332-
" '" + StringUtil.nCase(name) + '\'', JOptionPane.YES_NO_OPTION,
332+
" '" + StringUtil.capitalizeFirst(name) + '\'', JOptionPane.YES_NO_OPTION,
333333
JOptionPane.WARNING_MESSAGE);
334334
if (reply != JOptionPane.YES_OPTION) {
335335
return;
336336
}
337337
}
338338
BibtexEntryType.removeType(name);
339-
updateTypesForEntries(StringUtil.nCase(name));
339+
updateTypesForEntries(StringUtil.capitalizeFirst(name));
340340
changed.remove(name);
341341
reqLists.remove(name);
342342
optLists.remove(name);

src/main/java/net/sf/jabref/gui/ImportInspectionDialog.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1522,7 +1522,7 @@ public String getColumnName(int i) {
15221522
return Globals.lang("Keep");
15231523
}
15241524
if (i >= PAD) {
1525-
return StringUtil.nCase(fields[i - PAD]);
1525+
return StringUtil.capitalizeFirst(fields[i - PAD]);
15261526
}
15271527
return "";
15281528
}

src/main/java/net/sf/jabref/gui/MainTableFormat.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ public String getColumnName(int col) {
118118
if (disName != null) {
119119
sb.append(disName);
120120
} else {
121-
sb.append(StringUtil.nCase(fld[i]));
121+
sb.append(StringUtil.capitalizeFirst(fld[i]));
122122
}
123123
}
124124
return sb.toString();
@@ -128,7 +128,7 @@ public String getColumnName(int col) {
128128
return disName ;
129129
} */
130130
}
131-
//return Util.nCase(columns[col - padleft]);
131+
//return Util.capitalizeFirst(columns[col - padleft]);
132132
}
133133

134134
/**

src/main/java/net/sf/jabref/gui/SearchResultsDialog.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,7 @@ public int getColumnCount() {
464464
@Override
465465
public String getColumnName(int column) {
466466
if (column >= PAD) {
467-
return StringUtil.nCase(fields[column - PAD]);
467+
return StringUtil.capitalizeFirst(fields[column - PAD]);
468468
} else {
469469
return "";
470470
}

0 commit comments

Comments
 (0)