use of org.jabref.gui.protectedterms.NewProtectedTermsFileDialog in project jabref by JabRef.
the class ProtectedTermsMenu method updateFiles.
private void updateFiles() {
externalFiles.getItems().clear();
for (ProtectedTermsList list : Globals.protectedTermsLoader.getProtectedTermsLists()) {
if (!list.isInternalList()) {
MenuItem fileItem = new MenuItem(list.getDescription());
fileItem.setOnAction(event -> {
String selectedText = opener.getSelectedText();
if ((selectedText != null) && !selectedText.isEmpty()) {
list.addProtectedTerm(selectedText);
}
});
externalFiles.getItems().add(fileItem);
}
}
externalFiles.getItems().add(new SeparatorMenuItem());
MenuItem addToNewFileItem = new MenuItem(Localization.lang("New") + "...");
addToNewFileItem.setOnAction(event -> {
NewProtectedTermsFileDialog dialog = new NewProtectedTermsFileDialog(JabRefGUI.getMainFrame(), Globals.protectedTermsLoader);
dialog.setVisible(true);
if (dialog.isOKPressed()) {
Globals.prefs.setProtectedTermsPreferences(Globals.protectedTermsLoader);
}
});
externalFiles.getItems().add(addToNewFileItem);
}
Aggregations