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

NPE-fix for Preferences/Ext-Prog/Settings for X/Browse #4983

Merged
merged 11 commits into from
May 21, 2019
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ public AbstractPushToApplication(DialogService dialogService) {
this.dialogService = dialogService;
}

calixtus marked this conversation as resolved.
Show resolved Hide resolved
public DialogService getDialogService() {
return this.dialogService;
}

@Override
public String getName() {
return Localization.lang("Push entries to external application (%0)", getApplicationName());
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/org/jabref/gui/push/PushToApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import java.util.List;

import org.jabref.gui.DialogService;
import org.jabref.gui.icon.JabRefIcon;
import org.jabref.model.database.BibDatabaseContext;
import org.jabref.model.entry.BibEntry;
Expand All @@ -19,6 +20,7 @@ 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ public List<PushToApplication> getApplications() {

public static PushToApplicationSettings getSettings(PushToApplication application) {
calixtus marked this conversation as resolved.
Show resolved Hide resolved
if (application instanceof PushToEmacs) {
calixtus marked this conversation as resolved.
Show resolved Hide resolved
return new PushToEmacsSettings();
return new PushToEmacsSettings(application.getDialogService());
} else if (application instanceof PushToLyx) {
return new PushToLyxSettings();
return new PushToLyxSettings(application.getDialogService());
} else if (application instanceof PushToVim) {
return new PushToVimSettings();
return new PushToVimSettings(application.getDialogService());
} else {
return new PushToApplicationSettings();
return new PushToApplicationSettings(application.getDialogService());
}
}

Expand Down
3 changes: 3 additions & 0 deletions src/main/java/org/jabref/gui/push/PushToEmacsSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,16 @@
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;

public class PushToEmacsSettings extends PushToApplicationSettings {

private final TextField additionalParams = new TextField();

public PushToEmacsSettings (DialogService dialogService) { super(dialogService); }

@Override
public void storeSettings() {
super.storeSettings();
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/org/jabref/gui/push/PushToLyxSettings.java
Original file line number Diff line number Diff line change
@@ -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();
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/org/jabref/gui/push/PushToVimSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,16 @@
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;

public class PushToVimSettings extends PushToApplicationSettings {

private final TextField vimServer = new TextField();

public PushToVimSettings (DialogService dialogService) { super(dialogService); }

@Override
public void storeSettings() {
super.storeSettings();
Expand Down