Skip to content

Commit d6a0e59

Browse files
Add button for a user to reset the cite command to the default value. (JabRef#10580)
* Add button for a user to reset the cite command to the default value. Add button in ExternalTab.fxml and link it to a method in ExternalTabViewModel.java that sets the citeCommandProperty to the specified default value Update CHANGELOG.md * Fix the requested changes. Delete redundant comment. Encapsulate getDefaultCiteCommand in ExternalApplicationsPreferences and update JabRefPreferences accordingly --------- Co-authored-by: Jonathan Rech <[email protected]> Co-authored-by: Siedlerchr <[email protected]>
1 parent 8804fac commit d6a0e59

File tree

6 files changed

+29
-1
lines changed

6 files changed

+29
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv
1212
### Added
1313

1414
- We added a dropdown menu to let users change the reference library during AUX file import. [#10472](https://github.com/JabRef/jabref/issues/10472)
15+
- We added a button to let users reset the cite command to the default value. [#10569](https://github.com/JabRef/jabref/issues/10569)
1516

1617
### Changed
1718

src/main/java/org/jabref/gui/preferences/external/ExternalTab.fxml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
<columnConstraints>
3434
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="200.0"/>
3535
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="200.0"/>
36-
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="150.0"/>
36+
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="20.0"/>
3737
</columnConstraints>
3838
<rowConstraints>
3939
<RowConstraints minHeight="10.0" vgrow="SOMETIMES"/>
@@ -60,6 +60,15 @@
6060
styleClass="icon-button,narrow"
6161
prefHeight="20.0" prefWidth="20.0"
6262
GridPane.columnIndex="2" GridPane.rowIndex="2"/>
63+
<Button styleClass="icon-button,narrow" onAction="#resetCiteCommandToDefault"
64+
prefHeight="20.0" prefWidth="20.0" GridPane.columnIndex="3" GridPane.rowIndex="2">
65+
<graphic>
66+
<JabRefIconView glyph="REFRESH"/>
67+
</graphic>
68+
<tooltip>
69+
<Tooltip text="%Reset to default"/>
70+
</tooltip>
71+
</Button>
6372
</GridPane>
6473
</HBox>
6574

src/main/java/org/jabref/gui/preferences/external/ExternalTab.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,4 +101,9 @@ void useTerminalCommandBrowse() {
101101
void useFileBrowserSpecialCommandBrowse() {
102102
viewModel.customFileBrowserBrowse();
103103
}
104+
105+
@FXML
106+
void resetCiteCommandToDefault() {
107+
viewModel.resetCiteCommandToDefault();
108+
}
104109
}

src/main/java/org/jabref/gui/preferences/external/ExternalTabViewModel.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,4 +227,8 @@ public BooleanProperty useCustomFileBrowserProperty() {
227227
public StringProperty customFileBrowserCommandProperty() {
228228
return this.customFileBrowserCommandProperty;
229229
}
230+
231+
public void resetCiteCommandToDefault() {
232+
this.citeCommandProperty.setValue(preferences.getExternalApplicationsPreferences().getDefaultCiteCommand());
233+
}
230234
}

src/main/java/org/jabref/preferences/ExternalApplicationsPreferences.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ public class ExternalApplicationsPreferences {
1111
private final BooleanProperty shouldAutoOpenEmailAttachmentsFolder;
1212
private final StringProperty citeCommand;
1313

14+
private final StringProperty defaultCiteCommand;
15+
1416
private final BooleanProperty useCustomTerminal;
1517
private final StringProperty customTerminalCommand;
1618
private final BooleanProperty useCustomFileBrowser;
@@ -20,6 +22,7 @@ public class ExternalApplicationsPreferences {
2022
public ExternalApplicationsPreferences(String eMailSubject,
2123
boolean shouldAutoOpenEmailAttachmentsFolder,
2224
String citeCommand,
25+
String defaultCiteCommand,
2326
boolean useCustomTerminal,
2427
String customTerminalCommand,
2528
boolean useCustomFileBrowser,
@@ -29,6 +32,7 @@ public ExternalApplicationsPreferences(String eMailSubject,
2932
this.eMailSubject = new SimpleStringProperty(eMailSubject);
3033
this.shouldAutoOpenEmailAttachmentsFolder = new SimpleBooleanProperty(shouldAutoOpenEmailAttachmentsFolder);
3134
this.citeCommand = new SimpleStringProperty(citeCommand);
35+
this.defaultCiteCommand = new SimpleStringProperty(defaultCiteCommand);
3236
this.useCustomTerminal = new SimpleBooleanProperty(useCustomTerminal);
3337
this.customTerminalCommand = new SimpleStringProperty(customTerminalCommand);
3438
this.useCustomFileBrowser = new SimpleBooleanProperty(useCustomFileBrowser);
@@ -131,4 +135,8 @@ public StringProperty kindleEmailProperty() {
131135
public void setKindleEmail(String kindleEmail) {
132136
this.kindleEmail.set(kindleEmail);
133137
}
138+
139+
public String getDefaultCiteCommand() {
140+
return defaultCiteCommand.getValue();
141+
}
134142
}

src/main/java/org/jabref/preferences/JabRefPreferences.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1791,6 +1791,7 @@ public ExternalApplicationsPreferences getExternalApplicationsPreferences() {
17911791
get(EMAIL_SUBJECT),
17921792
getBoolean(OPEN_FOLDERS_OF_ATTACHED_FILES),
17931793
get(CITE_COMMAND),
1794+
(String) defaults.get(CITE_COMMAND),
17941795
!getBoolean(USE_DEFAULT_CONSOLE_APPLICATION), // mind the !
17951796
get(CONSOLE_COMMAND),
17961797
!getBoolean(USE_DEFAULT_FILE_BROWSER_APPLICATION), // mind the !

0 commit comments

Comments
 (0)