7
7
8
8
import javafx .scene .input .ClipboardContent ;
9
9
10
+ import org .jabref .logic .bst .BstPreviewLayout ;
10
11
import org .jabref .logic .citationstyle .CitationStyleGenerator ;
11
12
import org .jabref .logic .citationstyle .CitationStyleOutputFormat ;
12
13
import org .jabref .logic .citationstyle .CitationStylePreviewLayout ;
24
25
import com .airhacks .afterburner .injection .Injector ;
25
26
import com .google .common .annotations .VisibleForTesting ;
26
27
27
- public class ClipboardContentGenerator {
28
-
29
- private final PreviewPreferences previewPreferences ;
30
- private final LayoutFormatterPreferences layoutFormatterPreferences ;
31
- private final JournalAbbreviationRepository abbreviationRepository ;
32
-
33
- public ClipboardContentGenerator (PreviewPreferences previewPreferences ,
34
- LayoutFormatterPreferences layoutFormatterPreferences ,
35
- JournalAbbreviationRepository abbreviationRepository ) {
36
- this .previewPreferences = previewPreferences ;
37
- this .layoutFormatterPreferences = layoutFormatterPreferences ;
38
- this .abbreviationRepository = abbreviationRepository ;
39
- }
28
+ public record ClipboardContentGenerator (
29
+ PreviewPreferences previewPreferences ,
30
+ LayoutFormatterPreferences layoutFormatterPreferences ,
31
+ JournalAbbreviationRepository abbreviationRepository ) {
40
32
41
33
public ClipboardContent generate (List <BibEntry > selectedEntries , CitationStyleOutputFormat outputFormat , BibDatabaseContext bibDatabaseContext ) throws IOException {
42
34
List <String > citations = generateCitations (selectedEntries , outputFormat , bibDatabaseContext );
43
35
if (previewPreferences .getSelectedPreviewLayout () instanceof CitationStylePreviewLayout ) {
44
36
// if it's generated by a citation style take care of each output format
45
37
return switch (outputFormat ) {
46
- case HTML -> processHtml (citations );
47
- case TEXT -> processText (citations );
48
- case MARKDOWN -> processMarkdown (citations );
38
+ case HTML ->
39
+ processHtml (citations );
40
+ case TEXT ->
41
+ processText (citations );
42
+ case MARKDOWN ->
43
+ processMarkdown (citations );
49
44
};
50
45
} else {
51
46
// if it is not a citation style take care of the preview
@@ -76,7 +71,7 @@ private List<String> generateCitations(List<BibEntry> selectedEntries, CitationS
76
71
}
77
72
78
73
/**
79
- * Generates a plain text string out of the preview (based on {@link org.jabref.logic.layout. TextBasedPreviewLayout} or {@link org.jabref.logic.bst. BstPreviewLayout})
74
+ * Generates a plain text string out of the preview (based on {@link TextBasedPreviewLayout} or {@link BstPreviewLayout})
80
75
* and copies it additionally to the html to the clipboard (WYSIWYG Editors use the HTML, plain text editors the text)
81
76
*/
82
77
@ VisibleForTesting
@@ -99,7 +94,7 @@ static ClipboardContent processText(List<String> citations) {
99
94
100
95
/**
101
96
* Inserts each citation into a HTML body and copies it to the clipboard.
102
- * The given preview is based on {@link org.jabref.logic.citationstyle. CitationStylePreviewLayout}.
97
+ * The given preview is based on {@link CitationStylePreviewLayout}.
103
98
*/
104
99
@ VisibleForTesting
105
100
static ClipboardContent processHtml (List <String > citations ) {
0 commit comments