Skip to content
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
ee50022
change CAYWEntry.java from class to record
palukku Jul 4, 2025
a20d7b2
Merge branch 'JabRef:main' into cayw
palukku Jul 5, 2025
0dcaab6
refactor
palukku Jul 5, 2025
1863499
replace id hash with sharedID
palukku Jul 5, 2025
8dd9c7c
Merge branch 'JabRef:main' into cayw
palukku Jul 6, 2025
0eba897
Merge branch 'JabRef:main' into cayw
palukku Jul 7, 2025
26655cd
Refactor PushToApplications and move the logic part to jablib
palukku Jul 8, 2025
2c66a6d
Merge remote-tracking branch 'origin/cayw' into cayw
palukku Jul 8, 2025
96d79bc
Add Prefix GUI to all gui classes
palukku Jul 8, 2025
02677ef
Merge branch 'JabRef:main' into cayw
palukku Jul 8, 2025
63cf18c
Move Cite Command Preferences from ExternalApplicationsPreferences to…
palukku Jul 8, 2025
7acb3c0
Merge remote-tracking branch 'origin/cayw' into cayw
palukku Jul 8, 2025
a13d704
Merge branch 'JabRef:main' into cayw
palukku Jul 8, 2025
bfe016f
fix wrong changes
palukku Jul 8, 2025
eed07db
Merge remote-tracking branch 'origin/cayw' into cayw
palukku Jul 8, 2025
124abf4
change field name
palukku Jul 8, 2025
7432cd5
checkstyle and rewriterun
palukku Jul 8, 2025
e80d7d7
add private constructor
palukku Jul 8, 2025
d1cb260
refactor
palukku Jul 8, 2025
881b650
use orElseGet instead of orElse
palukku Jul 8, 2025
19792bf
Merge branch 'main' into cayw
palukku Jul 9, 2025
2b2ad7b
Reduce Gui classes by extending the interfaces with default methods
palukku Jul 9, 2025
566ba96
Add methods for error notification routing and update citation comman…
koppor Jul 9, 2025
ba8aa2b
delete
palukku Jul 9, 2025
7372e55
Merge branch 'cayw-2' into cayw
palukku Jul 9, 2025
552206c
rename
palukku Jul 9, 2025
43c632f
Streamline signature for pushEntries
koppor Jul 9, 2025
dc5e8db
Merge branch 'JabRef:main' into cayw
palukku Jul 9, 2025
ec2bc1e
introduce Applications Enum and change CLI PushToApplications factory.
palukku Jul 9, 2025
b78f9b8
Add doc
koppor Jul 9, 2025
12d89f0
refactor
palukku Jul 9, 2025
ce96f31
fix tests
palukku Jul 9, 2025
b25a985
fix tests2
palukku Jul 9, 2025
282325d
Merge branch 'main' into cayw
palukku Jul 9, 2025
13de083
Merge branch 'main' into cayw
palukku Jul 10, 2025
6be78f2
add ability to cayw to push to other applications
palukku Jul 10, 2025
e1a9c52
rename wrong variables
palukku Jul 10, 2025
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
2 changes: 1 addition & 1 deletion jabgui/src/main/java/org/jabref/gui/desktop/os/Linux.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
import org.jabref.gui.externalfiletype.ExternalFileType;
import org.jabref.gui.externalfiletype.ExternalFileTypes;
import org.jabref.gui.frame.ExternalApplicationsPreferences;
import org.jabref.gui.util.StreamGobbler;
import org.jabref.logic.l10n.Localization;
import org.jabref.logic.util.Directories;
import org.jabref.logic.util.HeadlessExecutorService;
import org.jabref.logic.util.StreamGobbler;

import org.slf4j.LoggerFactory;

Expand Down
4 changes: 2 additions & 2 deletions jabgui/src/main/java/org/jabref/gui/edit/CopyMoreAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -169,13 +169,13 @@ private void doCopyKey(Function<List<String>, String> mapKeyList) {

private void copyCiteKey() {
doCopyKey(keys -> {
CitationCommandString citeCommand = preferences.getExternalApplicationsPreferences().getCiteCommand();
CitationCommandString citeCommand = preferences.getPushToApplicationPreferences().getCiteCommand();
return citeCommand.prefix() + String.join(citeCommand.delimiter(), keys) + citeCommand.suffix();
});
}

private void copyKey() {
doCopyKey(keys -> String.join(preferences.getExternalApplicationsPreferences().getCiteCommand().delimiter(), keys));
doCopyKey(keys -> String.join(preferences.getPushToApplicationPreferences().getCiteCommand().delimiter(), keys));
}

private void copyKeyAndTitle() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@
import org.jabref.gui.DialogService;
import org.jabref.gui.LibraryTab;
import org.jabref.gui.preferences.GuiPreferences;
import org.jabref.gui.push.PushToApplication;
import org.jabref.gui.push.PushToApplications;
import org.jabref.gui.push.PushToTeXstudio;
import org.jabref.gui.texparser.CitationsDisplay;
import org.jabref.gui.util.DirectoryDialogConfiguration;
import org.jabref.gui.util.DirectoryMonitor;
import org.jabref.gui.util.UiTaskExecutor;
import org.jabref.logic.l10n.Localization;
import org.jabref.logic.push.PushToApplication;
import org.jabref.logic.push.PushToApplications;
import org.jabref.logic.push.PushToTeXstudio;
import org.jabref.logic.texparser.DefaultLatexParser;
import org.jabref.logic.util.io.FileUtil;
import org.jabref.model.database.BibDatabaseContext;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,18 @@
import java.util.TreeSet;

import javafx.beans.property.BooleanProperty;
import javafx.beans.property.ObjectProperty;
import javafx.beans.property.SimpleBooleanProperty;
import javafx.beans.property.SimpleObjectProperty;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
import javafx.collections.FXCollections;
import javafx.collections.ObservableSet;

import org.jabref.gui.externalfiletype.ExternalFileType;
import org.jabref.logic.push.CitationCommandString;

public class ExternalApplicationsPreferences {

private final StringProperty eMailSubject;
private final BooleanProperty shouldAutoOpenEmailAttachmentsFolder;
private final ObjectProperty<CitationCommandString> citeCommand;

private final ObjectProperty<CitationCommandString> defaultCiteCommand;

private final BooleanProperty useCustomTerminal;
private final StringProperty customTerminalCommand;
Expand All @@ -33,8 +27,6 @@ public class ExternalApplicationsPreferences {

public ExternalApplicationsPreferences(String eMailSubject,
boolean shouldAutoOpenEmailAttachmentsFolder,
CitationCommandString citeCommand,
CitationCommandString defaultCiteCommand,
Set<ExternalFileType> externalFileTypes,
boolean useCustomTerminal,
String customTerminalCommand,
Expand All @@ -44,8 +36,6 @@ public ExternalApplicationsPreferences(String eMailSubject,

this.eMailSubject = new SimpleStringProperty(eMailSubject);
this.shouldAutoOpenEmailAttachmentsFolder = new SimpleBooleanProperty(shouldAutoOpenEmailAttachmentsFolder);
this.citeCommand = new SimpleObjectProperty<>(citeCommand);
this.defaultCiteCommand = new SimpleObjectProperty<>(defaultCiteCommand);
this.externalFileTypes.addAll(externalFileTypes);
this.useCustomTerminal = new SimpleBooleanProperty(useCustomTerminal);
this.customTerminalCommand = new SimpleStringProperty(customTerminalCommand);
Expand Down Expand Up @@ -78,18 +68,6 @@ public void setAutoOpenEmailAttachmentsFolder(boolean shouldAutoOpenEmailAttachm
this.shouldAutoOpenEmailAttachmentsFolder.set(shouldAutoOpenEmailAttachmentsFolder);
}

public CitationCommandString getCiteCommand() {
return citeCommand.get();
}

public ObjectProperty<CitationCommandString> citeCommandProperty() {
return citeCommand;
}

public void setCiteCommand(CitationCommandString citeCommand) {
this.citeCommand.set(citeCommand);
}

public boolean useCustomTerminal() {
return useCustomTerminal.get();
}
Expand Down Expand Up @@ -150,10 +128,6 @@ public void setKindleEmail(String kindleEmail) {
this.kindleEmail.set(kindleEmail);
}

public CitationCommandString getDefaultCiteCommand() {
return defaultCiteCommand.getValue();
}

public ObservableSet<ExternalFileType> getExternalFileTypes() {
return this.externalFileTypes;
}
Expand Down
10 changes: 5 additions & 5 deletions jabgui/src/main/java/org/jabref/gui/frame/JabRefFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
import org.jabref.gui.keyboard.KeyBinding;
import org.jabref.gui.libraryproperties.LibraryPropertiesAction;
import org.jabref.gui.preferences.GuiPreferences;
import org.jabref.gui.push.PushToApplicationCommand;
import org.jabref.gui.push.GUIPushToApplicationCommand;
import org.jabref.gui.search.GlobalSearchBar;
import org.jabref.gui.search.SearchType;
import org.jabref.gui.sidepane.SidePane;
Expand Down Expand Up @@ -104,7 +104,7 @@ private enum PanelMode { MAIN_TABLE, MAIN_TABLE_AND_ENTRY_EDITOR }
private final TaskExecutor taskExecutor;

private final JabRefFrameViewModel viewModel;
private final PushToApplicationCommand pushToApplicationCommand;
private final GUIPushToApplicationCommand GUIPushToApplicationCommand;
private final SplitPane horizontalSplit = new SplitPane();
private final SidePane sidePane;
private final SplitPane verticalSplit = new SplitPane();
Expand Down Expand Up @@ -188,7 +188,7 @@ public JabRefFrame(Stage mainStage,
clipBoardManager,
undoManager);

this.pushToApplicationCommand = new PushToApplicationCommand(
this.GUIPushToApplicationCommand = new GUIPushToApplicationCommand(
stateManager,
dialogService,
this.preferences,
Expand Down Expand Up @@ -218,7 +218,7 @@ public JabRefFrame(Stage mainStage,
private void initLayout() {
MainToolBar mainToolBar = new MainToolBar(
this,
pushToApplicationCommand,
GUIPushToApplicationCommand,
globalSearchBar,
dialogService,
stateManager,
Expand All @@ -234,7 +234,7 @@ private void initLayout() {
this,
fileHistory,
sidePane,
pushToApplicationCommand,
GUIPushToApplicationCommand,
preferences,
stateManager,
fileUpdateMonitor,
Expand Down
12 changes: 6 additions & 6 deletions jabgui/src/main/java/org/jabref/gui/frame/MainMenu.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
import org.jabref.gui.preferences.ShowPreferencesAction;
import org.jabref.gui.preview.CopyCitationAction;
import org.jabref.gui.preview.PreviewControls;
import org.jabref.gui.push.PushToApplicationCommand;
import org.jabref.gui.push.GUIPushToApplicationCommand;
import org.jabref.gui.search.RebuildFulltextSearchIndexAction;
import org.jabref.gui.shared.ConnectToSharedDatabaseCommand;
import org.jabref.gui.shared.PullChangesFromSharedAction;
Expand Down Expand Up @@ -98,7 +98,7 @@ public class MainMenu extends MenuBar {
private final JabRefFrame frame;
private final FileHistoryMenu fileHistoryMenu;
private final SidePane sidePane;
private final PushToApplicationCommand pushToApplicationCommand;
private final GUIPushToApplicationCommand GUIPushToApplicationCommand;
private final GuiPreferences preferences;
private final StateManager stateManager;
private final FileUpdateMonitor fileUpdateMonitor;
Expand All @@ -115,7 +115,7 @@ public class MainMenu extends MenuBar {
public MainMenu(JabRefFrame frame,
FileHistoryMenu fileHistoryMenu,
SidePane sidePane,
PushToApplicationCommand pushToApplicationCommand,
GUIPushToApplicationCommand GUIPushToApplicationCommand,
GuiPreferences preferences,
StateManager stateManager,
FileUpdateMonitor fileUpdateMonitor,
Expand All @@ -131,7 +131,7 @@ public MainMenu(JabRefFrame frame,
this.frame = frame;
this.fileHistoryMenu = fileHistoryMenu;
this.sidePane = sidePane;
this.pushToApplicationCommand = pushToApplicationCommand;
this.GUIPushToApplicationCommand = GUIPushToApplicationCommand;
this.preferences = preferences;
this.stateManager = stateManager;
this.fileUpdateMonitor = fileUpdateMonitor;
Expand Down Expand Up @@ -312,8 +312,8 @@ private void createMenu() {
// endregion
);

final MenuItem pushToApplicationMenuItem = factory.createMenuItem(pushToApplicationCommand.getAction(), pushToApplicationCommand);
pushToApplicationCommand.registerReconfigurable(pushToApplicationMenuItem);
final MenuItem pushToApplicationMenuItem = factory.createMenuItem(GUIPushToApplicationCommand.getAction(), GUIPushToApplicationCommand);
GUIPushToApplicationCommand.registerReconfigurable(pushToApplicationMenuItem);

tools.getItems().addAll(
factory.createMenuItem(StandardActions.PARSE_LATEX, new ParseLatexAction(stateManager)),
Expand Down
12 changes: 6 additions & 6 deletions jabgui/src/main/java/org/jabref/gui/frame/MainToolBar.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import org.jabref.gui.importer.NewEntryAction;
import org.jabref.gui.importer.actions.OpenDatabaseAction;
import org.jabref.gui.preferences.GuiPreferences;
import org.jabref.gui.push.PushToApplicationCommand;
import org.jabref.gui.push.GUIPushToApplicationCommand;
import org.jabref.gui.search.GlobalSearchBar;
import org.jabref.gui.theme.ThemeManager;
import org.jabref.gui.undo.CountingUndoManager;
Expand All @@ -47,7 +47,7 @@

public class MainToolBar extends ToolBar {
private final LibraryTabContainer frame;
private final PushToApplicationCommand pushToApplicationCommand;
private final GUIPushToApplicationCommand GUIPushToApplicationCommand;
private final GlobalSearchBar globalSearchBar;
private final DialogService dialogService;
private final StateManager stateManager;
Expand All @@ -64,7 +64,7 @@ public class MainToolBar extends ToolBar {
private Subscription taskProgressSubscription;

public MainToolBar(LibraryTabContainer tabContainer,
PushToApplicationCommand pushToApplicationCommand,
GUIPushToApplicationCommand GUIPushToApplicationCommand,
GlobalSearchBar globalSearchBar,
DialogService dialogService,
StateManager stateManager,
Expand All @@ -76,7 +76,7 @@ public MainToolBar(LibraryTabContainer tabContainer,
ClipBoardManager clipBoardManager,
CountingUndoManager undoManager) {
this.frame = tabContainer;
this.pushToApplicationCommand = pushToApplicationCommand;
this.GUIPushToApplicationCommand = GUIPushToApplicationCommand;
this.globalSearchBar = globalSearchBar;
this.dialogService = dialogService;
this.stateManager = stateManager;
Expand All @@ -97,8 +97,8 @@ private void createToolBar() {
final Region leftSpacer = new Region();
final Region rightSpacer = new Region();

final Button pushToApplicationButton = factory.createIconButton(pushToApplicationCommand.getAction(), pushToApplicationCommand);
pushToApplicationCommand.registerReconfigurable(pushToApplicationButton);
final Button pushToApplicationButton = factory.createIconButton(GUIPushToApplicationCommand.getAction(), GUIPushToApplicationCommand);
GUIPushToApplicationCommand.registerReconfigurable(pushToApplicationButton);

// Setup Toolbar

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
import org.jabref.gui.mergeentries.MergeDialogPreferences;
import org.jabref.gui.newentry.NewEntryPreferences;
import org.jabref.gui.preview.PreviewPreferences;
import org.jabref.gui.push.PushToApplicationPreferences;
import org.jabref.gui.specialfields.SpecialFieldsPreferences;
import org.jabref.logic.preferences.CliPreferences;
import org.jabref.logic.push.PushToApplicationPreferences;

public interface GuiPreferences extends CliPreferences {
CopyToPreferences getCopyToPreferences();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@
import org.jabref.gui.newentry.NewEntryDialogTab;
import org.jabref.gui.newentry.NewEntryPreferences;
import org.jabref.gui.preview.PreviewPreferences;
import org.jabref.gui.push.PushToApplicationPreferences;
import org.jabref.gui.push.PushToApplications;
import org.jabref.gui.sidepane.SidePaneType;
import org.jabref.gui.specialfields.SpecialFieldsPreferences;
import org.jabref.gui.theme.Theme;
Expand All @@ -66,6 +64,8 @@
import org.jabref.logic.preferences.JabRefCliPreferences;
import org.jabref.logic.preview.PreviewLayout;
import org.jabref.logic.push.CitationCommandString;
import org.jabref.logic.push.PushToApplicationPreferences;
import org.jabref.logic.push.PushToApplications;
import org.jabref.logic.util.StandardFileType;
import org.jabref.model.entry.BibEntryTypesManager;
import org.jabref.model.entry.field.Field;
Expand Down Expand Up @@ -147,6 +147,7 @@ public class JabRefGuiPreferences extends JabRefCliPreferences implements GuiPre
private static final String PUSH_VIM = "vim";
private static final String PUSH_SUBLIME_TEXT_PATH = "sublimeTextPath";
private static final String PUSH_VSCODE_PATH = "VScodePath";
private static final String PUSH_CITE_COMMAND = "citeCommand";
// endregion

// region NameDisplayPreferences
Expand All @@ -162,7 +163,6 @@ public class JabRefGuiPreferences extends JabRefCliPreferences implements GuiPre
private static final String CONSOLE_COMMAND = "consoleCommand";
private static final String USE_DEFAULT_CONSOLE_APPLICATION = "useDefaultConsoleApplication";
private static final String USE_DEFAULT_FILE_BROWSER_APPLICATION = "userDefaultFileBrowserApplication";
private static final String CITE_COMMAND = "citeCommand";
private static final String EMAIL_SUBJECT = "emailSubject";
private static final String KINDLE_EMAIL = "kindleEmail";
private static final String OPEN_FOLDERS_OF_ATTACHED_FILES = "openFoldersOfAttachedFiles";
Expand Down Expand Up @@ -301,7 +301,6 @@ private JabRefGuiPreferences() {

// region ExternalApplicationsPreferences
defaults.put(EXTERNAL_FILE_TYPES, "");
defaults.put(CITE_COMMAND, "\\cite{key1,key2}");
defaults.put(EMAIL_SUBJECT, Localization.lang("References"));
defaults.put(KINDLE_EMAIL, "");

Expand Down Expand Up @@ -386,6 +385,7 @@ private JabRefGuiPreferences() {
defaults.put(PUSH_VIM_SERVER, "vim");
defaults.put(PUSH_EMACS_ADDITIONAL_PARAMETERS, "-n -e");
defaults.put(PUSH_VSCODE_PATH, OS.detectProgramPath("Code", "Microsoft VS Code"));
defaults.put(PUSH_CITE_COMMAND, "\\cite{key1,key2}");

if (OS.OS_X) {
defaults.put(PUSH_EMACS_PATH, "emacsclient");
Expand Down Expand Up @@ -814,8 +814,6 @@ public ExternalApplicationsPreferences getExternalApplicationsPreferences() {
externalApplicationsPreferences = new ExternalApplicationsPreferences(
get(EMAIL_SUBJECT),
getBoolean(OPEN_FOLDERS_OF_ATTACHED_FILES),
CitationCommandString.from(get(CITE_COMMAND)),
CitationCommandString.from((String) defaults.get(CITE_COMMAND)),
ExternalFileTypes.fromString(get(EXTERNAL_FILE_TYPES)),
!getBoolean(USE_DEFAULT_CONSOLE_APPLICATION), // mind the !
get(CONSOLE_COMMAND),
Expand All @@ -827,8 +825,6 @@ public ExternalApplicationsPreferences getExternalApplicationsPreferences() {
(obs, oldValue, newValue) -> put(EMAIL_SUBJECT, newValue));
EasyBind.listen(externalApplicationsPreferences.autoOpenEmailAttachmentsFolderProperty(),
(obs, oldValue, newValue) -> putBoolean(OPEN_FOLDERS_OF_ATTACHED_FILES, newValue));
EasyBind.listen(externalApplicationsPreferences.citeCommandProperty(),
(obs, oldValue, newValue) -> put(CITE_COMMAND, newValue.toString()));
EasyBind.listen(externalApplicationsPreferences.useCustomTerminalProperty(),
(obs, oldValue, newValue) -> putBoolean(USE_DEFAULT_CONSOLE_APPLICATION, !newValue)); // mind the !
externalApplicationsPreferences.getExternalFileTypes().addListener((SetChangeListener<ExternalFileType>) c ->
Expand Down Expand Up @@ -998,13 +994,18 @@ public PushToApplicationPreferences getPushToApplicationPreferences() {
get(PUSH_TO_APPLICATION),
applicationCommands,
get(PUSH_EMACS_ADDITIONAL_PARAMETERS),
get(PUSH_VIM_SERVER)
get(PUSH_VIM_SERVER),
CitationCommandString.from(get(PUSH_CITE_COMMAND)),
CitationCommandString.from((String) defaults.get(PUSH_CITE_COMMAND))
);

EasyBind.listen(pushToApplicationPreferences.activeApplicationNameProperty(), (obs, oldValue, newValue) -> put(PUSH_TO_APPLICATION, newValue));
pushToApplicationPreferences.getCommandPaths().addListener((obs, oldValue, newValue) -> storePushToApplicationPath(newValue));
EasyBind.listen(pushToApplicationPreferences.emacsArgumentsProperty(), (obs, oldValue, newValue) -> put(PUSH_EMACS_ADDITIONAL_PARAMETERS, newValue));
EasyBind.listen(pushToApplicationPreferences.vimServerProperty(), (obs, oldValue, newValue) -> put(PUSH_VIM_SERVER, newValue));
EasyBind.listen(pushToApplicationPreferences.citeCommandProperty(),
(obs, oldValue, newValue) -> put(PUSH_CITE_COMMAND, newValue.toString()));

return pushToApplicationPreferences;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import org.jabref.gui.help.HelpAction;
import org.jabref.gui.preferences.AbstractPreferenceTabView;
import org.jabref.gui.preferences.PreferencesTab;
import org.jabref.gui.push.PushToApplication;
import org.jabref.gui.push.GUIPushToApplication;
import org.jabref.gui.util.IconValidationDecorator;
import org.jabref.gui.util.ViewModelListCellFactory;
import org.jabref.logic.help.HelpFile;
Expand All @@ -25,7 +25,7 @@ public class ExternalTab extends AbstractPreferenceTabView<ExternalTabViewModel>

@FXML private TextField eMailReferenceSubject;
@FXML private CheckBox autoOpenAttachedFolders;
@FXML private ComboBox<PushToApplication> pushToApplicationCombo;
@FXML private ComboBox<GUIPushToApplication> pushToApplicationCombo;
@FXML private TextField citeCommand;
@FXML private Button autolinkExternalHelp;

Expand Down Expand Up @@ -53,9 +53,9 @@ public String getTabName() {
public void initialize() {
this.viewModel = new ExternalTabViewModel(dialogService, preferences);

new ViewModelListCellFactory<PushToApplication>()
.withText(PushToApplication::getDisplayName)
.withIcon(PushToApplication::getApplicationIcon)
new ViewModelListCellFactory<GUIPushToApplication>()
.withText(GUIPushToApplication::getDisplayName)
.withIcon(GUIPushToApplication::getApplicationIcon)
.install(pushToApplicationCombo);

eMailReferenceSubject.textProperty().bindBidirectional(viewModel.eMailReferenceSubjectProperty());
Expand Down
Loading