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

Add sublime text editor as external push application #10104

Merged
merged 16 commits into from
Jul 31, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
1 change: 1 addition & 0 deletions src/main/java/org/jabref/gui/icon/IconTheme.java
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@ public enum JabRefIcons implements JabRefIcon {
APPLICATION_TEXMAKER(JabRefMaterialDesignIcon.TEX_MAKER),
APPLICATION_VIM(JabRefMaterialDesignIcon.VIM),
APPLICATION_WINEDT(JabRefMaterialDesignIcon.WINEDT),
APPLICATION_SUBLIMETEXT(MaterialDesignA.APPLICATION),
KEY_BINDINGS(MaterialDesignK.KEYBOARD),
FIND_DUPLICATES(MaterialDesignC.CODE_EQUAL),
CONNECT_DB(MaterialDesignC.CLOUD_UPLOAD),
Expand Down
1 change: 1 addition & 0 deletions src/main/java/org/jabref/gui/push/PushToApplications.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public static List<PushToApplication> getAllApplications(DialogService dialogSer
APPLICATIONS.addAll(List.of(
new PushToEmacs(dialogService, preferencesService),
new PushToLyx(dialogService, preferencesService),
new PushToSublimeText(dialogService, preferencesService),
new PushToTexmaker(dialogService, preferencesService),
new PushToTeXstudio(dialogService, preferencesService),
new PushToVim(dialogService, preferencesService),
Expand Down
33 changes: 33 additions & 0 deletions src/main/java/org/jabref/gui/push/PushToSublimeText.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package org.jabref.gui.push;
Siedlerchr marked this conversation as resolved.
Show resolved Hide resolved

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

/**
* Class for pushing entries into SublimeText.
*/
Siedlerchr marked this conversation as resolved.
Show resolved Hide resolved
public class PushToSublimeText extends AbstractPushToApplication {
Siedlerchr marked this conversation as resolved.
Show resolved Hide resolved

public static final String NAME = "SublimeText";

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

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

@Override
public JabRefIcon getApplicationIcon() {
return IconTheme.JabRefIcons.APPLICATION_SUBLIMETEXT;
}

@Override
protected String[] getCommandLine(String keyString) {
return new String[] {commandPath, "--command \'insert {\"characters\": \"\\", getCiteCommand() + "{" + keyString + "}\\}\'"};
Copy link
Contributor

@AdamWysokinski AdamWysokinski Jul 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've placed some backslashes incorrectly, I think the returned string should be:

return new String[] {commandPath, "--command \'insert {\"characters\": \"", getCiteCommand() + "{" + keyString + "}\"}\'"};

}
}