-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Add setting: always add "Cited on pages" text to JStyles. #11732
Changes from 3 commits
68834e9
7243dda
a5a902b
cda2669
160721d
a4f05b1
3e507b8
09d9647
576eb92
21c7de1
9efdd4b
dd273f7
ee2ebb4
f2c3744
b43835a
7ce9dc8
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 |
---|---|---|
|
@@ -618,12 +618,17 @@ private boolean checkThatEntriesHaveKeys(List<BibEntry> entries) { | |
} | ||
|
||
private ContextMenu createSettingsPopup() { | ||
OpenOfficePreferences openOfficePreferences = preferencesService.getOpenOfficePreferences(); | ||
|
||
ContextMenu contextMenu = new ContextMenu(); | ||
|
||
if (currentStyle instanceof JStyle) { | ||
addAlwaysCitedOnPagesTextOption(contextMenu); | ||
} | ||
|
||
OpenOfficePreferences openOfficePreferences = preferencesService.getOpenOfficePreferences(); | ||
|
||
CheckMenuItem autoSync = new CheckMenuItem(Localization.lang("Automatically sync bibliography when inserting citations")); | ||
autoSync.selectedProperty().set(preferencesService.getOpenOfficePreferences().getSyncWhenCiting()); | ||
autoSync.selectedProperty().set(openOfficePreferences.getSyncWhenCiting()); | ||
|
||
ToggleGroup toggleGroup = new ToggleGroup(); | ||
RadioMenuItem useActiveBase = new RadioMenuItem(Localization.lang("Look up BibTeX entries in the active tab only")); | ||
|
@@ -657,4 +662,15 @@ private ContextMenu createSettingsPopup() { | |
|
||
return contextMenu; | ||
} | ||
|
||
private void addAlwaysCitedOnPagesTextOption(ContextMenu contextMenu) { | ||
OpenOfficePreferences openOfficePreferences = preferencesService.getOpenOfficePreferences(); | ||
|
||
CheckMenuItem alwaysAddCitedOnPagesText = new CheckMenuItem(Localization.lang("Automatically add Cited on pages")); | ||
|
||
alwaysAddCitedOnPagesText.selectedProperty().set(openOfficePreferences.getAlwaysAddCitedOnPages()); | ||
alwaysAddCitedOnPagesText.setOnAction(e -> openOfficePreferences.setAlwaysAddCitedOnPages(alwaysAddCitedOnPagesText.isSelected())); | ||
|
||
contextMenu.getItems().add(alwaysAddCitedOnPagesText); | ||
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.
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. I'm really embarrassed I forgot about the CSL Styles, will add the removal mechanism and move the item below the "old" option as requested. 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.
Please be comfortable, you are new to the codebase, so that's very normal! |
||
} | ||
} |
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.
Additional request for refactor (since we're here): If we require
openOfficePreferences
inside multiple methods, we can declare it at class-level and call the getter just once.Note: Actually, it is slightly bad design that the entire
preferencesService
is passed to this class' constructor (not your fault). Could be abstracted, but that's out of scope for this PR an would require more effort to change. You can just do what I mentioned above.