diff --git a/src/main/java/org/jabref/gui/preferences/ExternalTab.java b/src/main/java/org/jabref/gui/preferences/ExternalTab.java index 08094d037f5..afb52861d68 100644 --- a/src/main/java/org/jabref/gui/preferences/ExternalTab.java +++ b/src/main/java/org/jabref/gui/preferences/ExternalTab.java @@ -19,7 +19,6 @@ import org.jabref.gui.push.PushToApplication; import org.jabref.gui.push.PushToApplicationSettings; import org.jabref.gui.push.PushToApplicationSettingsDialog; -import org.jabref.gui.push.PushToApplicationsManager; import org.jabref.gui.util.FileDialogConfiguration; import org.jabref.logic.l10n.Localization; import org.jabref.logic.util.OS; @@ -28,6 +27,7 @@ class ExternalTab implements PrefsTab { + private final JabRefFrame frame; private final JabRefPreferences prefs; private final TextField emailSubject; private final TextField citeCommand; @@ -54,6 +54,7 @@ class ExternalTab implements PrefsTab { public ExternalTab(JabRefFrame frame, PreferencesDialog prefsDiag, JabRefPreferences prefs) { this.prefs = prefs; + this.frame = frame; dialogService = frame.getDialogService(); builder.setVgap(7); @@ -197,7 +198,7 @@ public Node getBuilder() { } private void addSettingsButton(final PushToApplication application, GridPane panel, int index) { - PushToApplicationSettings settings = PushToApplicationsManager.getSettings(application); + PushToApplicationSettings settings = frame.getPushApplications().getSettings(application); Button button = new Button(Localization.lang("Settings for %0", application.getApplicationName())); button.setPrefSize(150, 20); button.setOnAction(e -> PushToApplicationSettingsDialog.showSettingsDialog(dialogService, settings, index)); diff --git a/src/main/java/org/jabref/gui/push/PushToApplicationSettings.java b/src/main/java/org/jabref/gui/push/PushToApplicationSettings.java index d0818faf106..5bf9d5a75f7 100644 --- a/src/main/java/org/jabref/gui/push/PushToApplicationSettings.java +++ b/src/main/java/org/jabref/gui/push/PushToApplicationSettings.java @@ -19,6 +19,10 @@ public class PushToApplicationSettings { protected AbstractPushToApplication application; private DialogService dialogService; + public PushToApplicationSettings(DialogService dialogService) { + this.dialogService = dialogService; + } + public GridPane getJFXSettingPane(int n) { switch (n) { case 0: diff --git a/src/main/java/org/jabref/gui/push/PushToApplicationsManager.java b/src/main/java/org/jabref/gui/push/PushToApplicationsManager.java index 32a13f1226b..e7bfaf78b3b 100644 --- a/src/main/java/org/jabref/gui/push/PushToApplicationsManager.java +++ b/src/main/java/org/jabref/gui/push/PushToApplicationsManager.java @@ -10,7 +10,10 @@ public class PushToApplicationsManager { private final List applications; + private final DialogService dialogService; + public PushToApplicationsManager(DialogService dialogService) { + this.dialogService = dialogService; // Set up the current available choices: applications = new ArrayList<>(); applications.add(new PushToEmacs(dialogService)); @@ -25,15 +28,15 @@ public List getApplications() { return applications; } - public static PushToApplicationSettings getSettings(PushToApplication application) { + public PushToApplicationSettings getSettings(PushToApplication application) { if (application instanceof PushToEmacs) { - return new PushToEmacsSettings(); + return new PushToEmacsSettings(dialogService); } else if (application instanceof PushToLyx) { - return new PushToLyxSettings(); + return new PushToLyxSettings(dialogService); } else if (application instanceof PushToVim) { - return new PushToVimSettings(); + return new PushToVimSettings(dialogService); } else { - return new PushToApplicationSettings(); + return new PushToApplicationSettings(dialogService); } } diff --git a/src/main/java/org/jabref/gui/push/PushToEmacsSettings.java b/src/main/java/org/jabref/gui/push/PushToEmacsSettings.java index ca4cee137ac..0147276b652 100644 --- a/src/main/java/org/jabref/gui/push/PushToEmacsSettings.java +++ b/src/main/java/org/jabref/gui/push/PushToEmacsSettings.java @@ -4,6 +4,7 @@ import javafx.scene.control.TextField; import org.jabref.Globals; +import org.jabref.gui.DialogService; import org.jabref.logic.l10n.Localization; import org.jabref.preferences.JabRefPreferences; @@ -11,6 +12,8 @@ public class PushToEmacsSettings extends PushToApplicationSettings { private final TextField additionalParams = new TextField(); + public PushToEmacsSettings (DialogService dialogService) { super(dialogService); } + @Override public void storeSettings() { super.storeSettings(); diff --git a/src/main/java/org/jabref/gui/push/PushToLyxSettings.java b/src/main/java/org/jabref/gui/push/PushToLyxSettings.java index 856f6fc86be..85fe05a97e4 100644 --- a/src/main/java/org/jabref/gui/push/PushToLyxSettings.java +++ b/src/main/java/org/jabref/gui/push/PushToLyxSettings.java @@ -1,11 +1,14 @@ package org.jabref.gui.push; import org.jabref.Globals; +import org.jabref.gui.DialogService; import org.jabref.logic.l10n.Localization; import org.jabref.preferences.JabRefPreferences; public class PushToLyxSettings extends PushToApplicationSettings { + public PushToLyxSettings (DialogService dialogService) { super(dialogService); } + @Override protected void initJFXSettingsPanel() { super.initJFXSettingsPanel(); diff --git a/src/main/java/org/jabref/gui/push/PushToVimSettings.java b/src/main/java/org/jabref/gui/push/PushToVimSettings.java index ce94973675d..70438ed9115 100644 --- a/src/main/java/org/jabref/gui/push/PushToVimSettings.java +++ b/src/main/java/org/jabref/gui/push/PushToVimSettings.java @@ -4,6 +4,7 @@ import javafx.scene.control.TextField; import org.jabref.Globals; +import org.jabref.gui.DialogService; import org.jabref.logic.l10n.Localization; import org.jabref.preferences.JabRefPreferences; @@ -11,6 +12,8 @@ public class PushToVimSettings extends PushToApplicationSettings { private final TextField vimServer = new TextField(); + public PushToVimSettings (DialogService dialogService) { super(dialogService); } + @Override public void storeSettings() { super.storeSettings();