Skip to content

Commit

Permalink
Minor code inspection
Browse files Browse the repository at this point in the history
  • Loading branch information
stefan-kolb committed Mar 22, 2016
1 parent 8c208a0 commit 144c03c
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions src/main/java/net/sf/jabref/gui/entryeditor/EntryEditor.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import java.beans.PropertyChangeEvent;
import java.beans.VetoableChangeListener;
import java.io.IOException;
import java.io.StringReader;
import java.io.StringWriter;
import java.util.*;
import java.util.stream.Collectors;
Expand Down Expand Up @@ -729,8 +730,7 @@ public synchronized void switchTo(BibEntry switchEntry) {
}

private boolean storeSource() {
// Store edited bibtex code.
BibtexParser bibtexParser = new BibtexParser(new java.io.StringReader(source.getText()));
BibtexParser bibtexParser = new BibtexParser(new StringReader(source.getText()));

try {
ParserResult parserResult = bibtexParser.parse();
Expand All @@ -750,7 +750,7 @@ private boolean storeSource() {
}

NamedCompound compound = new NamedCompound(Localization.lang("source edit"));
BibEntry newEntry = database.getEntries().iterator().next();
BibEntry newEntry = database.getEntries().get(0);
String newKey = newEntry.getCiteKey();
boolean anyChanged = false;
boolean changedType = false;
Expand Down Expand Up @@ -787,8 +787,7 @@ private boolean storeSource() {

// See if the user has changed the entry type:
if (newEntry.getType() != entry.getType()) {
compound.addEdit(new UndoableChangeType(entry,
entry.getType(), newEntry.getType()));
compound.addEdit(new UndoableChangeType(entry, entry.getType(), newEntry.getType()));
entry.setType(newEntry.getType());
anyChanged = true;
changedType = true;
Expand All @@ -810,13 +809,11 @@ private boolean storeSource() {
}

lastSourceStringAccepted = source.getText();
if (changedType) {
panel.updateEntryEditorIfShowing();
} else {
updateAllFields();
lastSourceAccepted = true;
updateSource = true;
}
// Update UI
// TODO: we need to repaint if fields that are not displayed have been added
panel.updateEntryEditorIfShowing();
lastSourceAccepted = true;
updateSource = true;
// TODO: does updating work properly after source stored?
panel.markBaseChanged();

Expand Down

0 comments on commit 144c03c

Please sign in to comment.