-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Support customized entry types in BibliographyConsistencyCheck #13799
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 31 commits
94e1770
b42b7c8
274d859
b9d69c2
b2bc3a4
8128685
831ed3b
9942817
ff8006e
d453516
53b83d9
b7145af
baeff03
3a79c98
d302f7c
76394d7
3f97a75
37416ff
66b2bbf
2031f0e
ad131c6
9c24a2f
ff9a529
d6d8278
0d7e37d
1fc3810
d30b731
462657a
704885f
c321b78
79af35f
3befca7
7125b76
e580f9a
d3bfbd8
6ed613a
6cc90e2
f1adef0
6cea857
c899efa
3e6c4b1
d681cd8
5040b0c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,6 +27,7 @@ | |
import org.jabref.logic.util.BuildInfo; | ||
import org.jabref.logic.util.Directories; | ||
import org.jabref.migrations.PreferencesMigrations; | ||
import org.jabref.model.entry.BibEntryTypesManager; | ||
|
||
import com.airhacks.afterburner.injection.Injector; | ||
import org.slf4j.Logger; | ||
|
@@ -56,6 +57,7 @@ public static void main(String[] args) { | |
Injector.setModelOrService(BuildInfo.class, new BuildInfo()); | ||
|
||
final JabRefGuiPreferences preferences = JabRefGuiPreferences.getInstance(); | ||
final BibEntryTypesManager bibEntryTypesManager = new BibEntryTypesManager(); | ||
|
||
ArgumentProcessor argumentProcessor = new ArgumentProcessor( | ||
args, | ||
|
@@ -87,7 +89,7 @@ public static void main(String[] args) { | |
systemExit(); | ||
} | ||
|
||
PreferencesMigrations.runMigrations(preferences); | ||
PreferencesMigrations.runMigrations(preferences, bibEntryTypesManager); | ||
|
||
|
||
PostgreServer postgreServer = new PostgreServer(); | ||
Injector.setModelOrService(PostgreServer.class, postgreServer); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,6 +43,7 @@ | |
import org.jabref.logic.l10n.Localization; | ||
import org.jabref.logic.net.ProxyRegisterer; | ||
import org.jabref.logic.os.OS; | ||
import org.jabref.logic.preferences.CliPreferences; | ||
import org.jabref.logic.protectedterms.ProtectedTermsLoader; | ||
import org.jabref.logic.remote.RemotePreferences; | ||
import org.jabref.logic.remote.server.RemoteListenerServerManager; | ||
|
@@ -71,6 +72,7 @@ public class JabRefGUI extends Application { | |
|
||
private static List<UiCommand> uiCommands; | ||
private static GuiPreferences preferences; | ||
private static CliPreferences cliPreferences; | ||
|
||
// AI Service handles chat messages etc. Therefore, it is tightly coupled to the GUI. | ||
private static AiService aiService; | ||
|
@@ -85,6 +87,8 @@ public class JabRefGUI extends Application { | |
private static ClipBoardManager clipBoardManager; | ||
private static DialogService dialogService; | ||
private static JabRefFrame mainFrame; | ||
|
||
private static BibEntryTypesManager bibEntryTypesManager; | ||
private static GitHandlerRegistry gitHandlerRegistry; | ||
|
||
private static RemoteListenerServerManager remoteListenerServerManager; | ||
|
@@ -116,13 +120,14 @@ public void start(Stage stage) { | |
dialogService, | ||
fileUpdateMonitor, | ||
preferences, | ||
cliPreferences, | ||
|
||
gitHandlerRegistry, | ||
aiService, | ||
stateManager, | ||
countingUndoManager, | ||
Injector.instantiateModelOrService(BibEntryTypesManager.class), | ||
clipBoardManager, | ||
taskExecutor, | ||
gitHandlerRegistry); | ||
taskExecutor); | ||
|
||
openWindow(); | ||
|
||
|
@@ -163,7 +168,8 @@ public void initialize() { | |
gitHandlerRegistry = new GitHandlerRegistry(); | ||
Injector.setModelOrService(GitHandlerRegistry.class, gitHandlerRegistry); | ||
|
||
BibEntryTypesManager entryTypesManager = preferences.getCustomEntryTypesRepository(); | ||
BibEntryTypesManager entryTypesManager = preferences.getCustomEntryTypesRepository(bibEntryTypesManager); | ||
|
||
JournalAbbreviationRepository journalAbbreviationRepository = JournalAbbreviationLoader.loadRepository(preferences.getJournalAbbreviationPreferences()); | ||
Injector.setModelOrService(BibEntryTypesManager.class, entryTypesManager); | ||
Injector.setModelOrService(JournalAbbreviationRepository.class, journalAbbreviationRepository); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,10 +54,12 @@ public class PreferencesDialogViewModel extends AbstractViewModel { | |
private final DialogService dialogService; | ||
private final GuiPreferences preferences; | ||
private final ObservableList<PreferencesTab> preferenceTabs; | ||
private final BibEntryTypesManager bibEntryTypesManager; | ||
|
||
public PreferencesDialogViewModel(DialogService dialogService, GuiPreferences preferences) { | ||
public PreferencesDialogViewModel(DialogService dialogService, GuiPreferences preferences, BibEntryTypesManager bibEntryTypesManager) { | ||
this.dialogService = dialogService; | ||
this.preferences = preferences; | ||
this.bibEntryTypesManager = bibEntryTypesManager; | ||
|
||
// This enables passing unsaved preference values from the AI tab to the "web search" tab. | ||
AiTab aiTab = new AiTab(); | ||
|
@@ -190,9 +192,9 @@ public void storeAllSettings() { | |
+ Localization.lang("You must restart JabRef for this to come into effect.")); | ||
} | ||
|
||
Injector.setModelOrService(BibEntryTypesManager.class, preferences.getCustomEntryTypesRepository()); | ||
Injector.setModelOrService(BibEntryTypesManager.class, preferences.getCustomEntryTypesRepository(bibEntryTypesManager)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Direct dependency injection manipulation in GUI code violates layered architecture principle. This logic should be moved to a service layer in org.jabref.logic. |
||
dialogService.notify(Localization.lang("Preferences recorded.")); | ||
} | ||
}; | ||
|
||
/** | ||
* Inserts the preference values into the Properties of the ViewModel | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please do not store it as variable - you only need it once below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed.