55import javafx .scene .control .SeparatorMenuItem ;
66
77import org .jabref .gui .BasePanel ;
8+ import org .jabref .gui .ClipBoardManager ;
89import org .jabref .gui .DialogService ;
910import org .jabref .gui .Globals ;
1011import org .jabref .gui .SendAsEMailAction ;
2526import org .jabref .logic .citationstyle .CitationStylePreviewLayout ;
2627import org .jabref .logic .preview .PreviewLayout ;
2728import org .jabref .model .entry .field .SpecialField ;
28- import org .jabref .preferences .JabRefPreferences ;
2929import org .jabref .preferences .PreferencesService ;
3030import org .jabref .preferences .PreviewPreferences ;
3131
3232public class RightClickMenu {
3333
34- public static ContextMenu create (BibEntryTableViewModel entry , KeyBindingRepository keyBindingRepository , BasePanel panel , DialogService dialogService , StateManager stateManager , PreferencesService preferencesService ) {
34+ public static ContextMenu create (BibEntryTableViewModel entry ,
35+ KeyBindingRepository keyBindingRepository ,
36+ BasePanel panel ,
37+ DialogService dialogService ,
38+ StateManager stateManager ,
39+ PreferencesService preferencesService ,
40+ ClipBoardManager clipBoardManager ) {
3541 ContextMenu contextMenu = new ContextMenu ();
3642 ActionFactory factory = new ActionFactory (keyBindingRepository );
3743
3844 contextMenu .getItems ().add (factory .createMenuItem (StandardActions .COPY , new EditAction (StandardActions .COPY , panel .frame (), stateManager )));
39- contextMenu .getItems ().add (createCopySubMenu (panel , factory , dialogService , stateManager , preferencesService ));
45+ contextMenu .getItems ().add (createCopySubMenu (panel , factory , dialogService , stateManager , preferencesService , clipBoardManager ));
4046 contextMenu .getItems ().add (factory .createMenuItem (StandardActions .PASTE , new EditAction (StandardActions .PASTE , panel .frame (), stateManager )));
4147 contextMenu .getItems ().add (factory .createMenuItem (StandardActions .CUT , new EditAction (StandardActions .CUT , panel .frame (), stateManager )));
4248 contextMenu .getItems ().add (factory .createMenuItem (StandardActions .DELETE_ENTRY , new EditAction (StandardActions .DELETE_ENTRY , panel .frame (), stateManager )));
@@ -47,9 +53,7 @@ public static ContextMenu create(BibEntryTableViewModel entry, KeyBindingReposit
4753
4854 contextMenu .getItems ().add (new SeparatorMenuItem ());
4955
50- if (Globals .prefs .getBoolean (JabRefPreferences .SPECIALFIELDSENABLED )) {
51- // ToDo: SpecialField needs the active BasePanel to mark it as changed.
52- // Refactor BasePanel, should mark the BibDatabaseContext or the UndoManager as dirty instead!
56+ if (preferencesService .getSpecialFieldsPreferences ().isSpecialFieldsEnabled ()) {
5357 contextMenu .getItems ().add (SpecialFieldMenuItemFactory .createSpecialFieldMenu (SpecialField .RANKING , factory , panel .frame (), dialogService , stateManager ));
5458 contextMenu .getItems ().add (SpecialFieldMenuItemFactory .getSpecialFieldSingleItem (SpecialField .RELEVANCE , factory , panel .frame (), dialogService , stateManager ));
5559 contextMenu .getItems ().add (SpecialFieldMenuItemFactory .getSpecialFieldSingleItem (SpecialField .QUALITY , factory , panel .frame (), dialogService , stateManager ));
@@ -76,30 +80,35 @@ public static ContextMenu create(BibEntryTableViewModel entry, KeyBindingReposit
7680 return contextMenu ;
7781 }
7882
79- private static Menu createCopySubMenu (BasePanel panel , ActionFactory factory , DialogService dialogService , StateManager stateManager , PreferencesService preferencesService ) {
83+ private static Menu createCopySubMenu (BasePanel panel ,
84+ ActionFactory factory ,
85+ DialogService dialogService ,
86+ StateManager stateManager ,
87+ PreferencesService preferencesService ,
88+ ClipBoardManager clipBoardManager ) {
8089 Menu copySpecialMenu = factory .createMenu (StandardActions .COPY_MORE );
81- copySpecialMenu .getItems ().add (factory .createMenuItem (StandardActions .COPY_TITLE , new CopyMoreAction (StandardActions .COPY_TITLE , dialogService , stateManager , Globals . clipboardManager , preferencesService )));
82- copySpecialMenu .getItems ().add (factory .createMenuItem (StandardActions .COPY_KEY , new CopyMoreAction (StandardActions .COPY_KEY , dialogService , stateManager , Globals . clipboardManager , preferencesService )));
83- copySpecialMenu .getItems ().add (factory .createMenuItem (StandardActions .COPY_CITE_KEY , new CopyMoreAction (StandardActions .COPY_CITE_KEY , dialogService , stateManager , Globals . clipboardManager , preferencesService )));
84- copySpecialMenu .getItems ().add (factory .createMenuItem (StandardActions .COPY_KEY_AND_TITLE , new CopyMoreAction (StandardActions .COPY_KEY_AND_TITLE , dialogService , stateManager , Globals . clipboardManager , preferencesService )));
85- copySpecialMenu .getItems ().add (factory .createMenuItem (StandardActions .COPY_KEY_AND_LINK , new CopyMoreAction (StandardActions .COPY_KEY_AND_LINK , dialogService , stateManager , Globals . clipboardManager , preferencesService )));
90+ copySpecialMenu .getItems ().add (factory .createMenuItem (StandardActions .COPY_TITLE , new CopyMoreAction (StandardActions .COPY_TITLE , dialogService , stateManager , clipBoardManager , preferencesService )));
91+ copySpecialMenu .getItems ().add (factory .createMenuItem (StandardActions .COPY_KEY , new CopyMoreAction (StandardActions .COPY_KEY , dialogService , stateManager , clipBoardManager , preferencesService )));
92+ copySpecialMenu .getItems ().add (factory .createMenuItem (StandardActions .COPY_CITE_KEY , new CopyMoreAction (StandardActions .COPY_CITE_KEY , dialogService , stateManager , clipBoardManager , preferencesService )));
93+ copySpecialMenu .getItems ().add (factory .createMenuItem (StandardActions .COPY_KEY_AND_TITLE , new CopyMoreAction (StandardActions .COPY_KEY_AND_TITLE , dialogService , stateManager , clipBoardManager , preferencesService )));
94+ copySpecialMenu .getItems ().add (factory .createMenuItem (StandardActions .COPY_KEY_AND_LINK , new CopyMoreAction (StandardActions .COPY_KEY_AND_LINK , dialogService , stateManager , clipBoardManager , preferencesService )));
8695
8796 // the submenu will behave dependent on what style is currently selected (citation/preview)
8897 PreviewPreferences previewPreferences = Globals .prefs .getPreviewPreferences ();
8998 PreviewLayout style = previewPreferences .getCurrentPreviewStyle ();
9099 if (style instanceof CitationStylePreviewLayout ) {
91- copySpecialMenu .getItems ().add (factory .createMenuItem (StandardActions .COPY_CITATION_HTML , new CopyCitationAction (CitationStyleOutputFormat .HTML , dialogService , stateManager , Globals . clipboardManager , previewPreferences )));
100+ copySpecialMenu .getItems ().add (factory .createMenuItem (StandardActions .COPY_CITATION_HTML , new CopyCitationAction (CitationStyleOutputFormat .HTML , dialogService , stateManager , clipBoardManager , previewPreferences )));
92101 Menu copyCitationMenu = factory .createMenu (StandardActions .COPY_CITATION_MORE );
93- copyCitationMenu .getItems ().add (factory .createMenuItem (StandardActions .COPY_CITATION_TEXT , new CopyCitationAction (CitationStyleOutputFormat .TEXT , dialogService , stateManager , Globals . clipboardManager , previewPreferences )));
94- copyCitationMenu .getItems ().add (factory .createMenuItem (StandardActions .COPY_CITATION_RTF , new CopyCitationAction (CitationStyleOutputFormat .RTF , dialogService , stateManager , Globals . clipboardManager , previewPreferences )));
95- copyCitationMenu .getItems ().add (factory .createMenuItem (StandardActions .COPY_CITATION_ASCII_DOC , new CopyCitationAction (CitationStyleOutputFormat .ASCII_DOC , dialogService , stateManager , Globals . clipboardManager , previewPreferences )));
96- copyCitationMenu .getItems ().add (factory .createMenuItem (StandardActions .COPY_CITATION_XSLFO , new CopyCitationAction (CitationStyleOutputFormat .XSL_FO , dialogService , stateManager , Globals . clipboardManager , previewPreferences )));
102+ copyCitationMenu .getItems ().add (factory .createMenuItem (StandardActions .COPY_CITATION_TEXT , new CopyCitationAction (CitationStyleOutputFormat .TEXT , dialogService , stateManager , clipBoardManager , previewPreferences )));
103+ copyCitationMenu .getItems ().add (factory .createMenuItem (StandardActions .COPY_CITATION_RTF , new CopyCitationAction (CitationStyleOutputFormat .RTF , dialogService , stateManager , clipBoardManager , previewPreferences )));
104+ copyCitationMenu .getItems ().add (factory .createMenuItem (StandardActions .COPY_CITATION_ASCII_DOC , new CopyCitationAction (CitationStyleOutputFormat .ASCII_DOC , dialogService , stateManager , clipBoardManager , previewPreferences )));
105+ copyCitationMenu .getItems ().add (factory .createMenuItem (StandardActions .COPY_CITATION_XSLFO , new CopyCitationAction (CitationStyleOutputFormat .XSL_FO , dialogService , stateManager , clipBoardManager , previewPreferences )));
97106 copySpecialMenu .getItems ().add (copyCitationMenu );
98107 } else {
99- copySpecialMenu .getItems ().add (factory .createMenuItem (StandardActions .COPY_CITATION_PREVIEW , new CopyCitationAction (CitationStyleOutputFormat .HTML , dialogService , stateManager , Globals . clipboardManager , previewPreferences )));
108+ copySpecialMenu .getItems ().add (factory .createMenuItem (StandardActions .COPY_CITATION_PREVIEW , new CopyCitationAction (CitationStyleOutputFormat .HTML , dialogService , stateManager , clipBoardManager , previewPreferences )));
100109 }
101110
102- copySpecialMenu .getItems ().add (factory .createMenuItem (StandardActions .EXPORT_TO_CLIPBOARD , new ExportToClipboardAction (panel , dialogService , Globals .exportFactory , Globals . clipboardManager , Globals .TASK_EXECUTOR )));
111+ copySpecialMenu .getItems ().add (factory .createMenuItem (StandardActions .EXPORT_TO_CLIPBOARD , new ExportToClipboardAction (panel , dialogService , Globals .exportFactory , clipBoardManager , Globals .TASK_EXECUTOR )));
103112 return copySpecialMenu ;
104113 }
105114}
0 commit comments