Skip to content

Commit 010a2fe

Browse files
committed
Merge remote-tracking branch 'origin/main' into just-jdk25
2 parents 5ffaed3 + cddb206 commit 010a2fe

File tree

23 files changed

+300
-87
lines changed

23 files changed

+300
-87
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Closes _____
1111
<!-- You can add screenshots or videos (using Loom - https://www.loom.com or by just adding .mp4 files). -->
1212
<!-- (REPLACE THIS PARAGRAPH) -->
1313

14-
<!-- YOU HAVE TO MODIFY THE ABOVE TEXT FIT YOUR PR. OTHERWISE, YOUR PR WILL BE CLOSED WITHOUT FURTHER COMMENT. -->
14+
<!-- YOU HAVE TO MODIFY THE ABOVE TEXT TO FIT YOUR PR. OTHERWISE, YOUR PR WILL BE CLOSED WITHOUT FURTHER COMMENT. -->
1515

1616
### Mandatory checks
1717

.github/ghprcomment.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -201,11 +201,7 @@
201201
message: |
202202
Your pull request needs to link an issue correctly.
203203
204-
To ease organizational workflows, please link this pull-request to the issue with syntax as described in <https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue>:
205-
206-
> <h2 id="linking-a-pull-request-to-an-issue-using-a-keyword">Linking a pull request to an issue using a keyword</h2>
207-
> <p>You can link a pull request to an issue by using a supported keyword
208-
> in the pull request's description or in a commit message.
204+
To ease organizational workflows, please link this pull request to the issue by including a supported keyword in the pull request's description as per syntax described in [GitHub's documentation](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue).
209205
210206
### Examples
211207

.github/workflows/binaries.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -154,16 +154,16 @@ jobs:
154154
archivePortableJabKit: 7z a -r jabkit/build/packages/windows-latest/jabkit-portable_windows.zip ./jabkit/build/packages/windows-latest/jabkit && rm -R jabkit/build/packages/windows-latest/jabkit
155155
suffix: ''
156156
archForDebianRepack: ''
157-
- os: macos-13 # intel image
157+
- os: macos-15-intel # intel image
158158
displayName: macOS
159-
archivePortable: 7z a -r jabgui/build/packages/macos-13/JabRef-portable_macos.zip ./jabgui/build/packages/macos-13/JabRef.app && rm -R jabgui/build/packages/macos-13/JabRef.app
160-
archivePortableJabKit: 7z a -r jabkit/build/packages/macos-13/jabkit-portable_macos.zip ./jabkit/build/packages/macos-13/jabkit.app && rm -R jabkit/build/packages/macos-13/jabkit.app
159+
archivePortable: 7z a -r jabgui/build/packages/macos-15-intel/JabRef-portable_macos.zip ./jabgui/build/packages/macos-15-intel/JabRef.app && rm -R jabgui/build/packages/macos-15-intel/JabRef.app
160+
archivePortableJabKit: 7z a -r jabkit/build/packages/macos-15-intel/jabkit-portable_macos.zip ./jabkit/build/packages/macos-15-intel/jabkit.app && rm -R jabkit/build/packages/macos-15-intel/jabkit.app
161161
suffix: ''
162162
archForDebianRepack: ''
163-
- os: macos-14
163+
- os: macos-15
164164
displayName: macOS-arm
165-
archivePortable: 7z a -r jabgui/build/packages/macos-14/JabRef-portable_macos-arm.zip ./jabgui/build/packages/macos-14/JabRef.app && rm -R jabgui/build/packages/macos-14/JabRef.app
166-
archivePortableJabKit: 7z a -r jabkit/build/packages/macos-14/jabkit-portable_macos-arm.zip ./jabkit/build/packages/macos-14/jabkit.app && rm -R jabkit/build/packages/macos-14/jabkit.app
165+
archivePortable: 7z a -r jabgui/build/packages/macos-15/JabRef-portable_macos-arm.zip ./jabgui/build/packages/macos-15/JabRef.app && rm -R jabgui/build/packages/macos-15/JabRef.app
166+
archivePortableJabKit: 7z a -r jabkit/build/packages/macos-15/jabkit-portable_macos-arm.zip ./jabkit/build/packages/macos-15/jabkit.app && rm -R jabkit/build/packages/macos-15/jabkit.app
167167
suffix: '_arm64'
168168
archForDebianRepack: ''
169169
runs-on: ${{ matrix.os }}
@@ -375,10 +375,10 @@ jobs:
375375
max-parallel: 1
376376
matrix:
377377
include:
378-
- os: macos-14
378+
- os: macos-15
379379
displayName: macOS (ARM64)
380380
suffix: '_arm64'
381-
- os: macos-13 # intel image
381+
- os: macos-15-intel # intel image
382382
displayName: macOS
383383
suffix: ''
384384
runs-on: ${{ matrix.os }}

.jbang/CheckoutPR.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
//RUNTIME_OPTIONS --enable-native-access=ALL-UNNAMED
2222

2323
//DEPS org.kohsuke:github-api:2.0-rc.5
24-
//DEPS org.eclipse.jgit:org.eclipse.jgit.pgm:7.3.0.202506031305-r
24+
//DEPS org.eclipse.jgit:org.eclipse.jgit.pgm:7.4.0.202509020913-r
2525

2626
public class CheckoutPR {
2727
static void main(String[] args) throws Exception {

.jbang/CloneJabRef.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
//JAVA 21+
77
//RUNTIME_OPTIONS --enable-native-access=ALL-UNNAMED
88

9-
//DEPS org.eclipse.jgit:org.eclipse.jgit.pgm:7.3.0.202506031305-r
9+
//DEPS org.eclipse.jgit:org.eclipse.jgit.pgm:7.4.0.202509020913-r
1010

1111
public class CloneJabRef {
1212
static void main(String[] args) throws Exception {

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv
7070
- We added support for import of a Refer/BibIX file format. [#13069](https://github.com/JabRef/jabref/issues/13069)
7171
- We added markdown rendering and copy capabilities to AI chat responses. [#12234](https://github.com/JabRef/jabref/issues/12234)
7272
- We added a new `jabkit` command `pseudonymize` to pseudonymize the library. [#13109](https://github.com/JabRef/jabref/issues/13109)
73+
- We moved the clear fields mechanic in the Automatic Field Editor from the edit content tab to a separate tab. [#13780](https://github.com/JabRef/jabref/issues/13780)
7374
- We added functionality to focus running instance when trying to start a second instance. [#13129](https://github.com/JabRef/jabref/issues/13129)
7475
- We added a "Copy Field Content" submenu to the entry context menu, allowing users to quickly copy specific field contents including Author, Journal, Date, Keywords, and Abstract fields from selected entries. [#13280](https://github.com/JabRef/jabref/pull/13280)
7576
- We added a highlighted diff regarding changes to the Group Tree Structure of a bib file, made outside JabRef. [#11221](https://github.com/JabRef/jabref/issues/11221)

build-logic/src/main/kotlin/org.jabref.gradle.base.targets.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@ javaModulePackaging {
2525
architecture = MachineArchitecture.ARM64
2626
packageTypes = listOf("app-image", "deb", "rpm")
2727
}
28-
target("macos-13") {
28+
target("macos-15-intel") {
2929
operatingSystem = OperatingSystemFamily.MACOS
3030
architecture = MachineArchitecture.X86_64
3131
packageTypes = listOf("app-image", "dmg", "pkg")
3232
singleStepPackaging = true
3333
}
34-
target("macos-14") {
34+
target("macos-15") {
3535
operatingSystem = OperatingSystemFamily.MACOS
3636
architecture = MachineArchitecture.ARM64
3737
packageTypes = listOf("app-image", "dmg", "pkg")

jabgui/src/main/java/org/jabref/gui/edit/automaticfiededitor/AutomaticFieldEditorViewModel.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
import org.jabref.gui.AbstractViewModel;
99
import org.jabref.gui.StateManager;
10+
import org.jabref.gui.edit.automaticfiededitor.clearcontent.ClearContentTabView;
1011
import org.jabref.gui.edit.automaticfiededitor.copyormovecontent.CopyOrMoveFieldContentTabView;
1112
import org.jabref.gui.edit.automaticfiededitor.editfieldcontent.EditFieldContentTabView;
1213
import org.jabref.gui.edit.automaticfiededitor.renamefield.RenameFieldTabView;
@@ -25,6 +26,7 @@ public AutomaticFieldEditorViewModel(BibDatabase database, UndoManager undoManag
2526
fieldEditorTabs.addAll(
2627
new EditFieldContentTabView(database, stateManager),
2728
new CopyOrMoveFieldContentTabView(database, stateManager),
29+
new ClearContentTabView(stateManager),
2830
new RenameFieldTabView(database, stateManager)
2931
);
3032
}
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
package org.jabref.gui.edit.automaticfiededitor.clearcontent;
2+
3+
import java.util.Set;
4+
5+
import javafx.application.Platform;
6+
import javafx.fxml.FXML;
7+
import javafx.scene.control.Button;
8+
import javafx.scene.control.CheckBox;
9+
import javafx.scene.control.ComboBox;
10+
11+
import org.jabref.gui.StateManager;
12+
import org.jabref.gui.edit.automaticfiededitor.AbstractAutomaticFieldEditorTabView;
13+
import org.jabref.gui.edit.automaticfiededitor.AutomaticFieldEditorTab;
14+
import org.jabref.logic.l10n.Localization;
15+
import org.jabref.model.entry.field.Field;
16+
17+
import com.airhacks.afterburner.views.ViewLoader;
18+
import com.tobiasdiez.easybind.EasyBind;
19+
20+
import static org.jabref.gui.util.FieldsUtil.FIELD_STRING_CONVERTER;
21+
22+
public class ClearContentTabView extends AbstractAutomaticFieldEditorTabView implements AutomaticFieldEditorTab {
23+
24+
@FXML private ComboBox<Field> fieldComboBox;
25+
@FXML private CheckBox showOnlySetFieldsCheckBox;
26+
@FXML private Button clearButton;
27+
private final StateManager stateManager;
28+
private ClearContentViewModel viewModel;
29+
30+
public ClearContentTabView(StateManager stateManager) {
31+
this.stateManager = stateManager;
32+
ViewLoader.view(this)
33+
.root(this)
34+
.load();
35+
}
36+
37+
@FXML
38+
public void initialize() {
39+
viewModel = new ClearContentViewModel(stateManager);
40+
41+
fieldComboBox.setConverter(FIELD_STRING_CONVERTER);
42+
fieldComboBox.getItems().setAll(viewModel.getAllFields());
43+
if (!fieldComboBox.getItems().isEmpty()) {
44+
fieldComboBox.getSelectionModel().selectFirst();
45+
}
46+
47+
EasyBind.subscribe(showOnlySetFieldsCheckBox.selectedProperty(), selected -> {
48+
Set<Field> items = selected ? viewModel.getSetFieldsOnly()
49+
: viewModel.getAllFields();
50+
fieldComboBox.getItems().setAll(items);
51+
if (!items.isEmpty()) {
52+
fieldComboBox.getSelectionModel().selectFirst();
53+
}
54+
});
55+
56+
clearButton.disableProperty().bind(fieldComboBox.valueProperty().isNull());
57+
58+
Platform.runLater(fieldComboBox::requestFocus);
59+
}
60+
61+
@FXML
62+
private void onClear() {
63+
Field chosen = fieldComboBox.getValue();
64+
if (chosen != null) {
65+
viewModel.clearField(chosen);
66+
}
67+
}
68+
69+
@Override
70+
public String getTabName() {
71+
return Localization.lang("Clear content");
72+
}
73+
}
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
package org.jabref.gui.edit.automaticfiededitor.clearcontent;
2+
3+
import java.util.LinkedHashSet;
4+
import java.util.List;
5+
import java.util.Optional;
6+
import java.util.Set;
7+
import java.util.stream.Collectors;
8+
9+
import org.jabref.gui.StateManager;
10+
import org.jabref.gui.edit.automaticfiededitor.LastAutomaticFieldEditorEdit;
11+
import org.jabref.gui.undo.NamedCompoundEdit;
12+
import org.jabref.gui.undo.UndoableFieldChange;
13+
import org.jabref.model.entry.BibEntry;
14+
import org.jabref.model.entry.field.Field;
15+
import org.jabref.model.entry.field.FieldFactory;
16+
17+
public class ClearContentViewModel {
18+
public static final int TAB_INDEX = 2;
19+
private final StateManager stateManager;
20+
21+
public ClearContentViewModel(StateManager stateManager) {
22+
this.stateManager = stateManager;
23+
}
24+
25+
public Set<Field> getAllFields() {
26+
return FieldFactory.getAllFieldsWithOutInternal();
27+
}
28+
29+
public Set<Field> getSetFieldsOnly() {
30+
return stateManager.getSelectedEntries().stream()
31+
.flatMap(entry -> entry.getFields().stream()
32+
.filter(f -> entry.getField(f).isPresent() && !entry.getField(f).get().isBlank()))
33+
.collect(Collectors.toCollection(LinkedHashSet::new));
34+
}
35+
36+
public void clearField(Field field) {
37+
NamedCompoundEdit edits = new NamedCompoundEdit("CLEAR_SELECTED_FIELD");
38+
List<BibEntry> selected = stateManager.getSelectedEntries();
39+
int affectedEntriesCount = 0;
40+
for (BibEntry entry : selected) {
41+
Optional<String> oldFieldValue = entry.getField(field);
42+
if (oldFieldValue.isPresent()) {
43+
entry.clearField(field)
44+
.ifPresent(change -> edits.addEdit(new UndoableFieldChange(change)));
45+
affectedEntriesCount++;
46+
}
47+
}
48+
49+
if (edits.hasEdits()) {
50+
edits.end();
51+
}
52+
stateManager.setLastAutomaticFieldEditorEdit(
53+
new LastAutomaticFieldEditorEdit(
54+
affectedEntriesCount,
55+
TAB_INDEX,
56+
edits)
57+
);
58+
}
59+
}

0 commit comments

Comments
 (0)