Skip to content

Commit add4002

Browse files
committed
Expand variables & rename class
1 parent 226fff5 commit add4002

File tree

44 files changed

+174
-174
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+174
-174
lines changed

jabgui/src/main/java/org/jabref/gui/LibraryTab.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
import org.jabref.gui.maintable.MainTableDataModel;
5454
import org.jabref.gui.preferences.GuiPreferences;
5555
import org.jabref.gui.undo.CountingUndoManager;
56-
import org.jabref.gui.undo.NamedCompound;
56+
import org.jabref.gui.undo.NamedCompoundEdit;
5757
import org.jabref.gui.undo.UndoableFieldChange;
5858
import org.jabref.gui.undo.UndoableInsertEntries;
5959
import org.jabref.gui.undo.UndoableRemoveEntries;
@@ -465,13 +465,13 @@ public SuggestionProviders getSuggestionProviders() {
465465
}
466466

467467
public void registerUndoableChanges(List<FieldChange> changes) {
468-
NamedCompound ce = new NamedCompound(Localization.lang("Save actions"));
468+
NamedCompoundEdit compoundEdit = new NamedCompoundEdit(Localization.lang("Save actions"));
469469
for (FieldChange change : changes) {
470-
ce.addEdit(new UndoableFieldChange(change));
470+
compoundEdit.addEdit(new UndoableFieldChange(change));
471471
}
472-
ce.end();
473-
if (ce.hasEdits()) {
474-
getUndoManager().addEdit(ce);
472+
compoundEdit.end();
473+
if (compoundEdit.hasEdits()) {
474+
getUndoManager().addEdit(compoundEdit);
475475
}
476476
}
477477

jabgui/src/main/java/org/jabref/gui/citationkeypattern/GenerateCitationKeyAction.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import org.jabref.gui.StateManager;
1212
import org.jabref.gui.actions.ActionHelper;
1313
import org.jabref.gui.actions.SimpleCommand;
14-
import org.jabref.gui.undo.NamedCompound;
14+
import org.jabref.gui.undo.NamedCompoundEdit;
1515
import org.jabref.gui.undo.UndoableKeyChange;
1616
import org.jabref.gui.util.UiTaskExecutor;
1717
import org.jabref.logic.citationkeypattern.CitationKeyGenerator;
@@ -105,7 +105,7 @@ private void checkOverwriteKeysChosen() {
105105

106106
private BackgroundTask<Void> generateKeysInBackground() {
107107
return new BackgroundTask<>() {
108-
private NamedCompound compound;
108+
private NamedCompoundEdit compound;
109109

110110
@Override
111111
public Void call() {
@@ -118,7 +118,7 @@ public Void call() {
118118
});
119119
stateManager.getActiveDatabase().ifPresent(databaseContext -> {
120120
// generate the new citation keys for each entry
121-
compound = new NamedCompound(Localization.lang("Autogenerate citation keys"));
121+
compound = new NamedCompoundEdit(Localization.lang("Autogenerate citation keys"));
122122
CitationKeyGenerator keyGenerator =
123123
new CitationKeyGenerator(databaseContext, preferences.getCitationKeyPatternPreferences());
124124
int entriesDone = 0;

jabgui/src/main/java/org/jabref/gui/cleanup/CleanupAction.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
import org.jabref.gui.StateManager;
1616
import org.jabref.gui.actions.ActionHelper;
1717
import org.jabref.gui.actions.SimpleCommand;
18-
import org.jabref.gui.undo.NamedCompound;
18+
import org.jabref.gui.undo.NamedCompoundEdit;
1919
import org.jabref.gui.undo.UndoableFieldChange;
2020
import org.jabref.logic.JabRefException;
2121
import org.jabref.logic.cleanup.CleanupPreferences;
@@ -109,7 +109,7 @@ public void execute() {
109109
*
110110
* @return true iff entry was modified
111111
*/
112-
private boolean doCleanup(BibDatabaseContext databaseContext, CleanupPreferences preset, BibEntry entry, NamedCompound ce) {
112+
private boolean doCleanup(BibDatabaseContext databaseContext, CleanupPreferences preset, BibEntry entry, NamedCompoundEdit compoundEdit) {
113113
// Create and run cleaner
114114
CleanupWorker cleaner = new CleanupWorker(
115115
databaseContext,
@@ -121,7 +121,7 @@ private boolean doCleanup(BibDatabaseContext databaseContext, CleanupPreferences
121121

122122
// Register undo action
123123
for (FieldChange change : changes) {
124-
ce.addEdit(new UndoableFieldChange(change));
124+
compoundEdit.addEdit(new UndoableFieldChange(change));
125125
}
126126

127127
failures.addAll(cleaner.getFailures());
@@ -151,18 +151,18 @@ private void cleanup(BibDatabaseContext databaseContext, CleanupPreferences clea
151151
this.failures.clear();
152152

153153
// undo granularity is on set of all entries
154-
NamedCompound ce = new NamedCompound(Localization.lang("Clean up entries"));
154+
NamedCompoundEdit compoundEdit = new NamedCompoundEdit(Localization.lang("Clean up entries"));
155155

156156
for (BibEntry entry : List.copyOf(stateManager.getSelectedEntries())) {
157-
if (doCleanup(databaseContext, cleanupPreferences, entry, ce)) {
157+
if (doCleanup(databaseContext, cleanupPreferences, entry, compoundEdit)) {
158158
modifiedEntriesCount++;
159159
}
160160
}
161161

162-
ce.end();
162+
compoundEdit.end();
163163

164-
if (ce.hasEdits()) {
165-
undoManager.addEdit(ce);
164+
if (compoundEdit.hasEdits()) {
165+
undoManager.addEdit(compoundEdit);
166166
}
167167

168168
if (!failures.isEmpty()) {

jabgui/src/main/java/org/jabref/gui/cleanup/CleanupSingleAction.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import org.jabref.gui.StateManager;
1212
import org.jabref.gui.actions.ActionHelper;
1313
import org.jabref.gui.actions.SimpleCommand;
14-
import org.jabref.gui.undo.NamedCompound;
14+
import org.jabref.gui.undo.NamedCompoundEdit;
1515
import org.jabref.gui.undo.UndoableFieldChange;
1616
import org.jabref.logic.JabRefException;
1717
import org.jabref.logic.cleanup.CleanupPreferences;
@@ -79,7 +79,7 @@ public void execute() {
7979
/**
8080
* Runs the cleanup on the entry and records the change.
8181
*/
82-
private void doCleanup(BibDatabaseContext databaseContext, CleanupPreferences preset, BibEntry entry, NamedCompound ce) {
82+
private void doCleanup(BibDatabaseContext databaseContext, CleanupPreferences preset, BibEntry entry, NamedCompoundEdit compoundEdit) {
8383
// Create and run cleaner
8484
CleanupWorker cleaner = new CleanupWorker(
8585
databaseContext,
@@ -91,7 +91,7 @@ private void doCleanup(BibDatabaseContext databaseContext, CleanupPreferences pr
9191

9292
// Register undo action
9393
for (FieldChange change : changes) {
94-
ce.addEdit(new UndoableFieldChange(change));
94+
compoundEdit.addEdit(new UndoableFieldChange(change));
9595
}
9696

9797
if (!cleaner.getFailures().isEmpty()) {
@@ -101,13 +101,13 @@ private void doCleanup(BibDatabaseContext databaseContext, CleanupPreferences pr
101101

102102
private void cleanup(BibDatabaseContext databaseContext, CleanupPreferences cleanupPreferences) {
103103
// undo granularity is on entry level
104-
NamedCompound ce = new NamedCompound(Localization.lang("Cleanup entry"));
104+
NamedCompoundEdit compoundEdit = new NamedCompoundEdit(Localization.lang("Cleanup entry"));
105105

106-
doCleanup(databaseContext, cleanupPreferences, entry, ce);
106+
doCleanup(databaseContext, cleanupPreferences, entry, compoundEdit);
107107

108-
ce.end();
109-
if (ce.hasEdits()) {
110-
undoManager.addEdit(ce);
108+
compoundEdit.end();
109+
if (compoundEdit.hasEdits()) {
110+
undoManager.addEdit(compoundEdit);
111111
}
112112
}
113113

jabgui/src/main/java/org/jabref/gui/collab/DatabaseChange.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
import org.jabref.gui.collab.stringchange.BibTexStringChange;
1818
import org.jabref.gui.collab.stringdelete.BibTexStringDelete;
1919
import org.jabref.gui.collab.stringrename.BibTexStringRename;
20-
import org.jabref.gui.undo.NamedCompound;
20+
import org.jabref.gui.undo.NamedCompoundEdit;
2121
import org.jabref.logic.util.OptionalObjectProperty;
2222
import org.jabref.model.database.BibDatabaseContext;
2323

@@ -67,5 +67,5 @@ public Optional<DatabaseChangeResolver> getExternalChangeResolver() {
6767
return externalChangeResolver.get();
6868
}
6969

70-
public abstract void applyChange(NamedCompound undoEdit);
70+
public abstract void applyChange(NamedCompoundEdit undoEdit);
7171
}

jabgui/src/main/java/org/jabref/gui/collab/DatabaseChangeMonitor.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
import org.jabref.gui.StateManager;
1515
import org.jabref.gui.icon.IconTheme;
1616
import org.jabref.gui.preferences.GuiPreferences;
17-
import org.jabref.gui.undo.NamedCompound;
17+
import org.jabref.gui.undo.NamedCompoundEdit;
1818
import org.jabref.logic.l10n.Localization;
1919
import org.jabref.logic.util.BackgroundTask;
2020
import org.jabref.logic.util.TaskExecutor;
@@ -81,10 +81,10 @@ private void notifyOnChange(List<DatabaseChange> changes) {
8181
DatabaseChangesResolverDialog databaseChangesResolverDialog = new DatabaseChangesResolverDialog(changes, database, Localization.lang("External Changes Resolver"));
8282
Optional<Boolean> areAllChangesResolved = dialogService.showCustomDialogAndWait(databaseChangesResolverDialog);
8383
saveState = stateManager.activeTabProperty().get().get();
84-
final NamedCompound ce = new NamedCompound(Localization.lang("Merged external changes"));
85-
changes.stream().filter(DatabaseChange::isAccepted).forEach(change -> change.applyChange(ce));
86-
ce.end();
87-
undoManager.addEdit(ce);
84+
final NamedCompoundEdit compoundEdit = new NamedCompoundEdit(Localization.lang("Merged external changes"));
85+
changes.stream().filter(DatabaseChange::isAccepted).forEach(change -> change.applyChange(compoundEdit));
86+
compoundEdit.end();
87+
undoManager.addEdit(compoundEdit);
8888
if (areAllChangesResolved.get()) {
8989
if (databaseChangesResolverDialog.areAllChangesAccepted()) {
9090
// In case all changes of the file on disk are merged into the current in-memory file, the file on disk does not differ from the in-memory file

jabgui/src/main/java/org/jabref/gui/collab/entryadd/EntryAdd.java

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

33
import org.jabref.gui.collab.DatabaseChange;
44
import org.jabref.gui.collab.DatabaseChangeResolverFactory;
5-
import org.jabref.gui.undo.NamedCompound;
5+
import org.jabref.gui.undo.NamedCompoundEdit;
66
import org.jabref.gui.undo.UndoableInsertEntries;
77
import org.jabref.logic.l10n.Localization;
88
import org.jabref.model.database.BibDatabaseContext;
@@ -20,7 +20,7 @@ public EntryAdd(BibEntry addedEntry, BibDatabaseContext databaseContext, Databas
2020
}
2121

2222
@Override
23-
public void applyChange(NamedCompound undoEdit) {
23+
public void applyChange(NamedCompoundEdit undoEdit) {
2424
databaseContext.getDatabase().insertEntry(addedEntry);
2525
undoEdit.addEdit(new UndoableInsertEntries(databaseContext.getDatabase(), addedEntry));
2626
}

jabgui/src/main/java/org/jabref/gui/collab/entrychange/EntryChange.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
import org.jabref.gui.collab.DatabaseChange;
66
import org.jabref.gui.collab.DatabaseChangeResolverFactory;
7-
import org.jabref.gui.undo.NamedCompound;
7+
import org.jabref.gui.undo.NamedCompoundEdit;
88
import org.jabref.gui.undo.UndoableInsertEntries;
99
import org.jabref.gui.undo.UndoableRemoveEntries;
1010
import org.jabref.logic.l10n.Localization;
@@ -36,7 +36,7 @@ public BibEntry getNewEntry() {
3636
}
3737

3838
@Override
39-
public void applyChange(NamedCompound undoEdit) {
39+
public void applyChange(NamedCompoundEdit undoEdit) {
4040
databaseContext.getDatabase().removeEntry(oldEntry);
4141
databaseContext.getDatabase().insertEntry(newEntry);
4242
CompoundEdit changeEntryEdit = new CompoundEdit();

jabgui/src/main/java/org/jabref/gui/collab/entrydelete/EntryDelete.java

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

33
import org.jabref.gui.collab.DatabaseChange;
44
import org.jabref.gui.collab.DatabaseChangeResolverFactory;
5-
import org.jabref.gui.undo.NamedCompound;
5+
import org.jabref.gui.undo.NamedCompoundEdit;
66
import org.jabref.gui.undo.UndoableRemoveEntries;
77
import org.jabref.logic.l10n.Localization;
88
import org.jabref.model.database.BibDatabaseContext;
@@ -20,7 +20,7 @@ public EntryDelete(BibEntry deletedEntry, BibDatabaseContext databaseContext, Da
2020
}
2121

2222
@Override
23-
public void applyChange(NamedCompound undoEdit) {
23+
public void applyChange(NamedCompoundEdit undoEdit) {
2424
databaseContext.getDatabase().removeEntry(deletedEntry);
2525
undoEdit.addEdit(new UndoableRemoveEntries(databaseContext.getDatabase(), deletedEntry));
2626
}

jabgui/src/main/java/org/jabref/gui/collab/groupchange/GroupChange.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import org.jabref.gui.collab.DatabaseChangeResolverFactory;
55
import org.jabref.gui.groups.GroupTreeNodeViewModel;
66
import org.jabref.gui.groups.UndoableModifySubtree;
7-
import org.jabref.gui.undo.NamedCompound;
7+
import org.jabref.gui.undo.NamedCompoundEdit;
88
import org.jabref.logic.bibtex.comparator.GroupDiff;
99
import org.jabref.logic.groups.DefaultGroupsFactory;
1010
import org.jabref.logic.l10n.Localization;
@@ -22,7 +22,7 @@ public GroupChange(GroupDiff groupDiff, BibDatabaseContext databaseContext, Data
2222
}
2323

2424
@Override
25-
public void applyChange(NamedCompound undoEdit) {
25+
public void applyChange(NamedCompoundEdit undoEdit) {
2626
GroupTreeNode oldRoot = groupDiff.getOriginalGroupRoot();
2727
GroupTreeNode newRoot = groupDiff.getNewGroupRoot();
2828

0 commit comments

Comments
 (0)