Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unnecessary look and feel migration #4204

Merged
merged 3 commits into from
Jul 15, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 0 additions & 25 deletions src/main/java/org/jabref/migrations/PreferencesMigrations.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -43,7 +41,6 @@ public static void runMigrations() {
upgradeStoredCustomEntryTypes(Globals.prefs, mainPrefsNode);
upgradeKeyBindingsToJavaFX(Globals.prefs);
addCrossRefRelatedFieldsForAutoComplete(Globals.prefs);
upgradeObsoleteLookAndFeels(Globals.prefs);
upgradePreviewStyleFromReviewToComment(Globals.prefs);
}

Expand Down Expand Up @@ -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}<BR><BR><b>Review: </b> \\format[HTMLChars]{\\review} \\end{review}", "\\begin{comment}<BR><BR><b>Comment: </b> \\format[HTMLChars]{\\comment} \\end{comment}");
Expand Down
14 changes: 0 additions & 14 deletions src/main/java/org/jabref/preferences/JabRefPreferences.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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";
Expand Down Expand Up @@ -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");
}

Expand Down Expand Up @@ -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);
}
Expand Down