Skip to content

Commit

Permalink
Pass the ThemeLoader object and JabRefPreferences object into ShowPre…
Browse files Browse the repository at this point in the history
…ferencesAction constructor rather than using Globals
  • Loading branch information
Luckylys committed May 6, 2020
1 parent 9af83f4 commit 75198fb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/main/java/org/jabref/gui/JabRefFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -863,7 +863,7 @@ private MenuBar createMenu() {
});

options.getItems().addAll(
factory.createMenuItem(StandardActions.SHOW_PREFS, new ShowPreferencesAction(this, Globals.TASK_EXECUTOR)),
factory.createMenuItem(StandardActions.SHOW_PREFS, new ShowPreferencesAction(this, Globals.TASK_EXECUTOR, themeLoader, prefs)),

new SeparatorMenuItem(),

Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
package org.jabref.gui.preferences;

import org.jabref.Globals;
import org.jabref.gui.JabRefFrame;
import org.jabref.gui.actions.SimpleCommand;
import org.jabref.gui.util.TaskExecutor;
import org.jabref.gui.util.ThemeLoader;
import org.jabref.preferences.JabRefPreferences;

public class ShowPreferencesAction extends SimpleCommand {

private final JabRefFrame jabRefFrame;
private final TaskExecutor taskExecutor;
private final ThemeLoader themeLoader;
private final JabRefPreferences prefs;

public ShowPreferencesAction(JabRefFrame jabRefFrame, TaskExecutor taskExecutor) {
public ShowPreferencesAction(JabRefFrame jabRefFrame, TaskExecutor taskExecutor, ThemeLoader themeLoader, JabRefPreferences prefs) {
this.jabRefFrame = jabRefFrame;
this.taskExecutor = taskExecutor;
this.themeLoader = themeLoader;
this.prefs = prefs;
}

@Override
Expand All @@ -21,7 +26,7 @@ public void execute() {
preferencesDialogView.show();
for (PreferencesTab tab: preferencesDialogView.getPreferenceTabList().getItems()) {
if (tab.getBuilder().getScene() != null) {
Globals.getThemeLoader().installCss(tab.getBuilder().getScene(), Globals.prefs);
this.themeLoader.installCss(tab.getBuilder().getScene(), this.prefs);
}
}
}
Expand Down

0 comments on commit 75198fb

Please sign in to comment.