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

Extract PushTo names into model #8005

Merged
merged 3 commits into from
Aug 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/main/java/org/jabref/gui/push/PushToEmacs.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import org.jabref.logic.util.OS;
import org.jabref.model.database.BibDatabaseContext;
import org.jabref.model.entry.BibEntry;
import org.jabref.model.push.PushToApplicationConstants;
import org.jabref.preferences.PreferencesService;
import org.jabref.preferences.PushToApplicationPreferences;

Expand All @@ -22,7 +23,7 @@

public class PushToEmacs extends AbstractPushToApplication implements PushToApplication {

public static final String NAME = "Emacs";
public static final String NAME = PushToApplicationConstants.EMACS;

private static final Logger LOGGER = LoggerFactory.getLogger(PushToEmacs.class);

Expand Down
3 changes: 2 additions & 1 deletion src/main/java/org/jabref/gui/push/PushToLyx.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import org.jabref.logic.l10n.Localization;
import org.jabref.model.database.BibDatabaseContext;
import org.jabref.model.entry.BibEntry;
import org.jabref.model.push.PushToApplicationConstants;
import org.jabref.preferences.PreferencesService;
import org.jabref.preferences.PushToApplicationPreferences;

Expand All @@ -23,7 +24,7 @@

public class PushToLyx extends AbstractPushToApplication implements PushToApplication {

public static final String NAME = "LyX/Kile";
public static final String NAME = PushToApplicationConstants.LYX;

private static final Logger LOGGER = LoggerFactory.getLogger(PushToLyx.class);

Expand Down
3 changes: 2 additions & 1 deletion src/main/java/org/jabref/gui/push/PushToTeXstudio.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
import org.jabref.gui.DialogService;
import org.jabref.gui.icon.IconTheme;
import org.jabref.gui.icon.JabRefIcon;
import org.jabref.model.push.PushToApplicationConstants;
import org.jabref.preferences.PreferencesService;

public class PushToTeXstudio extends AbstractPushToApplication implements PushToApplication {

public static final String NAME = "TeXstudio";
public static final String NAME = PushToApplicationConstants.TEXSTUDIO;

public PushToTeXstudio(DialogService dialogService, PreferencesService preferencesService) {
super(dialogService, preferencesService);
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/org/jabref/gui/push/PushToVim.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import org.jabref.logic.l10n.Localization;
import org.jabref.model.database.BibDatabaseContext;
import org.jabref.model.entry.BibEntry;
import org.jabref.model.push.PushToApplicationConstants;
import org.jabref.preferences.PreferencesService;
import org.jabref.preferences.PushToApplicationPreferences;

Expand All @@ -21,7 +22,7 @@

public class PushToVim extends AbstractPushToApplication implements PushToApplication {

public static final String NAME = "Vim";
public static final String NAME = PushToApplicationConstants.VIM;

private static final Logger LOGGER = LoggerFactory.getLogger(PushToVim.class);

Expand Down
3 changes: 2 additions & 1 deletion src/main/java/org/jabref/gui/push/PushToWinEdt.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
import org.jabref.gui.DialogService;
import org.jabref.gui.icon.IconTheme;
import org.jabref.gui.icon.JabRefIcon;
import org.jabref.model.push.PushToApplicationConstants;
import org.jabref.preferences.PreferencesService;

public class PushToWinEdt extends AbstractPushToApplication implements PushToApplication {

public static final String NAME = "WinEdt";
public static final String NAME = PushToApplicationConstants.WIN_EDT;

public PushToWinEdt(DialogService dialogService, PreferencesService preferencesService) {
super(dialogService, preferencesService);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package org.jabref.model.push;

public class PushToApplicationConstants {

public static final String EMACS = "Emacs";
public static final String LYX = "LyX/Kile";
public static final String TEXMAKER = "Texmaker";
public static final String TEXSTUDIO = "TeXstudio";
public static final String VIM = "Vim";
public static final String WIN_EDT = "WinEdt";

private PushToApplicationConstants() {
}

}
31 changes: 13 additions & 18 deletions src/main/java/org/jabref/preferences/JabRefPreferences.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,6 @@
import org.jabref.gui.maintable.MainTableNameFormatPreferences.DisplayStyle;
import org.jabref.gui.maintable.MainTablePreferences;
import org.jabref.gui.mergeentries.MergeEntries;
import org.jabref.gui.push.PushToEmacs;
import org.jabref.gui.push.PushToLyx;
import org.jabref.gui.push.PushToTeXstudio;
import org.jabref.gui.push.PushToTexmaker;
import org.jabref.gui.push.PushToVim;
import org.jabref.gui.push.PushToWinEdt;
import org.jabref.gui.search.SearchDisplayMode;
import org.jabref.gui.specialfields.SpecialFieldsPreferences;
import org.jabref.gui.util.Theme;
Expand Down Expand Up @@ -111,6 +105,7 @@
import org.jabref.model.entry.types.EntryType;
import org.jabref.model.entry.types.EntryTypeFactory;
import org.jabref.model.metadata.SaveOrderConfig;
import org.jabref.model.push.PushToApplicationConstants;
import org.jabref.model.strings.StringUtil;

import org.slf4j.Logger;
Expand Down Expand Up @@ -1746,12 +1741,12 @@ public void storeCitationKeyPatternPreferences(CitationKeyPatternPreferences pre
@Override
public PushToApplicationPreferences getPushToApplicationPreferences() {
Map<String, String> applicationCommands = new HashMap<>();
applicationCommands.put(PushToEmacs.NAME, get(PUSH_EMACS_PATH));
applicationCommands.put(PushToLyx.NAME, get(PUSH_LYXPIPE));
applicationCommands.put(PushToTexmaker.NAME, get(PUSH_TEXMAKER_PATH));
applicationCommands.put(PushToTeXstudio.NAME, get(PUSH_TEXSTUDIO_PATH));
applicationCommands.put(PushToVim.NAME, get(PUSH_VIM));
applicationCommands.put(PushToWinEdt.NAME, get(PUSH_WINEDT_PATH));
applicationCommands.put(PushToApplicationConstants.EMACS, get(PUSH_EMACS_PATH));
applicationCommands.put(PushToApplicationConstants.LYX, get(PUSH_LYXPIPE));
applicationCommands.put(PushToApplicationConstants.TEXMAKER, get(PUSH_TEXMAKER_PATH));
applicationCommands.put(PushToApplicationConstants.TEXSTUDIO, get(PUSH_TEXSTUDIO_PATH));
applicationCommands.put(PushToApplicationConstants.VIM, get(PUSH_VIM));
applicationCommands.put(PushToApplicationConstants.WIN_EDT, get(PUSH_WINEDT_PATH));

return new PushToApplicationPreferences(
applicationCommands,
Expand All @@ -1762,12 +1757,12 @@ public PushToApplicationPreferences getPushToApplicationPreferences() {

@Override
public void storePushToApplicationPreferences(PushToApplicationPreferences preferences) {
put(PUSH_EMACS_PATH, preferences.getPushToApplicationCommandPaths().get(PushToEmacs.NAME));
put(PUSH_LYXPIPE, preferences.getPushToApplicationCommandPaths().get(PushToLyx.NAME));
put(PUSH_TEXMAKER_PATH, preferences.getPushToApplicationCommandPaths().get(PushToTexmaker.NAME));
put(PUSH_TEXSTUDIO_PATH, preferences.getPushToApplicationCommandPaths().get(PushToTeXstudio.NAME));
put(PUSH_VIM, preferences.getPushToApplicationCommandPaths().get(PushToVim.NAME));
put(PUSH_WINEDT_PATH, preferences.getPushToApplicationCommandPaths().get(PushToWinEdt.NAME));
put(PUSH_EMACS_PATH, preferences.getPushToApplicationCommandPaths().get(PushToApplicationConstants.EMACS));
put(PUSH_LYXPIPE, preferences.getPushToApplicationCommandPaths().get(PushToApplicationConstants.LYX));
put(PUSH_TEXMAKER_PATH, preferences.getPushToApplicationCommandPaths().get(PushToApplicationConstants.TEXMAKER));
put(PUSH_TEXSTUDIO_PATH, preferences.getPushToApplicationCommandPaths().get(PushToApplicationConstants.TEXSTUDIO));
put(PUSH_VIM, preferences.getPushToApplicationCommandPaths().get(PushToApplicationConstants.VIM));
put(PUSH_WINEDT_PATH, preferences.getPushToApplicationCommandPaths().get(PushToApplicationConstants.WIN_EDT));

put(PUSH_EMACS_ADDITIONAL_PARAMETERS, preferences.getEmacsArguments());
put(PUSH_VIM_SERVER, preferences.getVimServer());
Expand Down