-
-
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
Improve entrytype customization #2331
Merged
Merged
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
60db50a
entry type customization based on BibdatabaseMode
matthiasgeiger cbbdd67
Remove unnecessary help method in BibDatabaseMode
matthiasgeiger 4548190
use database mode of current DB
matthiasgeiger ab10ab1
add new storage of custom entry types
matthiasgeiger 830f59c
load and store databasemode specific lists of custom types
matthiasgeiger 0d45001
rework to use database mode specific custom types
matthiasgeiger d144954
reset of preferences now also clears bibtexKeyPatterns and customized…
matthiasgeiger 9d275bc
reenable ignored test
matthiasgeiger 379a398
rewrite and add additional tests to EntryTypesTestBibtex
matthiasgeiger 7dafccf
cleanup after tests
matthiasgeiger e189fd7
add convenience method to get IeeeTranEntryType by name
matthiasgeiger cd13456
Filter customizations of standard types in NewEntry/ChangeEntryType d…
matthiasgeiger 441964d
Improve customEntryType import dialog
matthiasgeiger 1cc3493
update localization
matthiasgeiger 6d7afc1
minor cleanup and rename
matthiasgeiger 4c6aa25
do not cycle through all entries but only through changed ones
matthiasgeiger 5aae2f9
improve naming
matthiasgeiger 92c5712
different order of fields should indicate different types - using sta…
matthiasgeiger 4ba2c1f
incorporate feedback
matthiasgeiger 283401f
fix codacy
matthiasgeiger 9678cba
migrate customEntryType preferences
matthiasgeiger fbe70d7
Merge branch 'master' into improve-entrytype-customization
matthiasgeiger 999e493
fix localization duplicates
matthiasgeiger 696bcfc
test entrytypes parametrized
matthiasgeiger 8584a4d
add CHANGELOG for custom type changes/fixes
matthiasgeiger e247a5d
increase coverage
matthiasgeiger 5e256f5
refactor to adhere to architectural constraints
matthiasgeiger File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
src/main/java/net/sf/jabref/gui/customentrytypes/CustomEntryTypesManager.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package net.sf.jabref.gui.customentrytypes; | ||
|
||
import java.util.List; | ||
import java.util.stream.Collectors; | ||
|
||
import net.sf.jabref.model.EntryTypes; | ||
import net.sf.jabref.model.database.BibDatabaseMode; | ||
import net.sf.jabref.model.entry.CustomEntryType; | ||
import net.sf.jabref.preferences.JabRefPreferences; | ||
|
||
public class CustomEntryTypesManager { | ||
|
||
/** | ||
* Iterate through all entry types, and store those that are | ||
* custom defined to preferences. This method is called from | ||
* JabRefFrame when the program closes. | ||
*/ | ||
public static void saveCustomEntryTypes(JabRefPreferences prefs) { | ||
saveCustomEntryTypes(prefs, BibDatabaseMode.BIBTEX); | ||
saveCustomEntryTypes(prefs, BibDatabaseMode.BIBLATEX); | ||
|
||
} | ||
|
||
private static void saveCustomEntryTypes(JabRefPreferences prefs, BibDatabaseMode mode) { | ||
List<CustomEntryType> customBiblatexTypes = EntryTypes.getAllValues(mode).stream() | ||
.filter(type -> type instanceof CustomEntryType) | ||
.map(entryType -> (CustomEntryType) entryType).collect(Collectors.toList()); | ||
|
||
prefs.storeCustomEntryTypes(customBiblatexTypes, mode); | ||
} | ||
|
||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Would it be possible to extract the following code in a private method? It is duplicated below and the only difference is the mode.
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.
Same as above - helper method would be overkill, imho