diff --git a/CHANGELOG.md b/CHANGELOG.md index 5b7f10fe18e..a4ed0bab46b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -54,6 +54,7 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve - We improved the "Possible duplicate entries" window to remember its size and position throughout a session. [#6582](https://github.com/JabRef/jabref/issues/6582) - We divided the toolbar into small parts, so if the application window is to small, only a part of the toolbar is moved into the chevron popup. [#6682](https://github.com/JabRef/jabref/pull/6682) - We changed the layout for of the buttons in the Open Office side panel to ensure that the button text is always visible, specially when resizing. [#6639](https://github.com/JabRef/jabref/issues/6639) +- We merged the two new library commands in the file menu to one which always creates a new library in the default library mode. [#6359](https://github.com/JabRef/jabref/pull/6539#issuecomment-641056536) ### Fixed diff --git a/src/main/java/org/jabref/gui/JabRefFrame.java b/src/main/java/org/jabref/gui/JabRefFrame.java index 007b95c7b21..ea46b25feb0 100644 --- a/src/main/java/org/jabref/gui/JabRefFrame.java +++ b/src/main/java/org/jabref/gui/JabRefFrame.java @@ -134,7 +134,6 @@ import org.jabref.logic.undo.UndoRedoEvent; import org.jabref.logic.util.io.FileUtil; import org.jabref.model.database.BibDatabaseContext; -import org.jabref.model.database.BibDatabaseMode; import org.jabref.model.database.shared.DatabaseLocation; import org.jabref.model.entry.BibEntry; import org.jabref.model.entry.field.SpecialField; @@ -507,20 +506,14 @@ private Node createToolbar() { final Region leftSpacer = new Region(); final Region rightSpacer = new Region(); - final Button newLibrary; - if (Globals.prefs.getDefaultBibDatabaseMode() == BibDatabaseMode.BIBLATEX) { - newLibrary = factory.createIconButton(StandardActions.NEW_LIBRARY_BIBLATEX, new NewDatabaseAction(this, BibDatabaseMode.BIBLATEX)); - } else { - newLibrary = factory.createIconButton(StandardActions.NEW_LIBRARY_BIBTEX, new NewDatabaseAction(this, BibDatabaseMode.BIBTEX)); - } - final PushToApplicationAction pushToApplicationAction = getPushToApplicationsManager().getPushToApplicationAction(); final Button pushToApplicationButton = factory.createIconButton(pushToApplicationAction.getActionInformation(), pushToApplicationAction); pushToApplicationsManager.registerReconfigurable(pushToApplicationButton); ToolBar toolBar = new ToolBar( - new HBox(newLibrary, + new HBox( + factory.createIconButton(StandardActions.NEW_LIBRARY, new NewDatabaseAction(this, prefs)), factory.createIconButton(StandardActions.OPEN_LIBRARY, new OpenDatabaseAction(this)), factory.createIconButton(StandardActions.SAVE_LIBRARY, new SaveAction(SaveAction.SaveMethod.SAVE, this, stateManager))), @@ -733,10 +726,7 @@ private MenuBar createMenu() { Menu help = new Menu(Localization.lang("Help")); file.getItems().addAll( - factory.createSubMenu(StandardActions.NEW_LIBRARY, - factory.createMenuItem(StandardActions.NEW_LIBRARY_BIBTEX, new NewDatabaseAction(this, BibDatabaseMode.BIBTEX)), - factory.createMenuItem(StandardActions.NEW_LIBRARY_BIBLATEX, new NewDatabaseAction(this, BibDatabaseMode.BIBLATEX))), - + factory.createMenuItem(StandardActions.NEW_LIBRARY, new NewDatabaseAction(this, prefs)), factory.createMenuItem(StandardActions.OPEN_LIBRARY, getOpenDatabaseAction()), fileHistory, factory.createMenuItem(StandardActions.SAVE_LIBRARY, new SaveAction(SaveAction.SaveMethod.SAVE, this, stateManager)), diff --git a/src/main/java/org/jabref/gui/actions/StandardActions.java b/src/main/java/org/jabref/gui/actions/StandardActions.java index 31c848def09..58d7e36ca74 100644 --- a/src/main/java/org/jabref/gui/actions/StandardActions.java +++ b/src/main/java/org/jabref/gui/actions/StandardActions.java @@ -6,7 +6,6 @@ import org.jabref.gui.icon.JabRefIcon; import org.jabref.gui.keyboard.KeyBinding; import org.jabref.logic.l10n.Localization; -import org.jabref.model.database.BibDatabaseMode; public enum StandardActions implements Action { @@ -59,8 +58,6 @@ public enum StandardActions implements Action { RELEVANCE(Localization.lang("Relevance"), IconTheme.JabRefIcons.RELEVANCE), RELEVANT(Localization.lang("Toggle relevance"), IconTheme.JabRefIcons.RELEVANCE), NEW_LIBRARY(Localization.lang("New library"), IconTheme.JabRefIcons.NEW), - NEW_LIBRARY_BIBTEX(Localization.lang("New %0 library", BibDatabaseMode.BIBTEX.getFormattedName()), IconTheme.JabRefIcons.NEW), - NEW_LIBRARY_BIBLATEX(Localization.lang("New %0 library", BibDatabaseMode.BIBLATEX.getFormattedName()), IconTheme.JabRefIcons.NEW), OPEN_LIBRARY(Localization.lang("Open library"), IconTheme.JabRefIcons.OPEN, KeyBinding.OPEN_DATABASE), IMPORT(Localization.lang("Import"), IconTheme.JabRefIcons.IMPORT), EXPORT(Localization.lang("Export"), IconTheme.JabRefIcons.EXPORT, KeyBinding.EXPORT), diff --git a/src/main/java/org/jabref/gui/importer/NewDatabaseAction.java b/src/main/java/org/jabref/gui/importer/NewDatabaseAction.java index 553361ae451..b2f0b15307a 100644 --- a/src/main/java/org/jabref/gui/importer/NewDatabaseAction.java +++ b/src/main/java/org/jabref/gui/importer/NewDatabaseAction.java @@ -3,7 +3,7 @@ import org.jabref.gui.JabRefFrame; import org.jabref.gui.actions.SimpleCommand; import org.jabref.model.database.BibDatabaseContext; -import org.jabref.model.database.BibDatabaseMode; +import org.jabref.preferences.PreferencesService; /** * Create a new, empty, database. @@ -11,17 +11,23 @@ public class NewDatabaseAction extends SimpleCommand { private final JabRefFrame jabRefFrame; - private final BibDatabaseMode mode; + private final PreferencesService preferencesService; - public NewDatabaseAction(JabRefFrame jabRefFrame, BibDatabaseMode mode) { + /** + * Constructs a command to create a new library of the default type + * + * @param jabRefFrame the application frame of JabRef + * @param preferencesService the preferencesService of JabRef + */ + public NewDatabaseAction(JabRefFrame jabRefFrame, PreferencesService preferencesService) { this.jabRefFrame = jabRefFrame; - this.mode = mode; + this.preferencesService = preferencesService; } @Override public void execute() { BibDatabaseContext bibDatabaseContext = new BibDatabaseContext(); - bibDatabaseContext.setMode(mode); + bibDatabaseContext.setMode(preferencesService.getGeneralPreferences().getDefaultBibDatabaseMode()); jabRefFrame.addTab(bibDatabaseContext, true); } } diff --git a/src/main/java/org/jabref/gui/preferences/GeneralTab.fxml b/src/main/java/org/jabref/gui/preferences/GeneralTab.fxml index 86dfee7fdf9..2f39cdb4c68 100644 --- a/src/main/java/org/jabref/gui/preferences/GeneralTab.fxml +++ b/src/main/java/org/jabref/gui/preferences/GeneralTab.fxml @@ -29,7 +29,7 @@