From 7481251ed8bf04b43d2bd153bf8fc569a27469bb Mon Sep 17 00:00:00 2001 From: Siedlerchr Date: Tue, 16 Apr 2019 18:45:47 +0200 Subject: [PATCH 1/2] Convert PushToApp Settings to javafx Replace Runnable with BackgroundThread in Push --- .../jabref/gui/preferences/ExternalTab.java | 2 +- .../jabref/gui/push/PushToApplication.java | 1 + .../gui/push/PushToApplicationAction.java | 28 +++-- .../gui/push/PushToApplicationSettings.java | 109 ++++++------------ .../push/PushToApplicationSettingsDialog.java | 60 ++-------- .../jabref/gui/push/PushToEmacsSettings.java | 28 ++--- .../java/org/jabref/gui/push/PushToLyx.java | 1 - .../jabref/gui/push/PushToLyxSettings.java | 14 +-- .../jabref/gui/push/PushToVimSettings.java | 22 ++-- 9 files changed, 87 insertions(+), 178 deletions(-) diff --git a/src/main/java/org/jabref/gui/preferences/ExternalTab.java b/src/main/java/org/jabref/gui/preferences/ExternalTab.java index 8ce4dced4e7..fc6603f9a95 100644 --- a/src/main/java/org/jabref/gui/preferences/ExternalTab.java +++ b/src/main/java/org/jabref/gui/preferences/ExternalTab.java @@ -177,7 +177,7 @@ private void addSettingsButton(final PushToApplication application, GridPane pan PushToApplicationSettings settings = PushToApplications.getSettings(application); Button button = new Button(Localization.lang("Settings for %0", application.getApplicationName())); button.setPrefSize(150, 20); - button.setOnAction(e -> PushToApplicationSettingsDialog.showSettingsDialog(null, settings, index)); + button.setOnAction(e -> PushToApplicationSettingsDialog.showSettingsDialog(dialogService, settings, index)); if ((index % 2) == 0) { panel.add(button, 1, (index / 2) + 1); } else { diff --git a/src/main/java/org/jabref/gui/push/PushToApplication.java b/src/main/java/org/jabref/gui/push/PushToApplication.java index 62a2649a2a8..a892becd602 100644 --- a/src/main/java/org/jabref/gui/push/PushToApplication.java +++ b/src/main/java/org/jabref/gui/push/PushToApplication.java @@ -21,6 +21,7 @@ public interface PushToApplication { JabRefIcon getIcon(); + /** * 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/PushToApplicationAction.java b/src/main/java/org/jabref/gui/push/PushToApplicationAction.java index e514a8fec55..3231a2a5e21 100644 --- a/src/main/java/org/jabref/gui/push/PushToApplicationAction.java +++ b/src/main/java/org/jabref/gui/push/PushToApplicationAction.java @@ -3,10 +3,7 @@ import java.util.List; import java.util.Optional; -import javax.swing.SwingUtilities; - import org.jabref.Globals; -import org.jabref.JabRefExecutorService; import org.jabref.gui.BasePanel; import org.jabref.gui.JabRefFrame; import org.jabref.gui.StateManager; @@ -14,6 +11,7 @@ import org.jabref.gui.actions.SimpleCommand; import org.jabref.gui.icon.JabRefIcon; import org.jabref.gui.keyboard.KeyBinding; +import org.jabref.gui.util.BackgroundTask; import org.jabref.logic.l10n.Localization; import org.jabref.model.entry.BibEntry; import org.jabref.preferences.JabRefPreferences; @@ -23,10 +21,10 @@ /** * An Action class representing the process of invoking a PushToApplication operation. */ -public class PushToApplicationAction extends SimpleCommand implements Runnable { +public class PushToApplicationAction extends SimpleCommand { - private PushToApplication operation; - private JabRefFrame frame; + private final PushToApplication operation; + private final JabRefFrame frame; private BasePanel panel; private List entries; @@ -50,6 +48,7 @@ private PushToApplication getLastUsedApplication(List pushAct public Action getActionInformation() { return new Action() { + @Override public Optional getIcon() { return Optional.of(operation.getIcon()); @@ -85,7 +84,7 @@ public void execute() { entries = panel.getSelectedEntries(); if (entries.isEmpty()) { frame.getDialogService().showErrorDialogAndWait(operation.getApplicationName(), - Localization.lang("This operation requires one or more entries to be selected.")); + Localization.lang("This operation requires one or more entries to be selected.")); return; } @@ -95,7 +94,7 @@ public void execute() { for (BibEntry entry : entries) { if (!(entry.getCiteKeyOptional().isPresent()) || entry.getCiteKeyOptional().get().trim().isEmpty()) { frame.getDialogService().showErrorDialogAndWait(operation.getApplicationName(), - Localization.lang("This operation requires all selected entries to have BibTeX keys defined.")); + Localization.lang("This operation requires all selected entries to have BibTeX keys defined.")); return; } @@ -103,16 +102,15 @@ public void execute() { } // All set, call the operation in a new thread: - JabRefExecutorService.INSTANCE.execute(this); + + BackgroundTask.wrap(this::pushentries) + .onSuccess(s -> operation.operationCompleted(panel)) + .executeWith(Globals.TASK_EXECUTOR); + } - @Override - public void run() { - // Do the operation: + private void pushentries() { operation.pushEntries(panel.getDatabase(), entries, getKeyString(entries), panel.getBibDatabaseContext().getMetaData()); - - // Call the operationCompleted() method on the event dispatch thread: - SwingUtilities.invokeLater(() -> operation.operationCompleted(panel)); } private static String getKeyString(List bibentries) { diff --git a/src/main/java/org/jabref/gui/push/PushToApplicationSettings.java b/src/main/java/org/jabref/gui/push/PushToApplicationSettings.java index 7f35bb9f59a..7201c68c2d1 100644 --- a/src/main/java/org/jabref/gui/push/PushToApplicationSettings.java +++ b/src/main/java/org/jabref/gui/push/PushToApplicationSettings.java @@ -1,102 +1,63 @@ package org.jabref.gui.push; -import javax.swing.JButton; import javax.swing.JPanel; -import javax.swing.JTextField; import javafx.scene.control.Button; +import javafx.scene.control.DialogPane; import javafx.scene.control.Label; import javafx.scene.control.TextField; import javafx.scene.layout.GridPane; import org.jabref.Globals; import org.jabref.gui.DialogService; -import org.jabref.gui.util.DefaultTaskExecutor; import org.jabref.gui.util.FileDialogConfiguration; import org.jabref.logic.l10n.Localization; import org.jabref.preferences.JabRefPreferences; import com.jgoodies.forms.builder.FormBuilder; -import com.jgoodies.forms.layout.FormLayout; public class PushToApplicationSettings { - protected final JTextField path = new JTextField(30); + protected final TextField path1 = new TextField(); protected JPanel settings; protected GridPane jfxSettings; protected FormBuilder builder; protected AbstractPushToApplication application; - private DialogService dialogService; + protected DialogService dialogService; + protected DialogPane dialogPane = new DialogPane(); - /** - * This method asks the implementing class to return a JPanel populated with the imlementation's options panel, if - * necessary. If the JPanel is shown to the user, and the user indicates that settings should be stored, the - * implementation's storeSettings() method will be called. This method must make sure all widgets in the panel are - * in the correct selection states. - * - * @return a JPanel containing options, or null if options are not needed. - */ - public JPanel getSettingsPanel(int n) { + public GridPane getJFXSettingPane(int n) { switch (n) { - case 0: application = new PushToEmacs(dialogService); - break; - case 1: application = new PushToLyx(dialogService); - break; - case 2: application = new PushToTexmaker(dialogService); - break; - case 3: application = new PushToTeXstudio(dialogService); - break; - case 4: application = new PushToVim(dialogService); - break; - case 5: application = new PushToWinEdt(dialogService); - break; - default: application = null; - break; + case 0: + application = new PushToEmacs(dialogService); + break; + case 1: + application = new PushToLyx(dialogService); + break; + case 2: + application = new PushToTexmaker(dialogService); + break; + case 3: + application = new PushToTeXstudio(dialogService); + break; + case 4: + application = new PushToVim(dialogService); + break; + case 5: + application = new PushToWinEdt(dialogService); + break; + default: + application = null; + break; } - application.initParameters(); - String commandPath = Globals.prefs.get(application.commandPathPreferenceKey); - if (settings == null) { - initSettingsPanel(); - } - path.setText(commandPath); - return settings; - } - - public GridPane getJFXSettingPane() { application.initParameters(); String commandPath = Globals.prefs.get(application.commandPathPreferenceKey); if (jfxSettings == null) { initJFXSettingsPanel(); } path1.setText(commandPath); - return jfxSettings; - } - - /** - * Create a FormBuilder, fill it with a textbox for the path and store the JPanel in settings - */ - protected void initSettingsPanel() { - builder = FormBuilder.create(); - builder.layout(new FormLayout("left:pref, 4dlu, fill:pref:grow, 4dlu, fill:pref", "p")); - StringBuilder label = new StringBuilder(Localization.lang("Path to %0", application.commandPathPreferenceKey)); - // In case the application name and the actual command is not the same, add the command in brackets - if (application.getCommandName() == null) { - label.append(':'); - } else { - label.append(" (").append(application.getCommandName()).append("):"); - } - builder.add(label.toString()).xy(1, 1); - builder.add(path).xy(3, 1); - JButton browse = new JButton(Localization.lang("Browse")); - FileDialogConfiguration fileDialogConfiguration = new FileDialogConfiguration.Builder() - .withInitialDirectory(Globals.prefs.get(JabRefPreferences.WORKING_DIRECTORY)).build(); - - browse.addActionListener( - e -> DefaultTaskExecutor.runInJavaFXThread(() -> dialogService.showFileOpenDialog(fileDialogConfiguration)) - .ifPresent(f -> path.setText(f.toAbsolutePath().toString()))); - builder.add(browse).xy(5, 1); - settings = builder.build(); + return jfxSettings; } protected void initJFXSettingsPanel() { @@ -108,17 +69,17 @@ protected void initJFXSettingsPanel() { } else { label.append(" (").append(application.getCommandName()).append("):"); } - jfxSettings.add(new Label(label.toString()),1,1); - jfxSettings.add(path1,2, 1); + jfxSettings.add(new Label(label.toString()), 0, 0); + jfxSettings.add(path1, 1, 0); Button browse = new Button(Localization.lang("Browse")); FileDialogConfiguration fileDialogConfiguration = new FileDialogConfiguration.Builder() - .withInitialDirectory(Globals.prefs.get(JabRefPreferences.WORKING_DIRECTORY)).build(); + .withInitialDirectory(Globals.prefs.get(JabRefPreferences.WORKING_DIRECTORY)).build(); - browse.setOnAction( - e -> DefaultTaskExecutor.runInJavaFXThread(() -> dialogService.showFileOpenDialog(fileDialogConfiguration)) - .ifPresent(f -> path.setText(f.toAbsolutePath().toString()))); - jfxSettings.add(browse,3, 1); + browse.setOnAction(e -> dialogService.showFileOpenDialog(fileDialogConfiguration) + .ifPresent(f -> path1.setText(f.toAbsolutePath().toString()))); + jfxSettings.add(browse, 2, 0); + dialogPane.setContent(jfxSettings); } /** @@ -127,6 +88,6 @@ protected void initJFXSettingsPanel() { * state of the widgets in the settings panel to Globals.prefs. */ public void storeSettings() { - Globals.prefs.put(application.commandPathPreferenceKey, path.getText()); + Globals.prefs.put(application.commandPathPreferenceKey, path1.getText()); } } diff --git a/src/main/java/org/jabref/gui/push/PushToApplicationSettingsDialog.java b/src/main/java/org/jabref/gui/push/PushToApplicationSettingsDialog.java index f754941839e..5c7123e9eeb 100644 --- a/src/main/java/org/jabref/gui/push/PushToApplicationSettingsDialog.java +++ b/src/main/java/org/jabref/gui/push/PushToApplicationSettingsDialog.java @@ -1,61 +1,21 @@ package org.jabref.gui.push; -import java.awt.BorderLayout; -import java.awt.event.ActionEvent; +import javafx.scene.control.ButtonType; +import javafx.scene.control.DialogPane; -import javax.swing.AbstractAction; -import javax.swing.ActionMap; -import javax.swing.BorderFactory; -import javax.swing.InputMap; -import javax.swing.JButton; -import javax.swing.JComponent; -import javax.swing.JDialog; -import javax.swing.JFrame; -import javax.swing.JPanel; - -import org.jabref.Globals; -import org.jabref.gui.keyboard.KeyBinding; -import org.jabref.logic.l10n.Localization; - -import com.jgoodies.forms.builder.ButtonBarBuilder; +import org.jabref.gui.DialogService; public class PushToApplicationSettingsDialog { - public static void showSettingsDialog(JFrame parent, PushToApplicationSettings toApp, int n) { - final JDialog diag = new JDialog(parent, Localization.lang("Settings"), true); - JPanel options = toApp.getSettingsPanel(n); - options.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); - diag.getContentPane().add(options, BorderLayout.CENTER); - ButtonBarBuilder bb = new ButtonBarBuilder(); - JButton ok = new JButton(Localization.lang("OK")); - JButton cancel = new JButton(Localization.lang("Cancel")); - bb.addGlue(); - bb.addButton(ok); - bb.addButton(cancel); - bb.addGlue(); - bb.getPanel().setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); - diag.getContentPane().add(bb.getPanel(), BorderLayout.SOUTH); - ok.addActionListener(e -> { - // If the user pressed Ok, ask the PushToApplication implementation to store its settings: - toApp.storeSettings(); - diag.dispose(); - }); - cancel.addActionListener(e -> diag.dispose()); - // Key bindings: - ActionMap am = bb.getPanel().getActionMap(); - InputMap im = bb.getPanel().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW); - im.put(Globals.getKeyPrefs().getKey(KeyBinding.CLOSE), "close"); - am.put("close", new AbstractAction() { + public static void showSettingsDialog(DialogService dialogService, PushToApplicationSettings toApp, int n) { - @Override - public void actionPerformed(ActionEvent e) { - diag.dispose(); + DialogPane dialogPane = new DialogPane(); + dialogPane.setContent(toApp.getJFXSettingPane(n)); + + dialogService.showCustomDialogAndWait("App settings", dialogPane, ButtonType.OK, ButtonType.CANCEL).ifPresent(btn -> { + if (btn == ButtonType.OK) { + toApp.storeSettings(); } }); - diag.pack(); - diag.setLocationRelativeTo(parent); - - // Show the dialog: - diag.setVisible(true); } } diff --git a/src/main/java/org/jabref/gui/push/PushToEmacsSettings.java b/src/main/java/org/jabref/gui/push/PushToEmacsSettings.java index e0a44562625..edd0f847e2a 100644 --- a/src/main/java/org/jabref/gui/push/PushToEmacsSettings.java +++ b/src/main/java/org/jabref/gui/push/PushToEmacsSettings.java @@ -1,8 +1,7 @@ package org.jabref.gui.push; -import javax.swing.JPanel; -import javax.swing.JTextField; - +import javafx.scene.control.Label; +import javafx.scene.control.TextField; import javafx.scene.layout.GridPane; import org.jabref.Globals; @@ -11,18 +10,12 @@ public class PushToEmacsSettings extends PushToApplicationSettings { - private final JTextField additionalParams = new JTextField(30); - - @Override - public JPanel getSettingsPanel(int n) { - additionalParams.setText(Globals.prefs.get(JabRefPreferences.EMACS_ADDITIONAL_PARAMETERS)); - return super.getSettingsPanel(n); - } + private final TextField additionalParams = new TextField(); @Override - public GridPane getJFXSettingPane() { + public GridPane getJFXSettingPane(int n) { additionalParams.setText(Globals.prefs.get(JabRefPreferences.EMACS_ADDITIONAL_PARAMETERS)); - return super.getJFXSettingPane(); + return super.getJFXSettingPane(n); } @Override @@ -32,11 +25,10 @@ public void storeSettings() { } @Override - protected void initSettingsPanel() { - super.initSettingsPanel(); - builder.appendRows("2dlu, p, 2dlu, p"); - builder.add(Localization.lang("Additional parameters") + ":").xy(1, 3); - builder.add(additionalParams).xy(3, 3); - settings = builder.build(); + protected void initJFXSettingsPanel() { + super.initJFXSettingsPanel(); + jfxSettings.add(new Label(Localization.lang("Additional parameters") + ":"), 0, 1); + jfxSettings.add(additionalParams, 1, 1); } + } diff --git a/src/main/java/org/jabref/gui/push/PushToLyx.java b/src/main/java/org/jabref/gui/push/PushToLyx.java index 265d9f0fbbe..f1b58c1ec6f 100644 --- a/src/main/java/org/jabref/gui/push/PushToLyx.java +++ b/src/main/java/org/jabref/gui/push/PushToLyx.java @@ -61,7 +61,6 @@ public void operationCompleted(BasePanel panel) { @Override public void pushEntries(BibDatabase database, final List entries, final String keyString, MetaData metaData) { - couldNotConnect = false; couldNotCall = false; notDefined = false; diff --git a/src/main/java/org/jabref/gui/push/PushToLyxSettings.java b/src/main/java/org/jabref/gui/push/PushToLyxSettings.java index eeb35ed812d..c65eef119c5 100644 --- a/src/main/java/org/jabref/gui/push/PushToLyxSettings.java +++ b/src/main/java/org/jabref/gui/push/PushToLyxSettings.java @@ -1,17 +1,15 @@ package org.jabref.gui.push; -import javax.swing.JLabel; -import javax.swing.JPanel; +import javafx.scene.layout.GridPane; -import org.jabref.logic.l10n.Localization; +import org.jabref.Globals; +import org.jabref.preferences.JabRefPreferences; public class PushToLyxSettings extends PushToApplicationSettings { @Override - protected void initSettingsPanel() { - super.initSettingsPanel(); - settings = new JPanel(); - settings.add(new JLabel(Localization.lang("Path to LyX pipe") + ":")); - settings.add(path); + public GridPane getJFXSettingPane(int n) { + path1.setText(Globals.prefs.get(JabRefPreferences.LYXPIPE)); + return super.getJFXSettingPane(n); } } diff --git a/src/main/java/org/jabref/gui/push/PushToVimSettings.java b/src/main/java/org/jabref/gui/push/PushToVimSettings.java index 89ceab1d37b..f08e68e1a09 100644 --- a/src/main/java/org/jabref/gui/push/PushToVimSettings.java +++ b/src/main/java/org/jabref/gui/push/PushToVimSettings.java @@ -1,7 +1,8 @@ package org.jabref.gui.push; -import javax.swing.JPanel; -import javax.swing.JTextField; +import javafx.scene.control.Label; +import javafx.scene.control.TextField; +import javafx.scene.layout.GridPane; import org.jabref.Globals; import org.jabref.logic.l10n.Localization; @@ -9,12 +10,12 @@ public class PushToVimSettings extends PushToApplicationSettings { - private final JTextField vimServer = new JTextField(30); + private final TextField vimServer = new TextField(); @Override - public JPanel getSettingsPanel(int n) { + public GridPane getJFXSettingPane(int n) { vimServer.setText(Globals.prefs.get(JabRefPreferences.VIM_SERVER)); - return super.getSettingsPanel(n); + return super.getJFXSettingPane(n); } @Override @@ -24,11 +25,10 @@ public void storeSettings() { } @Override - protected void initSettingsPanel() { - super.initSettingsPanel(); - builder.appendRows("2dlu, p"); - builder.add(Localization.lang("Vim server name") + ":").xy(1, 3); - builder.add(vimServer).xy(3, 3); - settings = builder.build(); + protected void initJFXSettingsPanel() { + super.initJFXSettingsPanel(); + jfxSettings.add(new Label(Localization.lang("Vim server name") + ":"), 0, 1); + jfxSettings.add(vimServer, 1, 1); + } } From f7cba5bde4b23da8bde62846083f080ab9c588d0 Mon Sep 17 00:00:00 2001 From: Siedlerchr Date: Thu, 18 Apr 2019 13:25:18 +0200 Subject: [PATCH 2/2] Remove old swing code Rename variable Only overwrite one method --- .../gui/push/PushToApplicationSettings.java | 25 +++++++------------ .../push/PushToApplicationSettingsDialog.java | 3 ++- .../jabref/gui/push/PushToEmacsSettings.java | 9 +------ .../jabref/gui/push/PushToLyxSettings.java | 10 ++++---- .../jabref/gui/push/PushToVimSettings.java | 9 +------ src/main/resources/l10n/JabRef_en.properties | 1 + 6 files changed, 19 insertions(+), 38 deletions(-) diff --git a/src/main/java/org/jabref/gui/push/PushToApplicationSettings.java b/src/main/java/org/jabref/gui/push/PushToApplicationSettings.java index 7201c68c2d1..d0818faf106 100644 --- a/src/main/java/org/jabref/gui/push/PushToApplicationSettings.java +++ b/src/main/java/org/jabref/gui/push/PushToApplicationSettings.java @@ -1,9 +1,6 @@ package org.jabref.gui.push; -import javax.swing.JPanel; - import javafx.scene.control.Button; -import javafx.scene.control.DialogPane; import javafx.scene.control.Label; import javafx.scene.control.TextField; import javafx.scene.layout.GridPane; @@ -14,17 +11,13 @@ import org.jabref.logic.l10n.Localization; import org.jabref.preferences.JabRefPreferences; -import com.jgoodies.forms.builder.FormBuilder; - public class PushToApplicationSettings { - protected final TextField path1 = new TextField(); - protected JPanel settings; + protected final TextField path = new TextField(); + protected Label commandLabel = new Label(); protected GridPane jfxSettings; - protected FormBuilder builder; protected AbstractPushToApplication application; - protected DialogService dialogService; - protected DialogPane dialogPane = new DialogPane(); + private DialogService dialogService; public GridPane getJFXSettingPane(int n) { switch (n) { @@ -55,7 +48,7 @@ public GridPane getJFXSettingPane(int n) { if (jfxSettings == null) { initJFXSettingsPanel(); } - path1.setText(commandPath); + path.setText(commandPath); return jfxSettings; } @@ -69,17 +62,17 @@ protected void initJFXSettingsPanel() { } else { label.append(" (").append(application.getCommandName()).append("):"); } - jfxSettings.add(new Label(label.toString()), 0, 0); - jfxSettings.add(path1, 1, 0); + commandLabel = new Label(label.toString()); + jfxSettings.add(commandLabel, 0, 0); + jfxSettings.add(path, 1, 0); Button browse = new Button(Localization.lang("Browse")); FileDialogConfiguration fileDialogConfiguration = new FileDialogConfiguration.Builder() .withInitialDirectory(Globals.prefs.get(JabRefPreferences.WORKING_DIRECTORY)).build(); browse.setOnAction(e -> dialogService.showFileOpenDialog(fileDialogConfiguration) - .ifPresent(f -> path1.setText(f.toAbsolutePath().toString()))); + .ifPresent(f -> path.setText(f.toAbsolutePath().toString()))); jfxSettings.add(browse, 2, 0); - dialogPane.setContent(jfxSettings); } /** @@ -88,6 +81,6 @@ protected void initJFXSettingsPanel() { * state of the widgets in the settings panel to Globals.prefs. */ public void storeSettings() { - Globals.prefs.put(application.commandPathPreferenceKey, path1.getText()); + Globals.prefs.put(application.commandPathPreferenceKey, path.getText()); } } diff --git a/src/main/java/org/jabref/gui/push/PushToApplicationSettingsDialog.java b/src/main/java/org/jabref/gui/push/PushToApplicationSettingsDialog.java index 5c7123e9eeb..4374c7322a0 100644 --- a/src/main/java/org/jabref/gui/push/PushToApplicationSettingsDialog.java +++ b/src/main/java/org/jabref/gui/push/PushToApplicationSettingsDialog.java @@ -4,6 +4,7 @@ import javafx.scene.control.DialogPane; import org.jabref.gui.DialogService; +import org.jabref.logic.l10n.Localization; public class PushToApplicationSettingsDialog { @@ -12,7 +13,7 @@ public static void showSettingsDialog(DialogService dialogService, PushToApplica DialogPane dialogPane = new DialogPane(); dialogPane.setContent(toApp.getJFXSettingPane(n)); - dialogService.showCustomDialogAndWait("App settings", dialogPane, ButtonType.OK, ButtonType.CANCEL).ifPresent(btn -> { + dialogService.showCustomDialogAndWait(Localization.lang("App settings"), dialogPane, ButtonType.OK, ButtonType.CANCEL).ifPresent(btn -> { if (btn == ButtonType.OK) { toApp.storeSettings(); } diff --git a/src/main/java/org/jabref/gui/push/PushToEmacsSettings.java b/src/main/java/org/jabref/gui/push/PushToEmacsSettings.java index edd0f847e2a..ca4cee137ac 100644 --- a/src/main/java/org/jabref/gui/push/PushToEmacsSettings.java +++ b/src/main/java/org/jabref/gui/push/PushToEmacsSettings.java @@ -2,7 +2,6 @@ import javafx.scene.control.Label; import javafx.scene.control.TextField; -import javafx.scene.layout.GridPane; import org.jabref.Globals; import org.jabref.logic.l10n.Localization; @@ -12,12 +11,6 @@ public class PushToEmacsSettings extends PushToApplicationSettings { private final TextField additionalParams = new TextField(); - @Override - public GridPane getJFXSettingPane(int n) { - additionalParams.setText(Globals.prefs.get(JabRefPreferences.EMACS_ADDITIONAL_PARAMETERS)); - return super.getJFXSettingPane(n); - } - @Override public void storeSettings() { super.storeSettings(); @@ -29,6 +22,6 @@ protected void initJFXSettingsPanel() { super.initJFXSettingsPanel(); jfxSettings.add(new Label(Localization.lang("Additional parameters") + ":"), 0, 1); jfxSettings.add(additionalParams, 1, 1); + additionalParams.setText(Globals.prefs.get(JabRefPreferences.EMACS_ADDITIONAL_PARAMETERS)); } - } diff --git a/src/main/java/org/jabref/gui/push/PushToLyxSettings.java b/src/main/java/org/jabref/gui/push/PushToLyxSettings.java index c65eef119c5..856f6fc86be 100644 --- a/src/main/java/org/jabref/gui/push/PushToLyxSettings.java +++ b/src/main/java/org/jabref/gui/push/PushToLyxSettings.java @@ -1,15 +1,15 @@ package org.jabref.gui.push; -import javafx.scene.layout.GridPane; - import org.jabref.Globals; +import org.jabref.logic.l10n.Localization; import org.jabref.preferences.JabRefPreferences; public class PushToLyxSettings extends PushToApplicationSettings { @Override - public GridPane getJFXSettingPane(int n) { - path1.setText(Globals.prefs.get(JabRefPreferences.LYXPIPE)); - return super.getJFXSettingPane(n); + protected void initJFXSettingsPanel() { + super.initJFXSettingsPanel(); + path.setText(Globals.prefs.get(JabRefPreferences.LYXPIPE)); + commandLabel.setText(Localization.lang("Path to LyX pipe") + ":"); } } diff --git a/src/main/java/org/jabref/gui/push/PushToVimSettings.java b/src/main/java/org/jabref/gui/push/PushToVimSettings.java index f08e68e1a09..ce94973675d 100644 --- a/src/main/java/org/jabref/gui/push/PushToVimSettings.java +++ b/src/main/java/org/jabref/gui/push/PushToVimSettings.java @@ -2,7 +2,6 @@ import javafx.scene.control.Label; import javafx.scene.control.TextField; -import javafx.scene.layout.GridPane; import org.jabref.Globals; import org.jabref.logic.l10n.Localization; @@ -12,12 +11,6 @@ public class PushToVimSettings extends PushToApplicationSettings { private final TextField vimServer = new TextField(); - @Override - public GridPane getJFXSettingPane(int n) { - vimServer.setText(Globals.prefs.get(JabRefPreferences.VIM_SERVER)); - return super.getJFXSettingPane(n); - } - @Override public void storeSettings() { super.storeSettings(); @@ -29,6 +22,6 @@ protected void initJFXSettingsPanel() { super.initJFXSettingsPanel(); jfxSettings.add(new Label(Localization.lang("Vim server name") + ":"), 0, 1); jfxSettings.add(vimServer, 1, 1); - + vimServer.setText(Globals.prefs.get(JabRefPreferences.VIM_SERVER)); } } diff --git a/src/main/resources/l10n/JabRef_en.properties b/src/main/resources/l10n/JabRef_en.properties index ce618ddac09..5fab7773dfe 100644 --- a/src/main/resources/l10n/JabRef_en.properties +++ b/src/main/resources/l10n/JabRef_en.properties @@ -2088,3 +2088,4 @@ A\ string\ with\ the\ label\ '%0'\ already\ exists.=A string with the label '%0' Executing\ command\ "%0"...=Executing command "%0"... +App\ settings=App settings