From 7abe62c6ca6a4d7763e224c5ee6a9eac344701c4 Mon Sep 17 00:00:00 2001 From: Linus Dietz Date: Tue, 20 Feb 2018 14:30:03 +0100 Subject: [PATCH 01/19] Avoid unused local variables such as 'focused'. --- src/main/java/org/jabref/gui/BasePanel.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/main/java/org/jabref/gui/BasePanel.java b/src/main/java/org/jabref/gui/BasePanel.java index dc098bb6d13..346a50eaef5 100644 --- a/src/main/java/org/jabref/gui/BasePanel.java +++ b/src/main/java/org/jabref/gui/BasePanel.java @@ -2188,8 +2188,6 @@ private class RedoAction implements BaseAction { @Override public void action() { try { - - JComponent focused = Globals.getFocusListener().getFocused(); getUndoManager().redo(); markBaseChanged(); frame.output(Localization.lang("Redo")); From 658ca4d11c5853a4df08b29f61bba2c86a3ff1d4 Mon Sep 17 00:00:00 2001 From: Linus Dietz Date: Tue, 20 Feb 2018 14:32:16 +0100 Subject: [PATCH 02/19] Avoid unused local variables --- .../org/jabref/gui/groups/GroupTreeViewModel.java | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/main/java/org/jabref/gui/groups/GroupTreeViewModel.java b/src/main/java/org/jabref/gui/groups/GroupTreeViewModel.java index a4e2889b9e7..dbb16cc9473 100644 --- a/src/main/java/org/jabref/gui/groups/GroupTreeViewModel.java +++ b/src/main/java/org/jabref/gui/groups/GroupTreeViewModel.java @@ -25,7 +25,6 @@ import org.jabref.gui.StateManager; import org.jabref.gui.util.TaskExecutor; import org.jabref.logic.l10n.Localization; -import org.jabref.model.FieldChange; import org.jabref.model.database.BibDatabaseContext; import org.jabref.model.entry.BibEntry; import org.jabref.model.groups.AbstractGroup; @@ -136,7 +135,7 @@ public void addNewSubgroup(GroupNodeViewModel parent) { SwingUtilities.invokeLater(() -> { Optional newGroup = dialogService.showCustomDialogAndWait(new GroupDialog()); newGroup.ifPresent(group -> { - GroupTreeNode newGroupNode = parent.addSubgroup(group); + parent.addSubgroup(group); // TODO: Add undo //UndoableAddOrRemoveGroup undo = new UndoableAddOrRemoveGroup(parent, new GroupTreeNodeViewModel(newGroupNode), UndoableAddOrRemoveGroup.ADD_NODE); @@ -173,7 +172,7 @@ public void editGroup(GroupNodeViewModel oldGroup) { boolean removePreviousAssignents = (oldGroup.getGroupNode().getGroup() instanceof ExplicitGroup) && (group instanceof ExplicitGroup); - List addChange = oldGroup.getGroupNode().setGroup( + oldGroup.getGroupNode().setGroup( group, keepPreviousAssignments, removePreviousAssignents, @@ -259,7 +258,7 @@ public void removeGroupAndSubgroups(GroupNodeViewModel group) { } void removeGroupsAndSubGroupsFromEntries(GroupNodeViewModel group) { - for (GroupNodeViewModel child: group.getChildren()) { + for (GroupNodeViewModel child : group.getChildren()) { removeGroupsAndSubGroupsFromEntries(child); } @@ -275,7 +274,7 @@ public void addSelectedEntries(GroupNodeViewModel group) { // if (!WarnAssignmentSideEffects.warnAssignmentSideEffects(node.getNode().getGroup(), panel.frame())) { // return; // user aborted operation - List addChange = group.getGroupNode().addEntriesToGroup(stateManager.getSelectedEntries()); + group.getGroupNode().addEntriesToGroup(stateManager.getSelectedEntries()); // TODO: Add undo // NamedCompound undoAll = new NamedCompound(Localization.lang("change assignment of entries")); @@ -303,7 +302,7 @@ public void removeSelectedEntries(GroupNodeViewModel group) { // if (!WarnAssignmentSideEffects.warnAssignmentSideEffects(mNode.getNode().getGroup(), mPanel.frame())) { // return; // user aborted operation - List removeChange = group.getGroupNode().removeEntriesFromGroup(stateManager.getSelectedEntries()); + group.getGroupNode().removeEntriesFromGroup(stateManager.getSelectedEntries()); // TODO: Add undo // if (!undo.isEmpty()) { @@ -312,6 +311,5 @@ public void removeSelectedEntries(GroupNodeViewModel group) { public void sortAlphabeticallyRecursive(GroupNodeViewModel group) { group.getGroupNode().sortChildren(compAlphabetIgnoreCase, true); - } } From 81a534c829dc4f9c7bc9aead4af109b29360f004 Mon Sep 17 00:00:00 2001 From: Linus Dietz Date: Tue, 20 Feb 2018 14:32:54 +0100 Subject: [PATCH 03/19] Avoid unused local variables such as 'prefs'. --- src/main/java/org/jabref/migrations/PreferencesMigrations.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/main/java/org/jabref/migrations/PreferencesMigrations.java b/src/main/java/org/jabref/migrations/PreferencesMigrations.java index 81c2ae2cda0..27c24356766 100644 --- a/src/main/java/org/jabref/migrations/PreferencesMigrations.java +++ b/src/main/java/org/jabref/migrations/PreferencesMigrations.java @@ -31,8 +31,6 @@ private PreferencesMigrations() { * Migrate all preferences from net/sf/jabref to org/jabref */ public static void upgradePrefsToOrgJabRef() { - - JabRefPreferences prefs = Globals.prefs; Preferences mainPrefsNode = Preferences.userNodeForPackage(JabRefMain.class); try { if (mainPrefsNode.childrenNames().length != 0) { From 758b1f5bfacbd078fb66ec32c6879b8d2dc80794 Mon Sep 17 00:00:00 2001 From: Linus Dietz Date: Tue, 20 Feb 2018 14:34:54 +0100 Subject: [PATCH 04/19] Avoid unused local variables such as 'textSize'. --- .../migrations/PreferencesMigrations.java | 21 ++++++++----------- .../GrammarBasedSearchRuleDescriberTest.java | 8 ------- 2 files changed, 9 insertions(+), 20 deletions(-) diff --git a/src/main/java/org/jabref/migrations/PreferencesMigrations.java b/src/main/java/org/jabref/migrations/PreferencesMigrations.java index 27c24356766..30c6a8066f9 100644 --- a/src/main/java/org/jabref/migrations/PreferencesMigrations.java +++ b/src/main/java/org/jabref/migrations/PreferencesMigrations.java @@ -171,7 +171,6 @@ public static void upgradeLabelPatternToBibtexKeyPattern() { prefs.put(JabRefPreferences.DEFAULT_BIBTEX_KEY_PATTERN, oldDefault); LOGGER.info("Upgraded old default key generator pattern '" + oldDefault + "' to new version."); } - } //Pref node already exists do not migrate from previous version if (mainPrefsNode.nodeExists(JabRefPreferences.BIBTEX_KEY_PATTERNS_NODE)) { @@ -196,16 +195,16 @@ public static void upgradeLabelPatternToBibtexKeyPattern() { * Migrate Import File Name and Directory name Patterns from versions <=4.0 to new BracketedPatterns */ private static void migrateFileImportPattern(String oldStylePattern, String newStylePattern, - JabRefPreferences prefs, Preferences mainPrefsNode) { + JabRefPreferences prefs, Preferences mainPrefsNode) { String preferenceFileNamePattern = mainPrefsNode.get(JabRefPreferences.IMPORT_FILENAMEPATTERN, null); if (preferenceFileNamePattern != null && - oldStylePattern.equals(preferenceFileNamePattern)) { + oldStylePattern.equals(preferenceFileNamePattern)) { // Upgrade the old-style File Name pattern to new one: mainPrefsNode.put(JabRefPreferences.IMPORT_FILENAMEPATTERN, newStylePattern); LOGGER.info("migrated old style " + JabRefPreferences.IMPORT_FILENAMEPATTERN + - " value \"" + oldStylePattern + "\" to new value \"" + - newStylePattern + "\" in the preference file"); + " value \"" + oldStylePattern + "\" to new value \"" + + newStylePattern + "\" in the preference file"); if (prefs.hasKey(JabRefPreferences.IMPORT_FILENAMEPATTERN)) { // Update also the key in the current application settings, if necessary: @@ -213,8 +212,8 @@ private static void migrateFileImportPattern(String oldStylePattern, String newS if (oldStylePattern.equals(fileNamePattern)) { prefs.put(JabRefPreferences.IMPORT_FILENAMEPATTERN, newStylePattern); LOGGER.info("migrated old style " + JabRefPreferences.IMPORT_FILENAMEPATTERN + - " value \"" + oldStylePattern + "\" to new value \"" + - newStylePattern + "\" in the running application"); + " value \"" + oldStylePattern + "\" to new value \"" + + newStylePattern + "\" in the running application"); } } } @@ -229,9 +228,9 @@ public static void upgradeImportFileAndDirePatterns() { // Check for prefs node for Version <= 4.0 if (mainPrefsNode.get(JabRefPreferences.IMPORT_FILENAMEPATTERN, null) != null) { - String[] oldStylePatterns = new String[] {"\\bibtexkey", + String[] oldStylePatterns = new String[]{"\\bibtexkey", "\\bibtexkey\\begin{title} - \\format[RemoveBrackets]{\\title}\\end{title}"}; - String[] newStylePatterns = new String[] {"[bibtexkey]", + String[] newStylePatterns = new String[]{"[bibtexkey]", "[bibtexkey] - [fulltitle]"}; for (int i = 0; i < oldStylePatterns.length; i++) { migrateFileImportPattern(oldStylePatterns[i], newStylePatterns[i], prefs, mainPrefsNode); @@ -255,7 +254,6 @@ public static void upgradeKeyBindingsToJavaFX() { List keys = prefs.getStringList(JabRefPreferences.BINDINGS); keys.replaceAll(replaceKeys); prefs.putStringList(JabRefPreferences.BINDINGS, keys); - } public static void addCrossRefRelatedFieldsForAutoComplete() { @@ -284,7 +282,7 @@ public static void upgradeObsoleteLookAndFeels() { JabRefPreferences prefs = Globals.prefs; String currentLandF = prefs.get(JabRefPreferences.WIN_LOOK_AND_FEEL); if ("com.jgoodies.looks.windows.WindowsLookAndFeel".equals(currentLandF) || - "com.jgoodies.plaf.plastic.Plastic3DLookAndFeel".equals(currentLandF) ) { + "com.jgoodies.plaf.plastic.Plastic3DLookAndFeel".equals(currentLandF)) { if (OS.WINDOWS) { String windowsLandF = "com.sun.java.swing.plaf.windows.WindowsLookAndFeel"; prefs.put(JabRefPreferences.WIN_LOOK_AND_FEEL, windowsLandF); @@ -296,5 +294,4 @@ public static void upgradeObsoleteLookAndFeels() { } } } - } diff --git a/src/test/java/org/jabref/gui/search/GrammarBasedSearchRuleDescriberTest.java b/src/test/java/org/jabref/gui/search/GrammarBasedSearchRuleDescriberTest.java index 451be0e80b0..47152884ce5 100644 --- a/src/test/java/org/jabref/gui/search/GrammarBasedSearchRuleDescriberTest.java +++ b/src/test/java/org/jabref/gui/search/GrammarBasedSearchRuleDescriberTest.java @@ -25,7 +25,6 @@ private TextFlow createDescription(String query, boolean caseSensitive, boolean @Test public void testSimpleQueryCaseSensitiveRegex() { - double textSize = 13; String query = "a=b"; List expectedTexts = Arrays.asList(TooltipTextUtil.createText("This search contains entries in which "), TooltipTextUtil.createText("the field "), TooltipTextUtil.createText("a", TooltipTextUtil.TextType.BOLD), TooltipTextUtil.createText(" contains the regular expression "), TooltipTextUtil.createText("b", TooltipTextUtil.TextType.BOLD), TooltipTextUtil.createText(". "), @@ -37,7 +36,6 @@ public void testSimpleQueryCaseSensitiveRegex() { @Test public void testSimpleQueryCaseSensitive() { - double textSize = 13; String query = "a=b"; List expectedTexts = Arrays.asList(TooltipTextUtil.createText("This search contains entries in which "), TooltipTextUtil.createText("the field "), TooltipTextUtil.createText("a", TooltipTextUtil.TextType.BOLD), TooltipTextUtil.createText(" contains the term "), TooltipTextUtil.createText("b", TooltipTextUtil.TextType.BOLD), TooltipTextUtil.createText(". "), @@ -49,7 +47,6 @@ public void testSimpleQueryCaseSensitive() { @Test public void testSimpleQuery() { - double textSize = 13; String query = "a=b"; List expectedTexts = Arrays.asList(TooltipTextUtil.createText("This search contains entries in which "), TooltipTextUtil.createText("the field "), TooltipTextUtil.createText("a", TooltipTextUtil.TextType.BOLD), TooltipTextUtil.createText(" contains the term "), TooltipTextUtil.createText("b", TooltipTextUtil.TextType.BOLD), TooltipTextUtil.createText(". "), @@ -61,7 +58,6 @@ public void testSimpleQuery() { @Test public void testSimpleQueryRegex() { - double textSize = 13; String query = "a=b"; List expectedTexts = Arrays.asList(TooltipTextUtil.createText("This search contains entries in which "), TooltipTextUtil.createText("the field "), TooltipTextUtil.createText("a", TooltipTextUtil.TextType.BOLD), TooltipTextUtil.createText(" contains the regular expression "), TooltipTextUtil.createText("b", TooltipTextUtil.TextType.BOLD), TooltipTextUtil.createText(". "), @@ -73,7 +69,6 @@ public void testSimpleQueryRegex() { @Test public void testComplexQueryCaseSensitiveRegex() { - double textSize = 13; String query = "not a=b and c=e or e=\"x\""; List expectedTexts = Arrays.asList(TooltipTextUtil.createText("This search contains entries in which "), TooltipTextUtil.createText("not "), TooltipTextUtil.createText("the field "), TooltipTextUtil.createText("a", TooltipTextUtil.TextType.BOLD), TooltipTextUtil.createText(" contains the regular expression "), TooltipTextUtil.createText("b", TooltipTextUtil.TextType.BOLD), TooltipTextUtil.createText(" and "), TooltipTextUtil.createText("the field "), TooltipTextUtil.createText("c", TooltipTextUtil.TextType.BOLD), TooltipTextUtil.createText(" contains the regular expression "), @@ -86,7 +81,6 @@ public void testComplexQueryCaseSensitiveRegex() { @Test public void testComplexQueryRegex() { - double textSize = 13; String query = "not a=b and c=e or e=\"x\""; List expectedTexts = Arrays.asList(TooltipTextUtil.createText("This search contains entries in which "), TooltipTextUtil.createText("not "), TooltipTextUtil.createText("the field "), TooltipTextUtil.createText("a", TooltipTextUtil.TextType.BOLD), TooltipTextUtil.createText(" contains the regular expression "), TooltipTextUtil.createText("b", TooltipTextUtil.TextType.BOLD), TooltipTextUtil.createText(" and "), TooltipTextUtil.createText("the field "), TooltipTextUtil.createText("c", TooltipTextUtil.TextType.BOLD), TooltipTextUtil.createText(" contains the regular expression "), @@ -99,7 +93,6 @@ public void testComplexQueryRegex() { @Test public void testComplexQueryCaseSensitive() { - double textSize = 13; String query = "not a=b and c=e or e=\"x\""; List expectedTexts = Arrays.asList(TooltipTextUtil.createText("This search contains entries in which "), TooltipTextUtil.createText("not "), TooltipTextUtil.createText("the field "), TooltipTextUtil.createText("a", TooltipTextUtil.TextType.BOLD), TooltipTextUtil.createText(" contains the term "), TooltipTextUtil.createText("b", TooltipTextUtil.TextType.BOLD), TooltipTextUtil.createText(" and "), TooltipTextUtil.createText("the field "), TooltipTextUtil.createText("c", TooltipTextUtil.TextType.BOLD), TooltipTextUtil.createText(" contains the term "), TooltipTextUtil.createText("e", TooltipTextUtil.TextType.BOLD), @@ -111,7 +104,6 @@ public void testComplexQueryCaseSensitive() { @Test public void testComplexQuery() { - double textSize = 13; String query = "not a=b and c=e or e=\"x\""; List expectedTexts = Arrays.asList(TooltipTextUtil.createText("This search contains entries in which "), TooltipTextUtil.createText("not "), TooltipTextUtil.createText("the field "), TooltipTextUtil.createText("a", TooltipTextUtil.TextType.BOLD), TooltipTextUtil.createText(" contains the term "), TooltipTextUtil.createText("b", TooltipTextUtil.TextType.BOLD), TooltipTextUtil.createText(" and "), TooltipTextUtil.createText("the field "), TooltipTextUtil.createText("c", TooltipTextUtil.TextType.BOLD), TooltipTextUtil.createText(" contains the term "), TooltipTextUtil.createText("e", TooltipTextUtil.TextType.BOLD), From 238d34ebddd904049d203381eef795e209251b3c Mon Sep 17 00:00:00 2001 From: Linus Dietz Date: Tue, 20 Feb 2018 14:39:50 +0100 Subject: [PATCH 05/19] Avoid unused local variables --- .../formatter/bibtexfields/RegexFormatterTest.java | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/test/java/org/jabref/logic/formatter/bibtexfields/RegexFormatterTest.java b/src/test/java/org/jabref/logic/formatter/bibtexfields/RegexFormatterTest.java index a01e31f1bdc..58f3d4bd751 100644 --- a/src/test/java/org/jabref/logic/formatter/bibtexfields/RegexFormatterTest.java +++ b/src/test/java/org/jabref/logic/formatter/bibtexfields/RegexFormatterTest.java @@ -20,41 +20,40 @@ public void setUp() { @Test public void spacesReplacedCorrectly() { String regexInput = "(\" \",\"-\")"; - formatter.setRegex(regexInput); + RegexFormatter.setRegex(regexInput); assertEquals("replace-all-spaces", formatter.format("replace all spaces")); } @Test public void protectedSpacesNotReplacedInSingleProtectedBlock() { String regexInput = "(\" \",\"-\")"; - formatter.setRegex(regexInput); + RegexFormatter.setRegex(regexInput); assertEquals("replace-spaces-{not these ones}", formatter.format("replace spaces {not these ones}")); } @Test public void protectedSpacesNotReplacedInTwoProtectedBlocks() { String regexInput = "(\" \",\"-\")"; - formatter.setRegex(regexInput); + RegexFormatter.setRegex(regexInput); assertEquals("replace-spaces-{not these ones}-{or these ones}-but-these-ones", formatter.format("replace spaces {not these ones} {or these ones} but these ones")); } @Test public void escapedBracesAreNotReplaced() { String regexInput = "(\" \",\"-\")"; - formatter.setRegex(regexInput); + RegexFormatter.setRegex(regexInput); assertEquals("replace-spaces-\\{-these-ones\\}-and-these-ones", formatter.format("replace spaces \\{ these ones\\} and these ones")); } @Test public void escapedBracesAreNotReplacedInTwoCases() { String regexInput = "(\" \",\"-\")"; - formatter.setRegex(regexInput); + RegexFormatter.setRegex(regexInput); assertEquals("replace-spaces-\\{-these-ones\\},-these-ones,-and-\\{-these-ones\\}", formatter.format("replace spaces \\{ these ones\\}, these ones, and \\{ these ones\\}")); } @Test public void escapedBracesAreNotReplacedAndProtectionStillWorks() { - String regexInput = "(\" \",\"-\")"; assertEquals("replace-spaces-{not these ones},-these-ones,-and-\\{-these-ones\\}", formatter.format("replace spaces {not these ones}, these ones, and \\{ these ones\\}")); } @@ -62,6 +61,4 @@ public void escapedBracesAreNotReplacedAndProtectionStillWorks() { public void formatExample() { assertEquals("Please-replace-the-spaces", formatter.format(formatter.getExampleInput())); } - - } From fa644042f199bc988f417aa99a85f0ea7be0debc Mon Sep 17 00:00:00 2001 From: Linus Dietz Date: Tue, 20 Feb 2018 14:40:01 +0100 Subject: [PATCH 06/19] Avoid unused private fields --- src/main/java/org/jabref/gui/IconTheme.java | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/src/main/java/org/jabref/gui/IconTheme.java b/src/main/java/org/jabref/gui/IconTheme.java index 249e40ccc3f..3ae66c74eb5 100644 --- a/src/main/java/org/jabref/gui/IconTheme.java +++ b/src/main/java/org/jabref/gui/IconTheme.java @@ -49,19 +49,9 @@ public class IconTheme { private static final Map KEY_TO_ICON = readIconThemeFile( IconTheme.class.getResource("/images/Icons.properties"), "/images/external/"); - // Christmas edition - //public static final Color DEFAULT_COLOR = new Color(0x155115); - //public static final Color DEFAULT_DISABLED_COLOR = new Color(0x990000); - private static Font FONT_16; - private static javafx.scene.text.Font FX_FONT; - static { try (InputStream stream = getMaterialDesignIconsStream()) { FONT = Font.createFont(Font.TRUETYPE_FONT, stream); - FONT_16 = FONT.deriveFont(Font.PLAIN, 16f); - try (InputStream stream2 = getMaterialDesignIconsStream()) { - FX_FONT = javafx.scene.text.Font.loadFont(stream2, JabRefPreferences.getInstance().getInt(JabRefPreferences.ICON_SIZE_LARGE)); - } } catch (FontFormatException | IOException e) { LOGGER.warn("Error loading font", e); } @@ -90,14 +80,14 @@ public static Image getJabRefImageFX() { return getImageFX("jabrefIcon48"); } - /** + /* * Constructs an {@link Image} for the image representing the given function, in the resource * file listing images. * * @param name The name of the icon, such as "open", "save", "saveAs" etc. * @return The {@link Image} for the function. */ - public static Image getImageFX(String name) { + private static Image getImageFX(String name) { return new Image(getIconUrl(name).toString()); } @@ -297,10 +287,6 @@ public FontBasedIcon getIcon() { return new FontBasedIcon(this.unicode, this.color); } - public List getUnderlyingIcons() { - return icons; - } - public MaterialDesignIcon getUnderlyingIcon() { return icons.get(0); } From cebb122c1a3a3c50057ba74518f41c96eb60b9c5 Mon Sep 17 00:00:00 2001 From: Linus Dietz Date: Tue, 20 Feb 2018 14:43:57 +0100 Subject: [PATCH 07/19] remove obsolete parameter --- src/main/java/org/jabref/gui/collab/ChangeScanner.java | 2 +- .../org/jabref/gui/collab/MetaDataChangeViewModel.java | 7 +------ 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/src/main/java/org/jabref/gui/collab/ChangeScanner.java b/src/main/java/org/jabref/gui/collab/ChangeScanner.java index 0353f50ef1e..3514a888d03 100644 --- a/src/main/java/org/jabref/gui/collab/ChangeScanner.java +++ b/src/main/java/org/jabref/gui/collab/ChangeScanner.java @@ -133,7 +133,7 @@ public void run() { // Start looking at changes. BibDatabaseDiff differences = BibDatabaseDiff.compare(databaseInTemp, databaseOnDisk); differences.getMetaDataDifferences().ifPresent(diff -> { - changes.add(new MetaDataChangeViewModel(metadataInMemory, diff)); + changes.add(new MetaDataChangeViewModel(diff)); diff.getGroupDifferences().ifPresent(groupDiff -> changes.add(new GroupChangeViewModel(groupDiff))); }); differences.getPreambleDifferences().ifPresent(diff -> changes.add(new PreambleChangeViewModel(databaseInMemory.getDatabase().getPreamble().orElse(""), diff))); diff --git a/src/main/java/org/jabref/gui/collab/MetaDataChangeViewModel.java b/src/main/java/org/jabref/gui/collab/MetaDataChangeViewModel.java index 307fba9f4a0..7418ff1695f 100644 --- a/src/main/java/org/jabref/gui/collab/MetaDataChangeViewModel.java +++ b/src/main/java/org/jabref/gui/collab/MetaDataChangeViewModel.java @@ -10,19 +10,14 @@ import org.jabref.model.database.BibDatabase; import org.jabref.model.metadata.MetaData; -/** - * - */ class MetaDataChangeViewModel extends ChangeViewModel { private final InfoPane infoPane = new InfoPane(); private final JScrollPane sp = new JScrollPane(infoPane); - private final MetaData originalMetaData; private final MetaData newMetaData; - public MetaDataChangeViewModel(MetaData originalMetaData, MetaDataDiff metaDataDiff) { + public MetaDataChangeViewModel(MetaDataDiff metaDataDiff) { super(Localization.lang("Metadata change")); - this.originalMetaData = originalMetaData; this.newMetaData = metaDataDiff.getNewMetaData(); infoPane.setText("" + Localization.lang("Metadata change") + ""); From ce2c108290fb6826418a301e68a635337d57dd3b Mon Sep 17 00:00:00 2001 From: Linus Dietz Date: Tue, 20 Feb 2018 14:45:03 +0100 Subject: [PATCH 08/19] Avoid unused private fields such as 'frame'. --- src/main/java/org/jabref/gui/exporter/CustomExportDialog.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/main/java/org/jabref/gui/exporter/CustomExportDialog.java b/src/main/java/org/jabref/gui/exporter/CustomExportDialog.java index f55aafad2fa..7cbea86d124 100644 --- a/src/main/java/org/jabref/gui/exporter/CustomExportDialog.java +++ b/src/main/java/org/jabref/gui/exporter/CustomExportDialog.java @@ -45,13 +45,11 @@ class CustomExportDialog extends JabRefDialog { private final JTextField name = new JTextField(60); private final JTextField layoutFile = new JTextField(60); private final JTextField extension = new JTextField(60); - private JabRefFrame frame; private boolean okPressed; public CustomExportDialog(final JabRefFrame parent, final String exporterName, final String layoutFileName, final String extensionName) { this(parent); - frame = parent; name.setText(exporterName); layoutFile.setText(layoutFileName); extension.setText(extensionName); @@ -59,7 +57,6 @@ public CustomExportDialog(final JabRefFrame parent, final String exporterName, f public CustomExportDialog(final JabRefFrame parent) { super(parent, Localization.lang("Edit custom export"), true, CustomExportDialog.class); - frame = parent; ActionListener okListener = e -> { Path layoutFileDir = Paths.get(layoutFile.getText()).getParent(); if (layoutFileDir != null) { From 9492c19fc0de60ef961b1f255c5685416c15fef9 Mon Sep 17 00:00:00 2001 From: Linus Dietz Date: Tue, 20 Feb 2018 14:47:23 +0100 Subject: [PATCH 09/19] Avoid unused private fields such as 'entry'. --- .../org/jabref/gui/fieldeditors/JournalEditor.java | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/main/java/org/jabref/gui/fieldeditors/JournalEditor.java b/src/main/java/org/jabref/gui/fieldeditors/JournalEditor.java index 5bf822128fa..ceb03d4a35f 100644 --- a/src/main/java/org/jabref/gui/fieldeditors/JournalEditor.java +++ b/src/main/java/org/jabref/gui/fieldeditors/JournalEditor.java @@ -1,7 +1,5 @@ package org.jabref.gui.fieldeditors; -import java.util.Optional; - import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.scene.Parent; @@ -18,9 +16,10 @@ public class JournalEditor extends HBox implements FieldEditorFX { - @FXML private JournalEditorViewModel viewModel; - @FXML private EditorTextArea textArea; - private Optional entry; + @FXML + private JournalEditorViewModel viewModel; + @FXML + private EditorTextArea textArea; public JournalEditor(String fieldName, JournalAbbreviationLoader journalAbbreviationLoader, JabRefPreferences preferences, AutoCompleteSuggestionProvider suggestionProvider, FieldCheckers fieldCheckers) { this.viewModel = new JournalEditorViewModel(fieldName, suggestionProvider, journalAbbreviationLoader, preferences.getJournalAbbreviationPreferences(), fieldCheckers); @@ -41,7 +40,6 @@ public JournalEditorViewModel getViewModel() { @Override public void bindToEntry(BibEntry entry) { - this.entry = Optional.of(entry); viewModel.bindToEntry(entry); } @@ -51,7 +49,7 @@ public Parent getNode() { } @FXML - private void toggleAbbreviation(ActionEvent event) { + private void toggleAbbreviation(ActionEvent unused) { viewModel.toggleAbbreviation(); } } From f5a25ec41dbaad71e2c04279bb8f48b0b1bee4ff Mon Sep 17 00:00:00 2001 From: Linus Dietz Date: Tue, 20 Feb 2018 14:53:46 +0100 Subject: [PATCH 10/19] Avoid unused private fields such as 'frame'. --- src/main/java/org/jabref/gui/filelist/FileListEntryEditor.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/main/java/org/jabref/gui/filelist/FileListEntryEditor.java b/src/main/java/org/jabref/gui/filelist/FileListEntryEditor.java index 5d149513c93..c556f2369f6 100644 --- a/src/main/java/org/jabref/gui/filelist/FileListEntryEditor.java +++ b/src/main/java/org/jabref/gui/filelist/FileListEntryEditor.java @@ -34,7 +34,6 @@ import org.jabref.Globals; import org.jabref.gui.DialogService; import org.jabref.gui.FXDialogService; -import org.jabref.gui.JabRefFrame; import org.jabref.gui.desktop.JabRefDesktop; import org.jabref.gui.externalfiletype.ExternalFileType; import org.jabref.gui.externalfiletype.ExternalFileTypes; @@ -76,8 +75,6 @@ public class FileListEntryEditor { private final JProgressBar prog = new JProgressBar(SwingConstants.HORIZONTAL); private final JLabel downloadLabel = new JLabel(Localization.lang("Downloading...")); private JDialog diag; - //Do not make this variable final, as then the lambda action listener will fail on compile - private JabRefFrame frame; private boolean showSaveDialog; private ConfirmCloseFileListEntryEditor externalConfirm; private LinkedFile entry; From a57d7fca12d90f534d339c4a0aba36414a6c559d Mon Sep 17 00:00:00 2001 From: Linus Dietz Date: Tue, 20 Feb 2018 14:58:40 +0100 Subject: [PATCH 11/19] Remove unused Class --- .../gui/filelist/FileListEntryEditor.java | 26 ++++----- .../gui/groups/UndoableModifyGroup.java | 54 ------------------- 2 files changed, 13 insertions(+), 67 deletions(-) delete mode 100644 src/main/java/org/jabref/gui/groups/UndoableModifyGroup.java diff --git a/src/main/java/org/jabref/gui/filelist/FileListEntryEditor.java b/src/main/java/org/jabref/gui/filelist/FileListEntryEditor.java index c556f2369f6..0c0cbe85c10 100644 --- a/src/main/java/org/jabref/gui/filelist/FileListEntryEditor.java +++ b/src/main/java/org/jabref/gui/filelist/FileListEntryEditor.java @@ -74,7 +74,7 @@ public class FileListEntryEditor { private final JComboBox types; private final JProgressBar prog = new JProgressBar(SwingConstants.HORIZONTAL); private final JLabel downloadLabel = new JLabel(Localization.lang("Downloading...")); - private JDialog diag; + private JDialog dialog; private boolean showSaveDialog; private ConfirmCloseFileListEntryEditor externalConfirm; private LinkedFile entry; @@ -142,7 +142,7 @@ public FileListEntryEditor(LinkedFile entry, boolean showProgressBar, boolean sh return; } } - diag.dispose(); + dialog.dispose(); storeSettings(FileListEntryEditor.this.entry); okPressed = true; }; @@ -198,7 +198,7 @@ public FileListEntryEditor(LinkedFile entry, boolean showProgressBar, boolean sh @Override public void actionPerformed(ActionEvent e) { - diag.dispose(); + dialog.dispose(); } }; cancel.addActionListener(cancelAction); @@ -228,13 +228,13 @@ public void changedUpdate(DocumentEvent documentEvent) { }); - diag = new JDialog(); - diag.setTitle(Localization.lang("Select files")); - diag.setModal(true); - diag.getContentPane().add(builder.getPanel(), BorderLayout.CENTER); - diag.getContentPane().add(bb.getPanel(), BorderLayout.SOUTH); - diag.pack(); - diag.addWindowListener(new WindowAdapter() { + dialog = new JDialog(); + dialog.setTitle(Localization.lang("Select files")); + dialog.setModal(true); + dialog.getContentPane().add(builder.getPanel(), BorderLayout.CENTER); + dialog.getContentPane().add(bb.getPanel(), BorderLayout.SOUTH); + dialog.pack(); + dialog.addWindowListener(new WindowAdapter() { @Override public void windowActivated(WindowEvent event) { @@ -314,12 +314,12 @@ public void setVisible(boolean visible, boolean openBrowse) { } else { title = Localization.lang("Select files"); } - diag.setTitle(title); - diag.setVisible(visible); + dialog.setTitle(title); + dialog.setVisible(visible); } public boolean isVisible() { - return (diag != null) && diag.isVisible(); + return (dialog != null) && dialog.isVisible(); } private void setValues(LinkedFile entry) { diff --git a/src/main/java/org/jabref/gui/groups/UndoableModifyGroup.java b/src/main/java/org/jabref/gui/groups/UndoableModifyGroup.java deleted file mode 100644 index c4b67ddc683..00000000000 --- a/src/main/java/org/jabref/gui/groups/UndoableModifyGroup.java +++ /dev/null @@ -1,54 +0,0 @@ -package org.jabref.gui.groups; - -import java.util.List; - -import org.jabref.gui.undo.AbstractUndoableJabRefEdit; -import org.jabref.logic.l10n.Localization; -import org.jabref.model.groups.AbstractGroup; -import org.jabref.model.groups.GroupTreeNode; - -class UndoableModifyGroup extends AbstractUndoableJabRefEdit { - - private final GroupSidePane groupSidePane; - private final AbstractGroup m_oldGroupBackup; - private final AbstractGroup m_newGroupBackup; - private final GroupTreeNode m_groupsRootHandle; - private final List m_pathToNode; - - - /** - * @param node - * The node which still contains the old group. - * @param newGroup - * The new group to replace the one currently stored in node - * . - */ - public UndoableModifyGroup(GroupSidePane gs, GroupTreeNodeViewModel groupsRoot, - GroupTreeNodeViewModel node, AbstractGroup newGroup) { - groupSidePane = gs; - m_oldGroupBackup = node.getNode().getGroup().deepCopy(); - m_newGroupBackup = newGroup.deepCopy(); - m_pathToNode = node.getNode().getIndexedPathFromRoot(); - m_groupsRootHandle = groupsRoot.getNode(); - } - - @Override - public String getPresentationName() { - return Localization.lang("modify group"); - } - - @Override - public void undo() { - super.undo(); - //TODO: NULL - m_groupsRootHandle.getDescendant(m_pathToNode).get().setGroup( - m_oldGroupBackup.deepCopy()); - } - - @Override - public void redo() { - super.redo(); - m_groupsRootHandle.getDescendant(m_pathToNode).get().setGroup( - m_newGroupBackup.deepCopy()); - } -} From 16196c6a75aafae21a56994ad9b43045aa55db18 Mon Sep 17 00:00:00 2001 From: Linus Dietz Date: Tue, 20 Feb 2018 15:01:16 +0100 Subject: [PATCH 12/19] Remove unused parameter --- .../gui/importer/fetcher/OAI2Fetcher.java | 45 +++++++------------ 1 file changed, 15 insertions(+), 30 deletions(-) diff --git a/src/main/java/org/jabref/gui/importer/fetcher/OAI2Fetcher.java b/src/main/java/org/jabref/gui/importer/fetcher/OAI2Fetcher.java index 4f9d592cfc9..d749f9264dc 100644 --- a/src/main/java/org/jabref/gui/importer/fetcher/OAI2Fetcher.java +++ b/src/main/java/org/jabref/gui/importer/fetcher/OAI2Fetcher.java @@ -33,14 +33,12 @@ import org.xml.sax.helpers.DefaultHandler; /** - * * This class can be used to access any archive offering an OAI2 interface. By * default it will access ArXiv.org * - * @see - * * @author Ulrich Stärk * @author Christian Kopf + * @see */ public class OAI2Fetcher implements EntryFetcher { @@ -56,33 +54,24 @@ public class OAI2Fetcher implements EntryFetcher { private final String oai2Script; private final String oai2MetaDataPrefix; private final String oai2PrefixIdentifier; - private final String oai2ArchiveName; private boolean shouldContinue = true; private long waitTime = -1; private Date lastCall; /** - * - * - * @param oai2Host - * the host to query without leading http:// and without trailing / - * @param oai2Script - * the relative location of the oai2 interface without leading - * and trailing / - * @param oai2Metadataprefix - * the urlencoded metadataprefix - * @param oai2Prefixidentifier - * the urlencoded prefix identifier - * @param waitTimeMs - * Time to wait in milliseconds between query-requests. + * @param oai2Host the host to query without leading http:// and without trailing / + * @param oai2Script the relative location of the oai2 interface without leading + * and trailing / + * @param oai2Metadataprefix the urlencoded metadataprefix + * @param oai2Prefixidentifier the urlencoded prefix identifier + * @param waitTimeMs Time to wait in milliseconds between query-requests. */ public OAI2Fetcher(String oai2Host, String oai2Script, String oai2Metadataprefix, String oai2Prefixidentifier, - String oai2ArchiveName, long waitTimeMs) { + long waitTimeMs) { this.oai2Host = oai2Host; this.oai2Script = oai2Script; this.oai2MetaDataPrefix = oai2Metadataprefix; this.oai2PrefixIdentifier = oai2Prefixidentifier; - this.oai2ArchiveName = oai2ArchiveName; this.waitTime = waitTimeMs; try { SAXParserFactory parserFactory = SAXParserFactory.newInstance(); @@ -94,19 +83,16 @@ public OAI2Fetcher(String oai2Host, String oai2Script, String oai2Metadataprefix /** * Default Constructor. The archive queried will be ArXiv.org - * */ public OAI2Fetcher() { this(OAI2Fetcher.OAI2_ARXIV_HOST, OAI2Fetcher.OAI2_ARXIV_SCRIPT, OAI2Fetcher.OAI2_ARXIV_METADATAPREFIX, - OAI2Fetcher.OAI2_ARXIV_PREFIXIDENTIFIER, OAI2Fetcher.OAI2_ARXIV_ARCHIVENAME, 20000L); + OAI2Fetcher.OAI2_ARXIV_PREFIXIDENTIFIER, 20000L); } /** * Construct the query URL * - * @param key - * The key of the OAI2 entry that the url should point to. - * + * @param key The key of the OAI2 entry that the url should point to. * @return a String denoting the query URL */ public String constructUrl(String key) { @@ -154,12 +140,11 @@ public static String fixKey(String key) { * Import an entry from an OAI2 archive. The BibEntry provided has to * have the field OAI2_IDENTIFIER_FIELD set to the search string. * - * @param key - * The OAI2 key to fetch from ArXiv. + * @param key The OAI2 key to fetch from ArXiv. * @return The imported BibEntry or null if none. */ protected BibEntry importOai2Entry(String key) throws IOException, SAXException { - /** + /* * Fix for problem reported in mailing-list: * https://sourceforge.net/forum/message.php?msg_id=4087158 */ @@ -252,7 +237,7 @@ public boolean processQuery(String query, ImportInspector dialog, OutputPrinter } catch (SAXException e) { String url = constructUrl(OAI2Fetcher.fixKey(key)); LOGGER.error("Error while fetching from " + getTitle(), e); - ((ImportInspectionDialog)dialog).showMessage(Localization.lang("Error while fetching from %0", getTitle()) + "\n" + + ((ImportInspectionDialog) dialog).showMessage(Localization.lang("Error while fetching from %0", getTitle()) + "\n" + Localization.lang("A SAX exception occurred while parsing '%0':", url), Localization.lang("Search %0", getTitle()), JOptionPane.ERROR_MESSAGE); } @@ -273,8 +258,8 @@ public boolean processQuery(String query, ImportInspector dialog, OutputPrinter return true; } catch (IOException | InterruptedException e) { LOGGER.error("Error while fetching from " + getTitle(), e); - ((ImportInspectionDialog)dialog).showErrorMessage(this.getTitle(), e.getLocalizedMessage()); - } + ((ImportInspectionDialog) dialog).showErrorMessage(this.getTitle(), e.getLocalizedMessage()); + } return false; } From f0adaf101ed77558481b6cd89198c36127f83078 Mon Sep 17 00:00:00 2001 From: Linus Dietz Date: Tue, 20 Feb 2018 15:02:32 +0100 Subject: [PATCH 13/19] Avoid unused private fields such as 'toRect'. --- .../gui/openoffice/StyleSelectDialog.java | 40 ++++++++----------- 1 file changed, 17 insertions(+), 23 deletions(-) diff --git a/src/main/java/org/jabref/gui/openoffice/StyleSelectDialog.java b/src/main/java/org/jabref/gui/openoffice/StyleSelectDialog.java index e578d5a21d7..890e748492c 100644 --- a/src/main/java/org/jabref/gui/openoffice/StyleSelectDialog.java +++ b/src/main/java/org/jabref/gui/openoffice/StyleSelectDialog.java @@ -2,7 +2,6 @@ import java.awt.BorderLayout; import java.awt.Dimension; -import java.awt.Rectangle; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; @@ -98,7 +97,6 @@ class StyleSelectDialog { private PreviewPanel preview; private ActionListener removeAction; - private final Rectangle toRect = new Rectangle(0, 0, 1, 1); private final JButton ok = new JButton(Localization.lang("OK")); private final JButton cancel = new JButton(Localization.lang("Cancel")); private final BibEntry prevEntry; @@ -108,13 +106,11 @@ class StyleSelectDialog { private final OpenOfficePreferences preferences; public StyleSelectDialog(JabRefFrame frame, OpenOfficePreferences preferences, StyleLoader loader) { - this.frame = Objects.requireNonNull(frame); this.preferences = Objects.requireNonNull(preferences); this.loader = Objects.requireNonNull(loader); prevEntry = TestEntry.getTestEntry(); init(); - } private void init() { @@ -130,7 +126,6 @@ private void init() { } }); updateStyles(); - }); addButton.setToolTipText(Localization.lang("Add style file")); @@ -293,7 +288,6 @@ private void setupPopupMenu() { LOGGER.warn("Problem with style file '" + style.getPath() + "'", e); } })); - } public void setVisible(boolean visible) { @@ -356,6 +350,7 @@ public Optional getStyle() { /** * Get the currently selected style. + * * @return the selected style, or empty if no style is selected. */ private Optional getSelectedStyle() { @@ -375,28 +370,28 @@ public int getColumnCount() { @Override public String getColumnName(int i) { switch (i) { - case 0: - return Localization.lang("Name"); - case 1: - return Localization.lang("Journals"); - case 2: - return Localization.lang("File"); - default: - return ""; + case 0: + return Localization.lang("Name"); + case 1: + return Localization.lang("Journals"); + case 2: + return Localization.lang("File"); + default: + return ""; } } @Override public Object getColumnValue(OOBibStyle style, int i) { switch (i) { - case 0: - return style.getName(); - case 1: - return String.join(", ", style.getJournals()); - case 2: - return style.isFromResource() ? Localization.lang("Internal style") : style.getFile().getName(); - default: - return ""; + case 0: + return style.getName(); + case 1: + return String.join(", ", style.getJournals()); + case 2: + return style.isFromResource() ? Localization.lang("Internal style") : style.getFile().getName(); + default: + return ""; } } } @@ -534,6 +529,5 @@ public Optional getFileName() { public void setDirectoryPath(String path) { this.newFile.setText(path); } - } } From 554868393731ceccadb624c462c9f076f43edf46 Mon Sep 17 00:00:00 2001 From: Linus Dietz Date: Tue, 20 Feb 2018 15:03:24 +0100 Subject: [PATCH 14/19] Avoid unused private fields such as 'parent'. --- .../jabref/gui/protectedterms/NewProtectedTermsFileDialog.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/main/java/org/jabref/gui/protectedterms/NewProtectedTermsFileDialog.java b/src/main/java/org/jabref/gui/protectedterms/NewProtectedTermsFileDialog.java index 39fede36dbe..6d637fecb3e 100644 --- a/src/main/java/org/jabref/gui/protectedterms/NewProtectedTermsFileDialog.java +++ b/src/main/java/org/jabref/gui/protectedterms/NewProtectedTermsFileDialog.java @@ -12,7 +12,6 @@ import javax.swing.JCheckBox; import javax.swing.JComponent; import javax.swing.JDialog; -import javax.swing.JFrame; import javax.swing.JTextField; import org.jabref.Globals; @@ -39,7 +38,6 @@ public class NewProtectedTermsFileDialog extends JabRefDialog { private final JCheckBox enabled = new JCheckBox(Localization.lang("Enabled")); private boolean addOKPressed; private final ProtectedTermsLoader loader; - private JFrame parent; public NewProtectedTermsFileDialog(JDialog parent, ProtectedTermsLoader loader) { super(parent, Localization.lang("New protected terms file"), true, NewProtectedTermsFileDialog.class); @@ -50,7 +48,6 @@ public NewProtectedTermsFileDialog(JDialog parent, ProtectedTermsLoader loader) public NewProtectedTermsFileDialog(JabRefFrame mainFrame, ProtectedTermsLoader loader) { super(mainFrame, Localization.lang("New protected terms file"), true, NewProtectedTermsFileDialog.class); - parent = mainFrame; this.loader = loader; setupDialog(); setLocationRelativeTo(mainFrame); From 0cb1c0ba9121989cfede2e12eff0b22414566dde Mon Sep 17 00:00:00 2001 From: Linus Dietz Date: Tue, 20 Feb 2018 15:04:21 +0100 Subject: [PATCH 15/19] Avoid unused private fields such as 'LOGGER'. --- .../jabref/logic/journals/JournalAbbreviationRepository.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/main/java/org/jabref/logic/journals/JournalAbbreviationRepository.java b/src/main/java/org/jabref/logic/journals/JournalAbbreviationRepository.java index 305bb340aa6..72a90329e4b 100644 --- a/src/main/java/org/jabref/logic/journals/JournalAbbreviationRepository.java +++ b/src/main/java/org/jabref/logic/journals/JournalAbbreviationRepository.java @@ -7,15 +7,11 @@ import java.util.Optional; import java.util.Set; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - /** * A repository for all journal abbreviations, including add and find methods. */ public class JournalAbbreviationRepository { - private static final Logger LOGGER = LoggerFactory.getLogger(JournalAbbreviationRepository.class); private final Set abbreviations = new HashSet<>(16000); // We have over 15.000 abbreviations in the built-in lists public JournalAbbreviationRepository(Abbreviation... abbreviations) { From 9b9c8b9b45d8835bcfd1915c53ad709336443acb Mon Sep 17 00:00:00 2001 From: Linus Dietz Date: Tue, 20 Feb 2018 15:13:25 +0100 Subject: [PATCH 16/19] Avoid unused private fields --- .../org/jabref/logic/exporter/ModsExportFormatTest.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/test/java/org/jabref/logic/exporter/ModsExportFormatTest.java b/src/test/java/org/jabref/logic/exporter/ModsExportFormatTest.java index 011c0139144..017cc32cabc 100644 --- a/src/test/java/org/jabref/logic/exporter/ModsExportFormatTest.java +++ b/src/test/java/org/jabref/logic/exporter/ModsExportFormatTest.java @@ -27,21 +27,19 @@ public class ModsExportFormatTest { public Charset charset; private ModsExporter modsExportFormat; private BibDatabaseContext databaseContext; - private BibtexImporter bibtexImporter; private Path tempFile; @Rule public TemporaryFolder testFolder = new TemporaryFolder(); - private Path importFile; @Before public void setUp() throws Exception { databaseContext = new BibDatabaseContext(); charset = StandardCharsets.UTF_8; modsExportFormat = new ModsExporter(); - bibtexImporter = new BibtexImporter(mock(ImportFormatPreferences.class, Answers.RETURNS_DEEP_STUBS), new DummyFileUpdateMonitor()); + new BibtexImporter(mock(ImportFormatPreferences.class, Answers.RETURNS_DEEP_STUBS), new DummyFileUpdateMonitor()); tempFile = testFolder.newFile().toPath(); - importFile = Paths.get(ModsExportFormatTest.class.getResource("ModsExportFormatTestAllFields.bib").toURI()); + Paths.get(ModsExportFormatTest.class.getResource("ModsExportFormatTestAllFields.bib").toURI()); } @Test From 63743bb32ca0d2a1834efbf099421c8a05af0803 Mon Sep 17 00:00:00 2001 From: Linus Dietz Date: Tue, 20 Feb 2018 15:41:07 +0100 Subject: [PATCH 17/19] fix localization --- src/main/resources/l10n/JabRef_en.properties | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/main/resources/l10n/JabRef_en.properties b/src/main/resources/l10n/JabRef_en.properties index 6b4b8ea1d3d..319c99a8a4c 100644 --- a/src/main/resources/l10n/JabRef_en.properties +++ b/src/main/resources/l10n/JabRef_en.properties @@ -732,8 +732,6 @@ Modified\ string=Modified string Modify=Modify -modify\ group=modify group - Move\ down=Move down Move\ external\ links\ to\ 'file'\ field=Move external links to 'file' field From 3e964f947c865d1215a2c0250ab398edc4b7b35d Mon Sep 17 00:00:00 2001 From: Linus Dietz Date: Tue, 20 Feb 2018 15:52:35 +0100 Subject: [PATCH 18/19] fix newly found warnigns --- src/main/java/org/jabref/gui/collab/ChangeScanner.java | 3 --- src/main/java/org/jabref/gui/importer/fetcher/OAI2Fetcher.java | 1 - 2 files changed, 4 deletions(-) diff --git a/src/main/java/org/jabref/gui/collab/ChangeScanner.java b/src/main/java/org/jabref/gui/collab/ChangeScanner.java index 3514a888d03..bb3cfec77a1 100644 --- a/src/main/java/org/jabref/gui/collab/ChangeScanner.java +++ b/src/main/java/org/jabref/gui/collab/ChangeScanner.java @@ -32,7 +32,6 @@ import org.jabref.model.database.BibDatabaseContext; import org.jabref.model.entry.BibEntry; import org.jabref.model.entry.BibtexString; -import org.jabref.model.metadata.MetaData; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -43,7 +42,6 @@ public class ChangeScanner implements Runnable { private final File file; private final Path tempFile; private final BibDatabaseContext databaseInMemory; - private final MetaData metadataInMemory; private final BasePanel panel; private final JabRefFrame frame; @@ -62,7 +60,6 @@ public ChangeScanner(JabRefFrame frame, BasePanel bp, File file, Path tempFile) this.panel = bp; this.frame = frame; this.databaseInMemory = bp.getDatabaseContext(); - this.metadataInMemory = bp.getBibDatabaseContext().getMetaData(); this.file = file; this.tempFile = tempFile; } diff --git a/src/main/java/org/jabref/gui/importer/fetcher/OAI2Fetcher.java b/src/main/java/org/jabref/gui/importer/fetcher/OAI2Fetcher.java index d749f9264dc..a59979a8a2f 100644 --- a/src/main/java/org/jabref/gui/importer/fetcher/OAI2Fetcher.java +++ b/src/main/java/org/jabref/gui/importer/fetcher/OAI2Fetcher.java @@ -47,7 +47,6 @@ public class OAI2Fetcher implements EntryFetcher { private static final String OAI2_ARXIV_HOST = "export.arxiv.org"; private static final String OAI2_ARXIV_SCRIPT = "oai2"; private static final String OAI2_ARXIV_METADATAPREFIX = "arXiv"; - private static final String OAI2_ARXIV_ARCHIVENAME = "ArXiv.org"; private static final String OAI2_IDENTIFIER_FIELD = "oai2identifier"; private SAXParser saxParser; private final String oai2Host; From 4cf2c2c3ff1f40cb7b2238b716c5429a8a8e110b Mon Sep 17 00:00:00 2001 From: Linus Dietz Date: Mon, 5 Mar 2018 12:14:06 +0100 Subject: [PATCH 19/19] rename dialog --- .../gui/filelist/FileListEntryEditor.java | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/main/java/org/jabref/gui/filelist/FileListEntryEditor.java b/src/main/java/org/jabref/gui/filelist/FileListEntryEditor.java index d6cd64833c1..0201d148e03 100644 --- a/src/main/java/org/jabref/gui/filelist/FileListEntryEditor.java +++ b/src/main/java/org/jabref/gui/filelist/FileListEntryEditor.java @@ -73,7 +73,7 @@ public class FileListEntryEditor { private final JComboBox types; private final JProgressBar prog = new JProgressBar(SwingConstants.HORIZONTAL); private final JLabel downloadLabel = new JLabel(Localization.lang("Downloading...")); - private JDialog diag; + private JDialog dialog; //Do not make this variable final, as then the lambda action listener will fail on compile private JabRefFrame frame; private boolean showSaveDialog; @@ -142,7 +142,7 @@ public FileListEntryEditor(LinkedFile entry, boolean showProgressBar, boolean sh return; } } - diag.dispose(); + dialog.dispose(); storeSettings(FileListEntryEditor.this.entry); okPressed = true; }; @@ -198,7 +198,7 @@ public FileListEntryEditor(LinkedFile entry, boolean showProgressBar, boolean sh @Override public void actionPerformed(ActionEvent e) { - diag.dispose(); + dialog.dispose(); } }; cancel.addActionListener(cancelAction); @@ -228,13 +228,13 @@ public void changedUpdate(DocumentEvent documentEvent) { }); - diag = new JDialog(); - diag.setTitle(Localization.lang("Select files")); - diag.setModal(true); - diag.getContentPane().add(builder.getPanel(), BorderLayout.CENTER); - diag.getContentPane().add(bb.getPanel(), BorderLayout.SOUTH); - diag.pack(); - diag.addWindowListener(new WindowAdapter() { + dialog = new JDialog(); + dialog.setTitle(Localization.lang("Select files")); + dialog.setModal(true); + dialog.getContentPane().add(builder.getPanel(), BorderLayout.CENTER); + dialog.getContentPane().add(bb.getPanel(), BorderLayout.SOUTH); + dialog.pack(); + dialog.addWindowListener(new WindowAdapter() { @Override public void windowActivated(WindowEvent event) { @@ -314,12 +314,12 @@ public void setVisible(boolean visible, boolean openBrowse) { } else { title = Localization.lang("Select files"); } - diag.setTitle(title); - diag.setVisible(visible); + dialog.setTitle(title); + dialog.setVisible(visible); } public boolean isVisible() { - return (diag != null) && diag.isVisible(); + return (dialog != null) && dialog.isVisible(); } private void setValues(LinkedFile entry) {