From dc55a7643fd2dd41e73d4e27e7d7da264d5ff9f9 Mon Sep 17 00:00:00 2001 From: Carl Christian Snethlage <50491877+calixtus@users.noreply.github.com> Date: Sat, 22 Aug 2020 16:38:30 +0200 Subject: [PATCH] Streamline new library command (#6773) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Squashed 'src/main/resources/csl-styles/' changes from 586e0b8408..c5f14e2c4d c5f14e2c4d Update journal-of-plant-ecology.csl (#4837) b5d00abf54 Hotfix: pravnik.csl & iso690-full-note-cs.csl (#4833) fb8d48aec1 add PMID and DOI (#4832) 7ebdfff228 Update lancaster-university-harvard.csl (#4836) 8771e21166 Create journal-of-clinical-neurology.csl (#4835) 70beb7bd6c Harvard Lancaster: Fix in-text locator 0709b731c4 Update informal-logic.csl (#4831) d18d1338c1 Update gost-r-7-0-5-2008.csl (#4829) cfb5389ad4 Update gost-r-7-0-5-2008-numeric.csl (#4828) 0fc46eabf0 Update gost-r-7-0-5-2008-numeric-alphabetical.csl (#4827) fac26cb4f0 Create feminist-theory.csl (#4830) a2721e6aae Update pravnik.csl, masarykova-univerzita-pravnicka-fakulta.csl, and iso690-full-note-cs.csl (#4826) 2f0d735a16 Improve localization of DGfP 683d7d17ca Create zeitschrift-fur-theologie-und-philosophie.csl (#4813) 7c82406cb2 always show DOI in aps.csl (#4820) 1eb531d459 Update journal-of-international-business-studies.csl (#4819) 9caf926fc0 Create interdisziplinare-anthropologie.csl (#4818) 00210e123e UKSW2 (#4807) 015db6e8d3 UKSW1 (#4800) f706ef5e2f Update masarykova-univerzita-pravnicka-fakulta.csl (#4822) 096108d3ad Update epilepsia.csl (#4823) 07ebdc35bd Update eksploatacja-i-niezawodnosc.csl (#4824) 3d50f3cc5c Create ABNT-Universidade-Federal-de-Pernambuco-CFCH.csl (#4798) df94fa1832 Update eksploatacja-i-niezawodnosc.csl (#4808) 4089be5abb Update bulletin-de-la-societe-prehistorique-francaise.csl (#4810) f130aa7949 Update molecular-biology-and-evolution.csl (#4814) 86f452fda6 Create heiliger-dienst.csl (#4815) 5ccd3e9a21 Update revista-brasileira-de-ciencia-do-solo.csl (#4817) 0eea7348e0 Fix a delimiter in journal-of-the-royal-society-of-western-australia.csl (#4811) 1cbe790e45 Delete heiliger-dienst.csl 19fa29f7b0 Create heiliger-dienst.csl (#4787) 888bad15b5 Update RMIT Harvard to match Easy Cite (#4788) 46011dd948 Create universite-nangui-abrogoua-ufr-sn (#4676) 174adab070 Create apa-6th-edition-no-ampersand.csl (#4767) 03cf65f05d Create journal-of-plant-protection-research.csl (#4797) c749084451 Update eksploatacja-i-niezawodnosc.csl (#4782) 17e1501812 Update masarykova-univerzita-pravnicka-fakulta.csl (#4783) 5596d18a68 Update revista-brasileira-de-ciencia-do-solo.csl (#4790) 9c1a381876 create csl for the journal Textual Cultures (#4785) 83457623f6 Update taylor-and-francis-national-library-of-medicine.csl (#4786) 5ec1acfc1f Create british-journal-of-criminology.csl (#4789) 68550aca45 Update angewandte-chemie.csl (#4791) 09e27555c5 Create shock.csl (#4792) d46e49e52a Update antioxidants-and-redox-signaling.csl (#4793) git-subtree-dir: src/main/resources/csl-styles git-subtree-split: c5f14e2c4d1799827b202981f62322545cf17200 * Squashed 'src/main/resources/csl-styles/' changes from c5f14e2c4d..716f63557c 716f63557c Update changes in Harvard-Stellenbosch (#4862) a6a9a1af3a Create alkoholizmus-a-drogove-zavislosti.csl (#4859) 0560ca0b43 Update journal-of-the-american-college-of-surgeons.csl (#4858) 9e16631063 create independent style for cellular-and-molecular-gastroenterology-and-hepatology.csl (#4852) 87b0853e2c Update antiquity.csl (#4841) cb4e7f70a0 Update heart-rhythm.csl (#4850) b3b55eee3f Create iisue-moderno (#4846) 63973a7016 Create etasr.csl (#4848) 9942138d9b Create style for Journal of Vertebrate Biology (#4849) 7c7f3d343d Add Future Medicine dependents (#4838) abe2066984 Update methods-of-information-in-medicine.csl (#4847) c64d98b65d create independent style for new-zealand-journal-of-forestry-science (#4844) 28265f9ad8 Create continuity-and-change.csl (#4839) d065fdd9ec Create journal-of-clinical-ethics.csl (#4842) b9fbfa37d9 Update future-medicine.csl (#4843) ceb56fa72f Create future-medicine.csl (#4834) git-subtree-dir: src/main/resources/csl-styles git-subtree-split: 716f63557c0f32b3980432a6d124b73933722121 * Squashed 'src/main/resources/csl-styles/' changes from 716f63557c..a995c63a0a a995c63a0a Create errata.csl (#4894) 883b9cd71d Update archeologie-medievale.csl (#4892) a942b5c55d Update rmit-university-harvard.csl (#4890) 5d535fc878 Update universidade-do-porto-faculdade-de-engenharia-chicago.csl (#4891) f2a8fe3ec2 Fix AVMA style c5a2d7e22b Create universidade-do-porto-faculdade-de-engenharia-chicago.csl (#4872) 9f106ebb29 Update rmit-university-harvard.csl (#4884) 5213c2f483 Update universitetet-i-oslo-rettsvitenskap.csl (#4886) 7e0828d48c Update uclouvain-centre-charles-de-visscher-pour-le-droit-internationā€¦ (#4871) ae5eba3a8f Create revue-archeologique-de-lest.csl (#4881) 58a16727de Create pacific-conservation-biology.csl (#4880) 381106e341 Update national-institute-of-organisation-dynamics-australia-harvard.csl (#4879) c66a5c00d9 Create society-of-biblical-literature-author-date.csl (#4812) 008073c576 Create ruhr-universitat-bochum-medizinische-fakultat-variante-a.csl (#4874) 193385a00d Update manchester (#4878) fa9ef1148f Create Faculty of Psychology and Education Sciences, Porto (#4856) 2f70b14eae Add "personal communication" to remaining APA locales (#4866) 2b4f831d19 Fixed page-range-format (#4863) d5661ba156 universitat-bern-institut-fur-musikwissenschaft add missing cs:sort to cs:bibliography (#4860) e433c999ae fix delimiter issue for bioscience.csl (#4876) 4d97aabe83 update et-al settings for stroke.csl (#4875) 342b9e3c04 Update masarykova-univerzita-pravnicka-fakulta.csl (#4868) 91fe25eaf2 Add article number to IEEE (#4867) git-subtree-dir: src/main/resources/csl-styles git-subtree-split: a995c63a0a5cd56ede70cc131dfb566b2e7f2f48 * Squashed 'src/main/resources/csl-styles/' changes from a995c63a0a..bf698acec7 bf698acec7 Create common-market-law-review.csl (#4910) c962ecaea9 Create harvard-prifysgol-caerdydd.csl (#4922) 0c24e7f7f6 Update gewerblicher-rechtsschutz-und-urheberrecht.csl (#4923) d2ec1a736c Create Tijdschrift-voor-Geneeskunde.csl (#4907) 5df7250369 Update harvard-institut-fur-praxisforschung-de.csl (#4918) 093fd91618 Update universite-de-montreal-apa.csl (#4916) a3e41d49f7 Update thieme-german.csl (#4919) 648765ac11 add DOI to aerosol-science-and-technology.csl (#4909) bc1ebeece9 Reindent/reorder a8dc18a80d Fix documentation link for epidemiology & infection aab403aff7 Fix AGLC Newspaper date 4c018d5ef3 Add period between editor and translator (SBL styles) (#4906) 42f7491f64 Create geographische-zeitschrift.csl (#4898) a4002a6b0f Create german-kunstwissenschaft.csl (#4896) b01910b380 Disambiguation of names (#4895) git-subtree-dir: src/main/resources/csl-styles git-subtree-split: bf698acec747594a57e3c1423c351c69bc5ad6e1 * Squashed 'src/main/resources/csl-styles/' changes from bf698acec7..7cab2f7d8a 7cab2f7d8a Create depro-ufs.csl (#4947) 2fcda1fe03 Create journal-of-sport-science-and-medicine.csl (#4949) cd457d4bce Update american-marketing-association.csl (#4945) cacc4eefbd Create nejm-catalyst.csl (#4943) bd769b91da Update and rename dependent/chinese-medical-journal.csl to chinese-meā€¦ (#4941) 1f706cda6c Update health-services-research.csl (#4939) 76bcd1d9d7 Update journal-of-the-royal-society-of-western-australia.csl (#4932) e79640e74d Create afro-asia.csl (#4934) c601aa4e0f Update lancaster-university-harvard.csl (#4938) 184fd90210 Update collection-du-centre-jean-berard.csl (#4936) 82f9aec90f fix et-al & add DOI thyroid.csl (#4937) 4af169fc11 Create universidade-estadual-de-alagoas-uneal-abnt (#4885) 47165b3d5a Update and rename medical-physics.csl to dependent/medical-physics.csl (AMA) (#4905) 3cab27dc1a Update thieme-german.csl (#4931) eb2c9776e0 Create zeitschrift-fur-zahnarztliche-implantologie.csl (#4925) 4adb1ea0be Create karstenia.csl (#4929) 530a136786 Fix author substitute in Universita Cattolica git-subtree-dir: src/main/resources/csl-styles git-subtree-split: 7cab2f7d8ac0131f836c6cb55e88545ee5eda22a * Squashed 'src/main/resources/csl-styles/' changes from 7cab2f7d8a..827b986621 827b986621 add DOI preprint to american-society-for-microbiology.csl (#4946) git-subtree-dir: src/main/resources/csl-styles git-subtree-split: 827b986621348627f8e894d1b7f11191f905a8e2 * Squashed 'src/main/resources/csl-styles/' changes from 827b986621..eb0d37e0ff eb0d37e0ff Create natbib-plainnat-author-dat.csl (#4967) fb1592a1cd Update journal-of-fish-biology.csl (#4969) f6876cbe0f Update .travis.yml (#4970) d6d400b207 Create london-review-of-international-law.csl (#4966) d2a5ae1b16 Update harvard-stellenbosch-university.csl (#4965) 9c62141a40 Create phytopathologia-mediterranea.csl (#4964) 8ca2ea1a9c Update historical-materialism.csl (#4960) 80456dc749 Update historical-materialism.csl be2d91090c Update historical-materialism.csl 1d1cf095a6 Create atlande.csl (#4930) 89f41d404d Create juristische-zitierweise-oeffentliches-recht.csl (#4944) 8c677a08c5 Create korean-journal-of-gastroenterology.csl (#4954) eadb9508dd Create historical-materialism.csl (#4955) 5553dcdc9c Create revista-materia.csl (#4957) d23a3abd79 Bug fix in APA 6 original publication macro (#4959) 66f9974980 Always print publisher in APA 6th edition (#4899) 868809c063 Create agora.csl (#4940) 99c19c397e Update anthropologie-et-societes.csl (#4952) ee17423a93 Create critical-reviews-in-solid-state-and-materials-science.csl (#4951) 7a13a7d59e Create korean-journal-of-internal-medicine.csl (#4953) git-subtree-dir: src/main/resources/csl-styles git-subtree-split: eb0d37e0ff253e7c6d256b619e4831af306a28cf * Merged new library actions * l10n * Removed unused constructor * Fixed checkstyle failed check * Fixed one more checkstyle issue Co-authored-by: github actions --- CHANGELOG.md | 1 + src/main/java/org/jabref/gui/JabRefFrame.java | 16 +++------------- .../org/jabref/gui/actions/StandardActions.java | 3 --- .../jabref/gui/importer/NewDatabaseAction.java | 16 +++++++++++----- .../org/jabref/gui/preferences/GeneralTab.fxml | 2 +- src/main/resources/l10n/JabRef_en.properties | 3 +-- 6 files changed, 17 insertions(+), 24 deletions(-) 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 @@