diff --git a/src/main/java/org/jabref/gui/DefaultInjector.java b/src/main/java/org/jabref/gui/DefaultInjector.java index e94e6fe8697..4f18a03b9e6 100644 --- a/src/main/java/org/jabref/gui/DefaultInjector.java +++ b/src/main/java/org/jabref/gui/DefaultInjector.java @@ -6,6 +6,7 @@ import org.jabref.gui.keyboard.KeyBindingRepository; import org.jabref.gui.util.TaskExecutor; import org.jabref.logic.journals.JournalAbbreviationLoader; +import org.jabref.logic.protectedterms.ProtectedTermsLoader; import org.jabref.model.util.FileUpdateMonitor; import org.jabref.preferences.PreferencesService; @@ -38,6 +39,8 @@ private static Object createDependency(Class clazz) { return Globals.stateManager; } else if (clazz == FileUpdateMonitor.class) { return Globals.getFileUpdateMonitor(); + } else if (clazz == ProtectedTermsLoader.class) { + return Globals.protectedTermsLoader; } else if (clazz == ClipBoardManager.class) { return Globals.clipboardManager; } else { diff --git a/src/main/java/org/jabref/gui/JabRefFrame.java b/src/main/java/org/jabref/gui/JabRefFrame.java index 8346fe58e7f..3f671c91904 100644 --- a/src/main/java/org/jabref/gui/JabRefFrame.java +++ b/src/main/java/org/jabref/gui/JabRefFrame.java @@ -69,7 +69,6 @@ import org.jabref.gui.actions.ManageCustomImportsAction; import org.jabref.gui.actions.ManageJournalsAction; import org.jabref.gui.actions.ManageKeywordsAction; -import org.jabref.gui.actions.ManageProtectedTermsAction; import org.jabref.gui.actions.NewDatabaseAction; import org.jabref.gui.actions.NewEntryAction; import org.jabref.gui.actions.NewEntryFromPlainTextAction; @@ -101,6 +100,7 @@ import org.jabref.gui.mergeentries.MergeEntriesAction; import org.jabref.gui.metadata.BibtexStringEditorAction; import org.jabref.gui.metadata.PreambleEditor; +import org.jabref.gui.protectedterms.ManageProtectedTermsAction; import org.jabref.gui.push.PushToApplicationButton; import org.jabref.gui.push.PushToApplications; import org.jabref.gui.search.GlobalSearchBar; @@ -937,7 +937,7 @@ private MenuBar createMenu() { factory.createMenuItem(StandardActions.MANAGE_EXTERNAL_FILETYPES, new EditExternalFileTypesAction()), factory.createMenuItem(StandardActions.MANAGE_JOURNALS, new ManageJournalsAction()), factory.createMenuItem(StandardActions.CUSTOMIZE_KEYBINDING, new CustomizeKeyBindingAction()), - factory.createMenuItem(StandardActions.MANAGE_PROTECTED_TERMS, new ManageProtectedTermsAction(this, Globals.protectedTermsLoader)), + factory.createMenuItem(StandardActions.MANAGE_PROTECTED_TERMS, new ManageProtectedTermsAction()), new SeparatorMenuItem(), diff --git a/src/main/java/org/jabref/gui/actions/ManageProtectedTermsAction.java b/src/main/java/org/jabref/gui/actions/ManageProtectedTermsAction.java deleted file mode 100644 index c4f05f955cf..00000000000 --- a/src/main/java/org/jabref/gui/actions/ManageProtectedTermsAction.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.jabref.gui.actions; - -import org.jabref.gui.JabRefFrame; -import org.jabref.gui.protectedterms.ProtectedTermsDialog; -import org.jabref.logic.protectedterms.ProtectedTermsLoader; - -public class ManageProtectedTermsAction extends SimpleCommand { - - private final JabRefFrame jabRefFrame; - private final ProtectedTermsLoader termsLoader; - - public ManageProtectedTermsAction(JabRefFrame jabRefFrame, ProtectedTermsLoader termsLoader) { - this.jabRefFrame = jabRefFrame; - this.termsLoader = termsLoader; - } - @Override - public void execute() { - ProtectedTermsDialog protectTermsDialog = new ProtectedTermsDialog(jabRefFrame); - protectTermsDialog.setVisible(true); - - } - -} diff --git a/src/main/java/org/jabref/gui/fieldeditors/contextmenu/ProtectedTermsMenu.java b/src/main/java/org/jabref/gui/fieldeditors/contextmenu/ProtectedTermsMenu.java index 4af7fec8023..85bd758232d 100644 --- a/src/main/java/org/jabref/gui/fieldeditors/contextmenu/ProtectedTermsMenu.java +++ b/src/main/java/org/jabref/gui/fieldeditors/contextmenu/ProtectedTermsMenu.java @@ -3,16 +3,12 @@ import java.util.List; import java.util.stream.Collectors; -import javax.swing.SwingUtilities; - import javafx.scene.control.Menu; import javafx.scene.control.MenuItem; import javafx.scene.control.SeparatorMenuItem; import javafx.scene.control.TextInputControl; import org.jabref.Globals; -import org.jabref.JabRefGUI; -import org.jabref.gui.protectedterms.NewProtectedTermsFileDialog; import org.jabref.logic.formatter.casechanger.ProtectTermsFormatter; import org.jabref.logic.l10n.Localization; import org.jabref.logic.protectedterms.ProtectedTermsList; @@ -65,21 +61,5 @@ private void updateFiles() { 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().getDialogService(), - loader); - - SwingUtilities.invokeLater(() -> { - dialog.setVisible(true); - - if (dialog.isOKPressed()) { - // Update preferences with new list - Globals.prefs.setProtectedTermsPreferences(loader); - this.updateFiles(); - } - }); - }); - externalFiles.getItems().add(addToNewFileItem); } } diff --git a/src/main/java/org/jabref/gui/protectedterms/ManageProtectedTermsAction.java b/src/main/java/org/jabref/gui/protectedterms/ManageProtectedTermsAction.java new file mode 100644 index 00000000000..34f4ff3f116 --- /dev/null +++ b/src/main/java/org/jabref/gui/protectedterms/ManageProtectedTermsAction.java @@ -0,0 +1,12 @@ +package org.jabref.gui.protectedterms; + +import org.jabref.gui.actions.SimpleCommand; + +public class ManageProtectedTermsAction extends SimpleCommand { + + @Override + public void execute() { + ManageProtectedTermsDialog protectTermsDialog = new ManageProtectedTermsDialog(); + protectTermsDialog.showAndWait(); + } +} diff --git a/src/main/java/org/jabref/gui/protectedterms/ManageProtectedTermsDialog.fxml b/src/main/java/org/jabref/gui/protectedterms/ManageProtectedTermsDialog.fxml new file mode 100644 index 00000000000..0b23bc0ccaf --- /dev/null +++ b/src/main/java/org/jabref/gui/protectedterms/ManageProtectedTermsDialog.fxml @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + +