Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moved ContentSelectorsDialog to library properties and preferences to file menu #9768

Merged
merged 7 commits into from
Apr 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,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 <kbd>Delete</kbd> 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)



Expand Down Expand Up @@ -66,7 +68,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)



Expand Down
18 changes: 6 additions & 12 deletions src/main/java/org/jabref/gui/JabRefFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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)),
Expand Down Expand Up @@ -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)),
Expand Down Expand Up @@ -990,7 +985,6 @@ private MenuBar createMenu() {
lookup,
tools,
view,
options,
help);
menu.setUseSystemMenuBar(true);
return menu;
Expand Down
1 change: 0 additions & 1 deletion src/main/java/org/jabref/gui/actions/StandardActions.java
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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)
);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8"?>

<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.ListView?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.VBox?>
<?import org.jabref.gui.icon.JabRefIconView?>
<fx:root spacing="10.0" type="VBox"
xmlns="http://javafx.com/javafx" xmlns:fx="http://javafx.com/fxml"
fx:controller="org.jabref.gui.libraryproperties.contentselectors.ContentSelectorView">
<HBox spacing="10.0" VBox.vgrow="ALWAYS">
<VBox spacing="10.0" HBox.hgrow="ALWAYS">
<Label styleClass="sectionHeader" text="%Field names"/>
<ListView fx:id="fieldsListView" VBox.vgrow="ALWAYS"/>
<HBox spacing="10.0" alignment="BASELINE_RIGHT">
<Button text="%Add" onAction="#addNewFieldName">
<graphic>
<JabRefIconView glyph="ADD_NOBOX"/>
</graphic>
</Button>
<Button fx:id="removeFieldNameButton" text="%Remove" onAction="#removeFieldName">
<graphic>
<JabRefIconView glyph="REMOVE_NOBOX"/>
</graphic>
</Button>
</HBox>
</VBox>

<VBox spacing="10.0" HBox.hgrow="ALWAYS">
<Label styleClass="sectionHeader" text="%Keywords"/>
<ListView fx:id="keywordsListView" VBox.vgrow="ALWAYS"/>
<HBox spacing="10.0" alignment="BASELINE_RIGHT">
<Button fx:id="addKeywordButton" text="%Add" onAction="#addNewKeyword">
<graphic>
<JabRefIconView glyph="ADD_NOBOX"/>
</graphic>
</Button>
<Button fx:id="removeKeywordButton" text="%Remove" onAction="#removeKeyword">
<graphic>
<JabRefIconView glyph="REMOVE_NOBOX"/>
</graphic>
</Button>
</HBox>
</VBox>
</HBox>
</fx:root>
Original file line number Diff line number Diff line change
@@ -1,62 +1,53 @@
package org.jabref.gui.contentselector;
package org.jabref.gui.libraryproperties.contentselectors;

import java.util.Optional;
import java.util.function.Supplier;

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<Void> {
public class ContentSelectorView extends AbstractPropertiesTabView<ContentSelectorViewModel> {

@FXML private Button addFieldNameButton;
@FXML private Button removeFieldNameButton;
@FXML private Button addKeywordButton;
@FXML private Button removeKeywordButton;
@FXML private ListView<Field> fieldsListView;
@FXML private ListView<String> 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();
Expand Down Expand Up @@ -115,9 +106,4 @@ private Optional<Field> getSelectedField() {
private Optional<String> getSelectedKeyword() {
return Optional.of(keywordsListView.getSelectionModel()).map(SelectionModel::getSelectedItem);
}

private void saveChangesAndClose() {
viewModel.saveChanges();
close();
}
}
Loading