Skip to content

Commit

Permalink
add TeXworks (Icon needs fixing) (JabRef#3197)
Browse files Browse the repository at this point in the history
Co-Authored-By: JohannBiorck <85625348+johannbiorck@users.noreply.github.com>
  • Loading branch information
Blezie and JohannBiorck committed Feb 26, 2024
1 parent 9bce374 commit 87bbea2
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/main/java/org/jabref/gui/push/PushToApplications.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public class PushToApplications {
public static final String LYX = "LyX/Kile";
public static final String TEXMAKER = "Texmaker";
public static final String TEXSTUDIO = "TeXstudio";
public static final String TEXWORKS = "TeXworks";
public static final String VIM = "Vim";
public static final String WIN_EDT = "WinEdt";
public static final String SUBLIME_TEXT = "Sublime Text";
Expand All @@ -34,6 +35,7 @@ public static List<PushToApplication> getAllApplications(DialogService dialogSer
new PushToSublimeText(dialogService, preferencesService),
new PushToTexmaker(dialogService, preferencesService),
new PushToTeXstudio(dialogService, preferencesService),
new PushToTeXworks(dialogService, preferencesService),
new PushToVim(dialogService, preferencesService),
new PushToWinEdt(dialogService, preferencesService),
new PushToTexShop(dialogService, preferencesService)));
Expand Down
30 changes: 30 additions & 0 deletions src/main/java/org/jabref/gui/push/PushToTeXworks.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package org.jabref.gui.push;

import org.jabref.gui.DialogService;
import org.jabref.gui.icon.IconTheme;
import org.jabref.gui.icon.JabRefIcon;
import org.jabref.preferences.PreferencesService;

public class PushToTeXworks extends AbstractPushToApplication {

public static final String NAME = PushToApplications.TEXWORKS;

public PushToTeXworks(DialogService dialogService, PreferencesService preferencesService) {
super(dialogService, preferencesService);
}

@Override
public String getDisplayName() {
return NAME;
}

@Override
public JabRefIcon getApplicationIcon() {
return IconTheme.JabRefIcons.APPLICATION_TEXSTUDIO; // Temporary Icon that needs to be changed
}

@Override
protected String[] getCommandLine(String keyString) {
return new String[] {commandPath, "--insert-text", "%s%s%s".formatted(getCitePrefix(), keyString, getCiteSuffix())};
}
}
4 changes: 4 additions & 0 deletions src/main/java/org/jabref/preferences/JabRefPreferences.java
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ public class JabRefPreferences implements PreferencesService {
public static final String PUSH_EMACS_ADDITIONAL_PARAMETERS = "emacsParameters";
public static final String PUSH_LYXPIPE = "lyxpipe";
public static final String PUSH_TEXSTUDIO_PATH = "TeXstudioPath";
public static final String PUSH_TEXWORKS_PATH = "TeXworksPath";
public static final String PUSH_WINEDT_PATH = "winEdtPath";
public static final String PUSH_TEXMAKER_PATH = "texmakerPath";
public static final String PUSH_VIM_SERVER = "vimServer";
Expand Down Expand Up @@ -540,6 +541,7 @@ private JabRefPreferences() {
defaults.put(PUSH_TEXMAKER_PATH, OS.getNativeDesktop().detectProgramPath("texmaker", "Texmaker"));
defaults.put(PUSH_WINEDT_PATH, OS.getNativeDesktop().detectProgramPath("WinEdt", "WinEdt Team\\WinEdt"));
defaults.put(PUSH_TEXSTUDIO_PATH, OS.getNativeDesktop().detectProgramPath("texstudio", "TeXstudio"));
defaults.put(PUSH_TEXWORKS_PATH, OS.getNativeDesktop().detectProgramPath("texworks", "TeXworks"));
defaults.put(PUSH_SUBLIME_TEXT_PATH, OS.getNativeDesktop().detectProgramPath("subl", "Sublime"));
defaults.put(PUSH_LYXPIPE, USER_HOME + File.separator + ".lyx/lyxpipe");
defaults.put(PUSH_VIM, "vim");
Expand Down Expand Up @@ -1806,6 +1808,8 @@ private void storePushToApplicationPath(Map<String, String> commandPair) {
put(PUSH_TEXMAKER_PATH, value);
case PushToApplications.TEXSTUDIO ->
put(PUSH_TEXSTUDIO_PATH, value);
case PushToApplications.TEXWORKS ->
put(PUSH_TEXWORKS_PATH, value);
case PushToApplications.VIM ->
put(PUSH_VIM, value);
case PushToApplications.WIN_EDT ->
Expand Down

0 comments on commit 87bbea2

Please sign in to comment.