From c4567019ccd8647a02fc8347d19c3052b3b7f214 Mon Sep 17 00:00:00 2001 From: Carl Christian Snethlage Date: Tue, 21 May 2019 00:46:26 +0200 Subject: [PATCH] Refactor Constructors --- .../java/org/jabref/gui/preferences/ExternalTab.java | 2 +- .../org/jabref/gui/push/AbstractPushToApplication.java | 4 ---- .../java/org/jabref/gui/push/PushToApplication.java | 2 -- .../org/jabref/gui/push/PushToApplicationsManager.java | 10 +++++----- 4 files changed, 6 insertions(+), 12 deletions(-) diff --git a/src/main/java/org/jabref/gui/preferences/ExternalTab.java b/src/main/java/org/jabref/gui/preferences/ExternalTab.java index 08094d037f5..25c60b60f52 100644 --- a/src/main/java/org/jabref/gui/preferences/ExternalTab.java +++ b/src/main/java/org/jabref/gui/preferences/ExternalTab.java @@ -197,7 +197,7 @@ public Node getBuilder() { } private void addSettingsButton(final PushToApplication application, GridPane panel, int index) { - PushToApplicationSettings settings = PushToApplicationsManager.getSettings(application); + PushToApplicationSettings settings = PushToApplicationsManager.getSettings(application, dialogService); 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/AbstractPushToApplication.java b/src/main/java/org/jabref/gui/push/AbstractPushToApplication.java index 79bf0c46f1c..bbd62196773 100644 --- a/src/main/java/org/jabref/gui/push/AbstractPushToApplication.java +++ b/src/main/java/org/jabref/gui/push/AbstractPushToApplication.java @@ -34,10 +34,6 @@ public AbstractPushToApplication(DialogService dialogService) { this.dialogService = dialogService; } - public DialogService getDialogService() { - return this.dialogService; - } - @Override public String getName() { return Localization.lang("Push entries to external application (%0)", getApplicationName()); diff --git a/src/main/java/org/jabref/gui/push/PushToApplication.java b/src/main/java/org/jabref/gui/push/PushToApplication.java index 4fed1ebe229..855a9b6b9a0 100644 --- a/src/main/java/org/jabref/gui/push/PushToApplication.java +++ b/src/main/java/org/jabref/gui/push/PushToApplication.java @@ -20,8 +20,6 @@ public interface PushToApplication { JabRefIcon getIcon(); - DialogService getDialogService(); - /** * The actual operation. This method will not be called on the event dispatch thread, so it should not do GUI * operations without utilizing invokeLater(). diff --git a/src/main/java/org/jabref/gui/push/PushToApplicationsManager.java b/src/main/java/org/jabref/gui/push/PushToApplicationsManager.java index 60daeac6c65..43275f86216 100644 --- a/src/main/java/org/jabref/gui/push/PushToApplicationsManager.java +++ b/src/main/java/org/jabref/gui/push/PushToApplicationsManager.java @@ -25,15 +25,15 @@ public List getApplications() { return applications; } - public static PushToApplicationSettings getSettings(PushToApplication application) { + public static PushToApplicationSettings getSettings(PushToApplication application, DialogService dialogService) { if (application instanceof PushToEmacs) { - return new PushToEmacsSettings(application.getDialogService()); + return new PushToEmacsSettings(dialogService); } else if (application instanceof PushToLyx) { - return new PushToLyxSettings(application.getDialogService()); + return new PushToLyxSettings(dialogService); } else if (application instanceof PushToVim) { - return new PushToVimSettings(application.getDialogService()); + return new PushToVimSettings(dialogService); } else { - return new PushToApplicationSettings(application.getDialogService()); + return new PushToApplicationSettings(dialogService); } }