-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added LabelPatternPreferences (#1607)
* Added LabelPatternPreferences * Removed static initializer
- Loading branch information
Showing
16 changed files
with
153 additions
and
82 deletions.
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
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
56 changes: 56 additions & 0 deletions
56
src/main/java/net/sf/jabref/logic/labelpattern/LabelPatternPreferences.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,56 @@ | ||
package net.sf.jabref.logic.labelpattern; | ||
|
||
import net.sf.jabref.preferences.JabRefPreferences; | ||
|
||
public class LabelPatternPreferences { | ||
|
||
private final String defaultLabelPattern; | ||
private final String keyPatternRegex; | ||
private final String keyPatternReplacement; | ||
private final boolean alwaysAddLetter; | ||
private final boolean firstLetterA; | ||
private final boolean enforceLegalKey; | ||
|
||
public LabelPatternPreferences(String defaultLabelPattern, String keyPatternRegex, String keyPatternReplacement, | ||
boolean alwaysAddLetter, boolean firstLetterA, boolean enforceLegalKey) { | ||
this.defaultLabelPattern = defaultLabelPattern; | ||
this.keyPatternRegex = keyPatternRegex; | ||
this.keyPatternReplacement = keyPatternReplacement; | ||
this.alwaysAddLetter = alwaysAddLetter; | ||
this.firstLetterA = firstLetterA; | ||
this.enforceLegalKey = enforceLegalKey; | ||
} | ||
|
||
public static LabelPatternPreferences fromPreferences(JabRefPreferences jabRefPreferences) { | ||
return new LabelPatternPreferences(jabRefPreferences.get(JabRefPreferences.DEFAULT_LABEL_PATTERN), | ||
jabRefPreferences.get(JabRefPreferences.KEY_PATTERN_REGEX), | ||
jabRefPreferences.get(JabRefPreferences.KEY_PATTERN_REPLACEMENT), | ||
jabRefPreferences.getBoolean(JabRefPreferences.KEY_GEN_ALWAYS_ADD_LETTER), | ||
jabRefPreferences.getBoolean(JabRefPreferences.KEY_GEN_FIRST_LETTER_A), | ||
jabRefPreferences.getBoolean(JabRefPreferences.ENFORCE_LEGAL_BIBTEX_KEY)); | ||
} | ||
|
||
public String getDefaultLabelPattern() { | ||
return defaultLabelPattern; | ||
} | ||
|
||
public String getKeyPatternRegex() { | ||
return keyPatternRegex; | ||
} | ||
|
||
public String getKeyPatternReplacement() { | ||
return keyPatternReplacement; | ||
} | ||
|
||
public boolean isAlwaysAddLetter() { | ||
return alwaysAddLetter; | ||
} | ||
|
||
public boolean isFirstLetterA() { | ||
return firstLetterA; | ||
} | ||
|
||
public boolean isEnforceLegalKey() { | ||
return enforceLegalKey; | ||
} | ||
} |
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
Oops, something went wrong.