Skip to content

Commit 9c3d8cc

Browse files
committed
refactor: remove redundant map of enabled states and directly use the repository's isSourceEnabled method
1 parent bd53428 commit 9c3d8cc

File tree

1 file changed

+1
-13
lines changed

1 file changed

+1
-13
lines changed

src/main/java/org/jabref/gui/journals/AbbreviateAction.java

+1-13
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package org.jabref.gui.journals;
22

3-
import java.nio.file.Path;
43
import java.util.ArrayList;
54
import java.util.HashMap;
65
import java.util.List;
@@ -143,17 +142,6 @@ private String unabbreviate(BibDatabaseContext databaseContext, List<BibEntry> e
143142

144143
JournalAbbreviationRepository freshRepository = getRepository();
145144

146-
Map<String, Boolean> sourceEnabledStates = new HashMap<>();
147-
String builtInId = JournalAbbreviationRepository.BUILTIN_LIST_ID;
148-
sourceEnabledStates.put(builtInId, journalAbbreviationPreferences.isSourceEnabled(builtInId));
149-
150-
for (String listPath : journalAbbreviationPreferences.getExternalJournalLists()) {
151-
if (listPath != null && !listPath.isBlank()) {
152-
String fileName = Path.of(listPath).getFileName().toString();
153-
sourceEnabledStates.put(fileName, journalAbbreviationPreferences.isSourceEnabled(fileName));
154-
}
155-
}
156-
157145
var allAbbreviationsWithSources = freshRepository.getAllAbbreviationsWithSources();
158146
Map<String, List<JournalAbbreviationRepository.AbbreviationWithSource>> textToSourceMap = new HashMap<>();
159147

@@ -181,7 +169,7 @@ private String unabbreviate(BibDatabaseContext databaseContext, List<BibEntry> e
181169
boolean allSourcesDisabled = true;
182170
for (var abbrWithSource : possibleSources) {
183171
String source = abbrWithSource.getSource();
184-
if (sourceEnabledStates.getOrDefault(source, true)) {
172+
if (freshRepository.isSourceEnabled(source)) {
185173
allSourcesDisabled = false;
186174
break;
187175
}

0 commit comments

Comments
 (0)