From c2fe30e2a54142aa9021b19a23420bccfb1dc77b Mon Sep 17 00:00:00 2001 From: Linus Dietz Date: Fri, 19 Apr 2019 14:35:11 +0200 Subject: [PATCH 1/2] Method names should not start with capital letters --- .../gui/libraryproperties/LibraryPropertiesDialogView.java | 6 +++--- .../libraryproperties/LibraryPropertiesDialogViewModel.java | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/jabref/gui/libraryproperties/LibraryPropertiesDialogView.java b/src/main/java/org/jabref/gui/libraryproperties/LibraryPropertiesDialogView.java index 58002962d84..b4c2a0a4694 100644 --- a/src/main/java/org/jabref/gui/libraryproperties/LibraryPropertiesDialogView.java +++ b/src/main/java/org/jabref/gui/libraryproperties/LibraryPropertiesDialogView.java @@ -72,7 +72,7 @@ private void initialize() { generalFileDirectory.textProperty().bindBidirectional(viewModel.generalFileDirectoryPropertyProperty()); userSpecificFileDirectory.textProperty().bindBidirectional(viewModel.userSpecificFileDirectoryProperty()); - laTexFileDirectory.textProperty().bindBidirectional(viewModel.LaTexFileDirectoryProperty()); + laTexFileDirectory.textProperty().bindBidirectional(viewModel.laTexFileDirectoryProperty()); encoding.itemsProperty().bind(viewModel.encodingsProperty()); encoding.valueProperty().bindBidirectional(viewModel.selectedEncodingProperty()); @@ -142,7 +142,7 @@ private void storeSettings() { metaData.setUserFileDirectory(preferencesService.getUser(), text); } - text = viewModel.LaTexFileDirectoryProperty().getValue(); + text = viewModel.laTexFileDirectoryProperty().getValue(); if (text.isEmpty()) { metaData.clearLaTexFileDirectory(preferencesService.getUser()); } else { @@ -180,7 +180,7 @@ private void storeSettings() { boolean changed = saveOrderConfigChanged || encodingChanged || viewModel.generalFileDirChanged() || viewModel.userFileDirChanged() - || viewModel.protectedValueChanged() || saveActionsChanged || viewModel.LaTexFileDirChanged(); + || viewModel.protectedValueChanged() || saveActionsChanged || viewModel.laTexFileDirChanged(); // ... if so, mark base changed. Prevent the Undo button from removing // change marking: if (changed) { diff --git a/src/main/java/org/jabref/gui/libraryproperties/LibraryPropertiesDialogViewModel.java b/src/main/java/org/jabref/gui/libraryproperties/LibraryPropertiesDialogViewModel.java index e7791d7a534..3206b98be9c 100644 --- a/src/main/java/org/jabref/gui/libraryproperties/LibraryPropertiesDialogViewModel.java +++ b/src/main/java/org/jabref/gui/libraryproperties/LibraryPropertiesDialogViewModel.java @@ -80,7 +80,7 @@ public StringProperty userSpecificFileDirectoryProperty() { return this.userSpecificFileDirectoryProperty; } - public StringProperty LaTexFileDirectoryProperty() { + public StringProperty laTexFileDirectoryProperty() { return this.laTexFileDirectoryProperty; } @@ -116,7 +116,7 @@ public boolean userFileDirChanged() { return !oldUserSpecificFileDir.equals(userSpecificFileDirectoryProperty.getValue()); } - public boolean LaTexFileDirChanged() { + public boolean laTexFileDirChanged() { return !oldLaTexFileDir.equals(laTexFileDirectoryProperty.getValue()); } From bf0b0c63a22b0394cb9a8437e7a62e0423d320a5 Mon Sep 17 00:00:00 2001 From: Linus Dietz Date: Fri, 19 Apr 2019 14:40:14 +0200 Subject: [PATCH 2/2] Avoid empty if statements --- .../logic/auxparser/DefaultAuxParser.java | 30 ++++++++----------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/src/main/java/org/jabref/logic/auxparser/DefaultAuxParser.java b/src/main/java/org/jabref/logic/auxparser/DefaultAuxParser.java index 054230c730b..8c4ea858ad7 100644 --- a/src/main/java/org/jabref/logic/auxparser/DefaultAuxParser.java +++ b/src/main/java/org/jabref/logic/auxparser/DefaultAuxParser.java @@ -24,16 +24,13 @@ /** * LaTeX Aux to BibTeX Parser *

- * Extracts a subset of BibTeX entries from a BibDatabase that are included in an AUX file. - * Also supports nested AUX files (latex \\include). + * Extracts a subset of BibTeX entries from a BibDatabase that are included in an AUX file. Also supports nested AUX + * files (latex \\include). * - * There exists no specification of the AUX file. - * Every package, class or document can write to the AUX file. - * The AUX file consists of LaTeX macros and is read at the \begin{document} and again at the \end{document}. + * There exists no specification of the AUX file. Every package, class or document can write to the AUX file. The AUX + * file consists of LaTeX macros and is read at the \begin{document} and again at the \end{document}. * - * BibTeX citation: \citation{x,y,z} - * Biblatex citation: \abx@aux@cite{x,y,z} - * Nested AUX files: \@input{x} + * BibTeX citation: \citation{x,y,z} Biblatex citation: \abx@aux@cite{x,y,z} Nested AUX files: \@input{x} */ public class DefaultAuxParser implements AuxParser { private static final Logger LOGGER = LoggerFactory.getLogger(DefaultAuxParser.class); @@ -128,15 +125,14 @@ private void matchCitation(AuxParserResult result, String line) { */ private void resolveTags(AuxParserResult result) { for (String key : result.getUniqueKeys()) { - Optional entry = masterDatabase.getEntryByKey(key); - - if (result.getGeneratedBibDatabase().getEntryByKey(key).isPresent()) { - // do nothing, key has already been processed - } else if (entry.isPresent()) { - insertEntry(entry.get(), result); - resolveCrossReferences(entry.get(), result); - } else { - result.getUnresolvedKeys().add(key); + if (!result.getGeneratedBibDatabase().getEntryByKey(key).isPresent()) { + Optional entry = masterDatabase.getEntryByKey(key); + if (entry.isPresent()) { + insertEntry(entry.get(), result); + resolveCrossReferences(entry.get(), result); + } else { + result.getUnresolvedKeys().add(key); + } } }