From e99684e5ca7f8916ce62a0f881ae94b7a9b515b9 Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Sat, 14 Jul 2018 18:46:51 +0200 Subject: [PATCH 1/3] Remove unnecessary look and feel migration --- .../migrations/PreferencesMigrations.java | 25 ------------------- .../jabref/preferences/JabRefPreferences.java | 14 ----------- 2 files changed, 39 deletions(-) diff --git a/src/main/java/org/jabref/migrations/PreferencesMigrations.java b/src/main/java/org/jabref/migrations/PreferencesMigrations.java index c7bf596d458..f0923915177 100644 --- a/src/main/java/org/jabref/migrations/PreferencesMigrations.java +++ b/src/main/java/org/jabref/migrations/PreferencesMigrations.java @@ -9,11 +9,9 @@ import java.util.function.UnaryOperator; import java.util.prefs.BackingStoreException; import java.util.prefs.Preferences; -import java.util.stream.Stream; import org.jabref.Globals; import org.jabref.JabRefMain; -import org.jabref.logic.util.OS; import org.jabref.model.bibtexkeypattern.GlobalBibtexKeyPattern; import org.jabref.model.entry.FieldName; import org.jabref.preferences.JabRefPreferences; @@ -43,7 +41,6 @@ public static void runMigrations() { upgradeStoredCustomEntryTypes(Globals.prefs, mainPrefsNode); upgradeKeyBindingsToJavaFX(Globals.prefs); addCrossRefRelatedFieldsForAutoComplete(Globals.prefs); - upgradeObsoleteLookAndFeels(Globals.prefs); upgradePreviewStyleFromReviewToComment(Globals.prefs); } @@ -285,28 +282,6 @@ private static void migrateTypedKeyPrefs(JabRefPreferences prefs, Preferences ol prefs.putKeyPattern(keyPattern); } - private static void upgradeObsoleteLookAndFeels(JabRefPreferences prefs) { - - String currentLandF = prefs.getLookAndFeel(); - - Stream.of("com.jgoodies.looks.windows.WindowsLookAndFeel", "com.jgoodies.looks.plastic.PlasticLookAndFeel", - "com.jgoodies.looks.plastic.Plastic3DLookAndFeel", "com.jgoodies.looks.plastic.PlasticXPLookAndFeel", - "com.sun.java.swing.plaf.gtk.GTKLookAndFeel") - .filter(style -> style.equals(currentLandF)) - .findAny() - .ifPresent(loolAndFeel -> { - if (OS.WINDOWS) { - String windowsLandF = "com.sun.java.swing.plaf.windows.WindowsLookAndFeel"; - prefs.setLookAndFeel(windowsLandF); - LOGGER.info("Switched from obsolete look and feel " + currentLandF + " to " + windowsLandF); - } else { - String nimbusLandF = "javax.swing.plaf.nimbus.NimbusLookAndFeel"; - prefs.setLookAndFeel(nimbusLandF); - LOGGER.info("Switched from obsolete look and feel " + currentLandF + " to " + nimbusLandF); - } - }); - } - static void upgradePreviewStyleFromReviewToComment(JabRefPreferences prefs) { String currentPreviewStyle = prefs.getPreviewStyle(); String migratedStyle = currentPreviewStyle.replace("\\begin{review}

Review: \\format[HTMLChars]{\\review} \\end{review}", "\\begin{comment}

Comment: \\format[HTMLChars]{\\comment} \\end{comment}"); diff --git a/src/main/java/org/jabref/preferences/JabRefPreferences.java b/src/main/java/org/jabref/preferences/JabRefPreferences.java index 72e8444a924..6270350cc84 100644 --- a/src/main/java/org/jabref/preferences/JabRefPreferences.java +++ b/src/main/java/org/jabref/preferences/JabRefPreferences.java @@ -34,8 +34,6 @@ import java.util.prefs.Preferences; import java.util.stream.Collectors; -import javax.swing.UIManager; - import org.jabref.Globals; import org.jabref.JabRefException; import org.jabref.JabRefMain; @@ -115,7 +113,6 @@ public class JabRefPreferences implements PreferencesService { public static final String LYXPIPE = "lyxpipe"; public static final String EXTERNAL_FILE_TYPES = "externalFileTypes"; public static final String FONT_FAMILY = "fontFamily"; - public static final String WIN_LOOK_AND_FEEL = "lookAndFeel"; public static final String FX_FONT_RENDERING_TWEAK = "fxFontRenderingTweak"; public static final String LANGUAGE = "language"; public static final String NAMES_LAST_ONLY = "namesLastOnly"; @@ -461,15 +458,12 @@ private JabRefPreferences() { if (OS.OS_X) { defaults.put(FONT_FAMILY, "SansSerif"); - defaults.put(WIN_LOOK_AND_FEEL, UIManager.getSystemLookAndFeelClassName()); defaults.put(EMACS_PATH, "emacsclient"); } else if (OS.WINDOWS) { - defaults.put(WIN_LOOK_AND_FEEL, "com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); defaults.put(EMACS_PATH, "emacsclient.exe"); } else { // Linux defaults.put(FONT_FAMILY, "SansSerif"); - defaults.put(WIN_LOOK_AND_FEEL, "javax.swing.plaf.nimbus.NimbusLookAndFeel"); defaults.put(EMACS_PATH, "emacsclient"); } @@ -1899,14 +1893,6 @@ public void setGroupViewMode(GroupViewMode mode) { put(GROUP_INTERSECT_UNION_VIEW_MODE, mode.name()); } - public String getLookAndFeel() { - return get(WIN_LOOK_AND_FEEL); - } - - public void setLookAndFeel(String lookAndFeelClassName) { - put(WIN_LOOK_AND_FEEL, lookAndFeelClassName); - } - public void setPreviewStyle(String previewStyle) { put(PREVIEW_STYLE, previewStyle); } From fba2000ee41e13efab0f2aab365cfe68bf458837 Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Sun, 15 Jul 2018 00:36:32 +0200 Subject: [PATCH 2/3] Remove unused look and feel references --- src/main/java/org/jabref/JabRefGUI.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/main/java/org/jabref/JabRefGUI.java b/src/main/java/org/jabref/JabRefGUI.java index 9ab00359919..f6074c34725 100644 --- a/src/main/java/org/jabref/JabRefGUI.java +++ b/src/main/java/org/jabref/JabRefGUI.java @@ -35,10 +35,6 @@ public class JabRefGUI { - private static final String NIMBUS_LOOK_AND_FEEL = "javax.swing.plaf.nimbus.NimbusLookAndFeel"; - private static final String WINDOWS_LOOK_AND_FEEL = "com.sun.java.swing.plaf.windows.WindowsLookAndFeel"; - private static final String OSX_AQUA_LOOK_AND_FEEL = "apple.laf.AquaLookAndFeel"; - private static final Logger LOGGER = LoggerFactory.getLogger(JabRefGUI.class); private static JabRefFrame mainFrame; From 03090f2ac91c6fa1990f87663d5a0a7ed5b2e628 Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Sun, 15 Jul 2018 10:32:46 +0200 Subject: [PATCH 3/3] Fix checkstyle issue --- src/main/java/org/jabref/logic/util/io/FileBasedLock.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/jabref/logic/util/io/FileBasedLock.java b/src/main/java/org/jabref/logic/util/io/FileBasedLock.java index 4ebeef010c9..7de6acb8642 100644 --- a/src/main/java/org/jabref/logic/util/io/FileBasedLock.java +++ b/src/main/java/org/jabref/logic/util/io/FileBasedLock.java @@ -11,13 +11,11 @@ import org.slf4j.LoggerFactory; public class FileBasedLock { - private static final Logger LOGGER = LoggerFactory.getLogger(FileBasedLock.class); - /** * The age in ms of a lockfile before JabRef will offer to "steal" the locked file. */ public static final long LOCKFILE_CRITICAL_AGE = 60000; - + private static final Logger LOGGER = LoggerFactory.getLogger(FileBasedLock.class); private static final String LOCKFILE_SUFFIX = ".lock"; // default retry count for acquiring file lock @@ -31,7 +29,7 @@ private FileBasedLock() { * there is, it waits for 500 ms. This is repeated until the lock is gone * or we have waited the maximum number of times. * - * @param file The file to check the lock for. + * @param file The file to check the lock for. * @param maxWaitCount The maximum number of times to wait. * @return true if the lock file is gone, false if it is still there. */ @@ -58,6 +56,7 @@ public static boolean waitForFileLock(Path file) { /** * Check whether a lock file exists for this file. + * * @param file The file to check. * @return true if a lock file exists, false otherwise. */ @@ -68,6 +67,7 @@ public static boolean hasLockFile(Path file) { /** * Find the lock file's last modified time, if it has a lock file. + * * @param file The file to check. * @return the last modified time if lock file exists, empty optional otherwise. */