diff --git a/CHANGELOG.md b/CHANGELOG.md
index f7354e0607d..29318baf986 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -40,6 +40,8 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve
- To avoid cluttering of the directory, We always delete the `.sav` file upon successful write. [#9675](https://github.com/JabRef/jabref/pull/9675)
- We improved the unlinking/deletion of multiple linked files of an entry using the Delete key. [#9473](https://github.com/JabRef/jabref/issues/9473)
- We moved the custom entry types dialog into the preferences dialog. [#9760](https://github.com/JabRef/jabref/pull/9760)
+- We moved the manage content selectors dialog to the library properties. [#9768](https://github.com/JabRef/jabref/pull/9768)
+- We moved the preferences menu command from the options menu to the file menu. [#9768](https://github.com/JabRef/jabref/pull/9768)
@@ -68,7 +70,7 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve
- We removed the support of BibTeXML. [#9540](https://github.com/JabRef/jabref/issues/9540)
- We removed support for Markdown syntax for strikethrough and task lists in comment fields. [#9726](https://github.com/JabRef/jabref/pull/9726)
-
+- We removed the options menu, because the two contents were moved to the File menu or the properties of the library. [#9768](https://github.com/JabRef/jabref/pull/9768)
diff --git a/src/main/java/org/jabref/gui/JabRefFrame.java b/src/main/java/org/jabref/gui/JabRefFrame.java
index 4ad61373d68..24cb8f44581 100644
--- a/src/main/java/org/jabref/gui/JabRefFrame.java
+++ b/src/main/java/org/jabref/gui/JabRefFrame.java
@@ -58,7 +58,6 @@
import org.jabref.gui.bibtexextractor.ExtractBibtexAction;
import org.jabref.gui.citationkeypattern.GenerateCitationKeyAction;
import org.jabref.gui.cleanup.CleanupAction;
-import org.jabref.gui.contentselector.ManageContentSelectorAction;
import org.jabref.gui.copyfiles.CopyFilesAction;
import org.jabref.gui.desktop.JabRefDesktop;
import org.jabref.gui.documentviewer.ShowDocumentViewerAction;
@@ -767,7 +766,6 @@ private MenuBar createMenu() {
Menu lookup = new Menu(Localization.lang("Lookup"));
Menu view = new Menu(Localization.lang("View"));
Menu tools = new Menu(Localization.lang("Tools"));
- Menu options = new Menu(Localization.lang("Options"));
Menu help = new Menu(Localization.lang("Help"));
file.getItems().addAll(
@@ -797,8 +795,13 @@ private MenuBar createMenu() {
new SeparatorMenuItem(),
+ factory.createMenuItem(StandardActions.SHOW_PREFS, new ShowPreferencesAction(this, taskExecutor)),
+
+ new SeparatorMenuItem(),
+
factory.createMenuItem(StandardActions.CLOSE_LIBRARY, new CloseDatabaseAction()),
- factory.createMenuItem(StandardActions.QUIT, new CloseAction()));
+ factory.createMenuItem(StandardActions.QUIT, new CloseAction())
+ );
edit.getItems().addAll(
factory.createMenuItem(StandardActions.UNDO, new UndoRedoAction(StandardActions.UNDO, this, dialogService, stateManager)),
@@ -944,14 +947,6 @@ private MenuBar createMenu() {
factory.createMenuItem(StandardActions.OPEN_CONSOLE, new OpenConsoleAction(stateManager, prefs, dialogService))
);
- options.getItems().addAll(
- factory.createMenuItem(StandardActions.SHOW_PREFS, new ShowPreferencesAction(this, Globals.TASK_EXECUTOR)),
-
- new SeparatorMenuItem(),
-
- factory.createMenuItem(StandardActions.MANAGE_CONTENT_SELECTORS, new ManageContentSelectorAction(this, stateManager))
- );
-
help.getItems().addAll(
factory.createMenuItem(StandardActions.HELP, new HelpAction(HelpFile.CONTENTS, dialogService)),
factory.createMenuItem(StandardActions.OPEN_FORUM, new OpenBrowserAction("http://discourse.jabref.org/", dialogService)),
@@ -990,7 +985,6 @@ private MenuBar createMenu() {
lookup,
tools,
view,
- options,
help);
menu.setUseSystemMenuBar(true);
return menu;
diff --git a/src/main/java/org/jabref/gui/actions/StandardActions.java b/src/main/java/org/jabref/gui/actions/StandardActions.java
index 90641540e48..8d9d8249af4 100644
--- a/src/main/java/org/jabref/gui/actions/StandardActions.java
+++ b/src/main/java/org/jabref/gui/actions/StandardActions.java
@@ -115,7 +115,6 @@ public enum StandardActions implements Action {
SHOW_PREFS(Localization.lang("Preferences"), IconTheme.JabRefIcons.PREFERENCES),
MANAGE_JOURNALS(Localization.lang("Manage journal abbreviations")),
CUSTOMIZE_KEYBINDING(Localization.lang("Customize key bindings"), IconTheme.JabRefIcons.KEY_BINDINGS),
- MANAGE_CONTENT_SELECTORS(Localization.lang("Manage content selectors"), IconTheme.JabRefIcons.SELECTORS),
EDIT_ENTRY(Localization.lang("Open entry editor"), IconTheme.JabRefIcons.EDIT_ENTRY, KeyBinding.EDIT_ENTRY),
SHOW_PDF_VIEWER(Localization.lang("Open document viewer"), IconTheme.JabRefIcons.PDF_FILE),
diff --git a/src/main/java/org/jabref/gui/contentselector/ContentSelectorDialog.fxml b/src/main/java/org/jabref/gui/contentselector/ContentSelectorDialog.fxml
deleted file mode 100644
index b38994b81af..00000000000
--- a/src/main/java/org/jabref/gui/contentselector/ContentSelectorDialog.fxml
+++ /dev/null
@@ -1,66 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/main/java/org/jabref/gui/contentselector/ManageContentSelectorAction.java b/src/main/java/org/jabref/gui/contentselector/ManageContentSelectorAction.java
deleted file mode 100644
index 19a5b3cb254..00000000000
--- a/src/main/java/org/jabref/gui/contentselector/ManageContentSelectorAction.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package org.jabref.gui.contentselector;
-
-import org.jabref.gui.DialogService;
-import org.jabref.gui.JabRefFrame;
-import org.jabref.gui.LibraryTab;
-import org.jabref.gui.StateManager;
-import org.jabref.gui.actions.SimpleCommand;
-
-import com.airhacks.afterburner.injection.Injector;
-
-import static org.jabref.gui.actions.ActionHelper.needsDatabase;
-
-public class ManageContentSelectorAction extends SimpleCommand {
-
- private final JabRefFrame jabRefFrame;
-
- public ManageContentSelectorAction(JabRefFrame jabRefFrame, StateManager stateManager) {
- this.jabRefFrame = jabRefFrame;
-
- this.executable.bind(needsDatabase(stateManager));
- }
-
- @Override
- public void execute() {
- DialogService dialogService = Injector.instantiateModelOrService(DialogService.class);
- LibraryTab libraryTab = jabRefFrame.getCurrentLibraryTab();
- dialogService.showCustomDialogAndWait(new ContentSelectorDialogView(libraryTab));
- }
-}
diff --git a/src/main/java/org/jabref/gui/libraryproperties/LibraryPropertiesViewModel.java b/src/main/java/org/jabref/gui/libraryproperties/LibraryPropertiesViewModel.java
index 6620813a81a..4738c7e30bd 100644
--- a/src/main/java/org/jabref/gui/libraryproperties/LibraryPropertiesViewModel.java
+++ b/src/main/java/org/jabref/gui/libraryproperties/LibraryPropertiesViewModel.java
@@ -3,6 +3,7 @@
import java.util.List;
import org.jabref.gui.libraryproperties.constants.ConstantsPropertiesView;
+import org.jabref.gui.libraryproperties.contentselectors.ContentSelectorView;
import org.jabref.gui.libraryproperties.general.GeneralPropertiesView;
import org.jabref.gui.libraryproperties.keypattern.KeyPatternPropertiesView;
import org.jabref.gui.libraryproperties.saving.SavingPropertiesView;
@@ -17,7 +18,8 @@ public LibraryPropertiesViewModel(BibDatabaseContext databaseContext) {
new GeneralPropertiesView(databaseContext),
new SavingPropertiesView(databaseContext),
new ConstantsPropertiesView(databaseContext),
- new KeyPatternPropertiesView(databaseContext)
+ new KeyPatternPropertiesView(databaseContext),
+ new ContentSelectorView(databaseContext)
);
}
diff --git a/src/main/java/org/jabref/gui/libraryproperties/contentselectors/ContentSelector.fxml b/src/main/java/org/jabref/gui/libraryproperties/contentselectors/ContentSelector.fxml
new file mode 100644
index 00000000000..382da4d7050
--- /dev/null
+++ b/src/main/java/org/jabref/gui/libraryproperties/contentselectors/ContentSelector.fxml
@@ -0,0 +1,47 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/main/java/org/jabref/gui/contentselector/ContentSelectorDialogView.java b/src/main/java/org/jabref/gui/libraryproperties/contentselectors/ContentSelectorView.java
similarity index 73%
rename from src/main/java/org/jabref/gui/contentselector/ContentSelectorDialogView.java
rename to src/main/java/org/jabref/gui/libraryproperties/contentselectors/ContentSelectorView.java
index 403393cacc8..90f354b71ce 100644
--- a/src/main/java/org/jabref/gui/contentselector/ContentSelectorDialogView.java
+++ b/src/main/java/org/jabref/gui/libraryproperties/contentselectors/ContentSelectorView.java
@@ -1,4 +1,4 @@
-package org.jabref.gui.contentselector;
+package org.jabref.gui.libraryproperties.contentselectors;
import java.util.Optional;
import java.util.function.Supplier;
@@ -6,57 +6,48 @@
import javafx.beans.property.ListProperty;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
-import javafx.scene.control.ButtonType;
import javafx.scene.control.ListView;
import javafx.scene.control.SelectionModel;
import org.jabref.gui.DialogService;
-import org.jabref.gui.LibraryTab;
-import org.jabref.gui.theme.ThemeManager;
-import org.jabref.gui.util.BaseDialog;
-import org.jabref.gui.util.ControlHelper;
+import org.jabref.gui.libraryproperties.AbstractPropertiesTabView;
import org.jabref.gui.util.ViewModelListCellFactory;
import org.jabref.logic.l10n.Localization;
+import org.jabref.model.database.BibDatabaseContext;
import org.jabref.model.entry.field.Field;
import com.airhacks.afterburner.views.ViewLoader;
import com.tobiasdiez.easybind.EasyBind;
import jakarta.inject.Inject;
-public class ContentSelectorDialogView extends BaseDialog {
+public class ContentSelectorView extends AbstractPropertiesTabView {
- @FXML private Button addFieldNameButton;
@FXML private Button removeFieldNameButton;
@FXML private Button addKeywordButton;
@FXML private Button removeKeywordButton;
@FXML private ListView fieldsListView;
@FXML private ListView keywordsListView;
- @FXML private ButtonType saveButton;
@Inject private DialogService dialogService;
- @Inject private ThemeManager themeManager;
- private final LibraryTab libraryTab;
- private ContentSelectorDialogViewModel viewModel;
+ private final BibDatabaseContext databaseContext;
- public ContentSelectorDialogView(LibraryTab libraryTab) {
- this.setTitle(Localization.lang("Manage content selectors"));
- this.getDialogPane().setPrefSize(375, 475);
-
- this.libraryTab = libraryTab;
+ public ContentSelectorView(BibDatabaseContext databaseContext) {
+ this.databaseContext = databaseContext;
ViewLoader.view(this)
- .load()
- .setAsDialogPane(this);
-
- ControlHelper.setAction(saveButton, getDialogPane(), event -> saveChangesAndClose());
+ .root(this)
+ .load();
+ }
- themeManager.updateFontStyle(getDialogPane().getScene());
+ @Override
+ public String getTabName() {
+ return Localization.lang("Content selectors");
}
@FXML
public void initialize() {
- viewModel = new ContentSelectorDialogViewModel(libraryTab, dialogService);
+ this.viewModel = new ContentSelectorViewModel(databaseContext, dialogService);
initFieldNameComponents();
initKeywordsComponents();
@@ -115,9 +106,4 @@ private Optional getSelectedField() {
private Optional getSelectedKeyword() {
return Optional.of(keywordsListView.getSelectionModel()).map(SelectionModel::getSelectedItem);
}
-
- private void saveChangesAndClose() {
- viewModel.saveChanges();
- close();
- }
}
diff --git a/src/main/java/org/jabref/gui/contentselector/ContentSelectorDialogViewModel.java b/src/main/java/org/jabref/gui/libraryproperties/contentselectors/ContentSelectorViewModel.java
similarity index 83%
rename from src/main/java/org/jabref/gui/contentselector/ContentSelectorDialogViewModel.java
rename to src/main/java/org/jabref/gui/libraryproperties/contentselectors/ContentSelectorViewModel.java
index fa8e5b00787..66e1d12bab4 100644
--- a/src/main/java/org/jabref/gui/contentselector/ContentSelectorDialogViewModel.java
+++ b/src/main/java/org/jabref/gui/libraryproperties/contentselectors/ContentSelectorViewModel.java
@@ -1,4 +1,4 @@
-package org.jabref.gui.contentselector;
+package org.jabref.gui.libraryproperties.contentselectors;
import java.util.ArrayList;
import java.util.Arrays;
@@ -20,39 +20,42 @@
import javafx.beans.property.StringProperty;
import javafx.collections.FXCollections;
-import org.jabref.gui.AbstractViewModel;
import org.jabref.gui.DialogService;
-import org.jabref.gui.LibraryTab;
+import org.jabref.gui.libraryproperties.PropertiesTabViewModel;
import org.jabref.logic.l10n.Localization;
+import org.jabref.model.database.BibDatabaseContext;
import org.jabref.model.entry.field.Field;
import org.jabref.model.entry.field.FieldFactory;
import org.jabref.model.entry.field.StandardField;
import org.jabref.model.metadata.ContentSelector;
import org.jabref.model.metadata.MetaData;
-class ContentSelectorDialogViewModel extends AbstractViewModel {
+public class ContentSelectorViewModel implements PropertiesTabViewModel {
private static final List DEFAULT_FIELD_NAMES = Arrays.asList(StandardField.AUTHOR, StandardField.JOURNAL, StandardField.KEYWORDS, StandardField.PUBLISHER);
- private final LibraryTab libraryTab;
private final MetaData metaData;
private final DialogService dialogService;
private final Map> fieldKeywordsMap = new HashMap<>();
- private ListProperty fields = new SimpleListProperty<>(FXCollections.observableArrayList());
- private ListProperty keywords = new SimpleListProperty<>(FXCollections.observableArrayList());
- private ObjectProperty selectedField = new SimpleObjectProperty<>();
- private StringProperty selectedKeyword = new SimpleStringProperty();
+ private final ListProperty fields = new SimpleListProperty<>(FXCollections.observableArrayList());
+ private final ListProperty keywords = new SimpleListProperty<>(FXCollections.observableArrayList());
+ private final ObjectProperty selectedField = new SimpleObjectProperty<>();
+ private final StringProperty selectedKeyword = new SimpleStringProperty();
- ContentSelectorDialogViewModel(LibraryTab libraryTab, DialogService dialogService) {
- this.libraryTab = libraryTab;
- this.metaData = libraryTab.getBibDatabaseContext().getMetaData();
+ ContentSelectorViewModel(BibDatabaseContext databaseContext, DialogService dialogService) {
+ this.metaData = databaseContext.getMetaData();
this.dialogService = dialogService;
- populateFieldNameKeywordsMapWithExistingValues();
- populateFieldNamesListWithValues();
}
- private void populateFieldNamesListWithValues() {
+ @Override
+ public void setValues() {
+ // Populate field names keyword map
+ metaData.getContentSelectors().getContentSelectors().forEach(
+ existingContentSelector -> fieldKeywordsMap.put(existingContentSelector.getField(), new ArrayList<>(existingContentSelector.getValues()))
+ );
+
+ // Populate Field names list
List existingFields = new ArrayList<>(fieldKeywordsMap.keySet());
fields.addAll(existingFields);
@@ -61,29 +64,32 @@ private void populateFieldNamesListWithValues() {
}
}
- private void populateFieldNameKeywordsMapWithExistingValues() {
- metaData.getContentSelectors().getContentSelectors().forEach(
- existingContentSelector -> fieldKeywordsMap.put(existingContentSelector.getField(), new ArrayList<>(existingContentSelector.getValues()))
- );
+ @Override
+ public void storeSettings() {
+ List metaDataFields = metaData.getContentSelectors().getFieldsWithSelectors();
+ fieldKeywordsMap.forEach((field, keywords) -> updateMetaDataContentSelector(metaDataFields, field, keywords));
+
+ List fieldNamesToRemove = filterFieldsToRemove();
+ fieldNamesToRemove.forEach(metaData::clearContentSelectors);
}
- ListProperty getFieldNamesBackingList() {
+ public ListProperty getFieldNamesBackingList() {
return fields;
}
- ObjectProperty selectedFieldProperty() {
+ public ObjectProperty selectedFieldProperty() {
return selectedField;
}
- BooleanBinding isFieldNameListEmpty() {
+ public BooleanBinding isFieldNameListEmpty() {
return Bindings.isEmpty(fields);
}
- BooleanBinding isNoFieldNameSelected() {
+ public BooleanBinding isNoFieldNameSelected() {
return Bindings.isEmpty(selectedField.asString());
}
- ListProperty getKeywordsBackingList() {
+ public ListProperty getKeywordsBackingList() {
return keywords;
}
@@ -171,17 +177,6 @@ private void removeKeyword(Field field, String keywordToRemove) {
keywords.remove(keywordToRemove);
}
- void saveChanges() {
- List metaDataFields = metaData.getContentSelectors().getFieldsWithSelectors();
- fieldKeywordsMap.forEach((field, keywords) -> updateMetaDataContentSelector(metaDataFields, field, keywords));
-
- List fieldNamesToRemove = filterFieldsToRemove();
- fieldNamesToRemove.forEach(metaData::clearContentSelectors);
-
- libraryTab.setupMainPanel();
- libraryTab.markNonUndoableBaseChanged();
- }
-
private List filterFieldsToRemove() {
Set newlyAddedKeywords = fieldKeywordsMap.keySet();
return metaData.getContentSelectors().getFieldsWithSelectors().stream()
diff --git a/src/main/java/org/jabref/gui/libraryproperties/keypattern/KeyPatternProperties.fxml b/src/main/java/org/jabref/gui/libraryproperties/keypattern/KeyPatternProperties.fxml
index 7977b51647a..4c6c7106975 100644
--- a/src/main/java/org/jabref/gui/libraryproperties/keypattern/KeyPatternProperties.fxml
+++ b/src/main/java/org/jabref/gui/libraryproperties/keypattern/KeyPatternProperties.fxml
@@ -4,6 +4,7 @@
+
-
+
diff --git a/src/main/resources/l10n/JabRef_en.properties b/src/main/resources/l10n/JabRef_en.properties
index 5ae1aec7593..188a114e8d4 100644
--- a/src/main/resources/l10n/JabRef_en.properties
+++ b/src/main/resources/l10n/JabRef_en.properties
@@ -608,8 +608,6 @@ Operating\ System\ (Provides\ for\ better\ recommendations\ by\ giving\ an\ indi
Optional\ fields=Optional fields
-Options=Options
-
or=or
Override\ default\ file\ directories=Override default file directories
@@ -1192,7 +1190,6 @@ Four\ stars=Four stars
Five\ stars=Five stars
Help\ on\ special\ fields=Help on special fields
Keywords\ of\ selected\ entries=Keywords of selected entries
-Manage\ content\ selectors=Manage content selectors
Content\ selectors=Content selectors
Manage\ keywords=Manage keywords
No\ priority\ information=No priority information
diff --git a/src/test/java/org/jabref/gui/contentselector/ContentSelectorDialogViewModelTest.java b/src/test/java/org/jabref/gui/libraryproperties/contentselectors/ContentSelectorViewModelTest.java
similarity index 88%
rename from src/test/java/org/jabref/gui/contentselector/ContentSelectorDialogViewModelTest.java
rename to src/test/java/org/jabref/gui/libraryproperties/contentselectors/ContentSelectorViewModelTest.java
index 57873128975..af7db3bf09a 100644
--- a/src/test/java/org/jabref/gui/contentselector/ContentSelectorDialogViewModelTest.java
+++ b/src/test/java/org/jabref/gui/libraryproperties/contentselectors/ContentSelectorViewModelTest.java
@@ -1,4 +1,4 @@
-package org.jabref.gui.contentselector;
+package org.jabref.gui.libraryproperties.contentselectors;
import java.util.Arrays;
import java.util.List;
@@ -9,7 +9,6 @@
import javafx.collections.FXCollections;
import org.jabref.gui.DialogService;
-import org.jabref.gui.LibraryTab;
import org.jabref.logic.l10n.Localization;
import org.jabref.model.database.BibDatabaseContext;
import org.jabref.model.entry.field.Field;
@@ -24,19 +23,18 @@
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
-public class ContentSelectorDialogViewModelTest {
- private final LibraryTab libraryTab = mock(LibraryTab.class);
+public class ContentSelectorViewModelTest {
private final DialogService dialogService = mock(DialogService.class);
private final List DEFAULT_FIELDS = Arrays.asList(
StandardField.AUTHOR, StandardField.JOURNAL, StandardField.KEYWORDS, StandardField.PUBLISHER);
- private ContentSelectorDialogViewModel viewModel;
- private BibDatabaseContext bibDatabaseContext;
+ private ContentSelectorViewModel viewModel;
+ private BibDatabaseContext databaseContext;
@BeforeEach
void setUp() {
- bibDatabaseContext = new BibDatabaseContext();
- when(libraryTab.getBibDatabaseContext()).thenReturn(bibDatabaseContext);
- viewModel = new ContentSelectorDialogViewModel(libraryTab, dialogService);
+ databaseContext = new BibDatabaseContext();
+ viewModel = new ContentSelectorViewModel(databaseContext, dialogService);
+ viewModel.setValues();
}
@Test
@@ -122,10 +120,10 @@ void savingPersistsDataInDatabase() {
addField(testField);
addKeyword(testField, "test1");
addKeyword(testField, "test2");
- viewModel.saveChanges();
+ viewModel.storeSettings();
- List result = bibDatabaseContext.getMetaData()
- .getContentSelectorValuesForField(testField);
+ List result = databaseContext.getMetaData()
+ .getContentSelectorValuesForField(testField);
List expected = Arrays.asList("test1", "test2");
assertEquals(expected, result);