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

Streamline new library command #6773

Merged
merged 21 commits into from
Aug 22, 2020
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
7629ee2
Squashed 'src/main/resources/csl-styles/' changes from 586e0b8408..c5…
Jun 1, 2020
5f72ad3
Merge commit '7629ee29c5b60711da5d1c64f8c2c8e146e90d6f'
Jun 1, 2020
52a6426
Squashed 'src/main/resources/csl-styles/' changes from c5f14e2c4d..71…
Jun 15, 2020
f678e52
Merge commit '52a64264feb20ea3506f7f11e70fcf24ec768682'
Jun 15, 2020
8887205
Squashed 'src/main/resources/csl-styles/' changes from 716f63557c..a9…
Jul 1, 2020
47bbd31
Merge commit '88872055561d37157537aece4b5d9fa859a138e9'
Jul 1, 2020
230305f
Squashed 'src/main/resources/csl-styles/' changes from a995c63a0a..bf…
Jul 15, 2020
8cdb629
Merge commit '230305ff8acf22110d88d441b552e634f17e0a6e'
Jul 15, 2020
7342055
Squashed 'src/main/resources/csl-styles/' changes from bf698acec7..7c…
Jul 30, 2020
5fd80c2
Merge commit '73420559d42065980d8dbbe6be6825f5a2e3ab18'
Jul 30, 2020
877a0c4
Squashed 'src/main/resources/csl-styles/' changes from 7cab2f7d8a..82…
Aug 1, 2020
1541cd1
Merge commit '877a0c4daf0117d4f910a5c5b679ad824c63bda9'
Aug 1, 2020
7ff4633
Squashed 'src/main/resources/csl-styles/' changes from 827b986621..eb…
Aug 15, 2020
8f1de8e
Merge commit '7ff46331ad541719aad203eb33d44e21db721554' into master
Aug 15, 2020
1bc3681
Merge remote-tracking branch 'origin/master' into master
calixtus Aug 19, 2020
98bfe5a
Merge remote-tracking branch 'upstream/master' into master
calixtus Aug 19, 2020
f482de6
Merged new library actions
calixtus Aug 19, 2020
8e41efd
l10n
calixtus Aug 19, 2020
d37a3dd
Removed unused constructor
calixtus Aug 20, 2020
262d29d
Fixed checkstyle failed check
calixtus Aug 20, 2020
3e27db6
Fixed one more checkstyle issue
calixtus Aug 20, 2020
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,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

Expand Down
15 changes: 3 additions & 12 deletions src/main/java/org/jabref/gui/JabRefFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -507,20 +507,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))),

Expand Down Expand Up @@ -733,10 +727,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)),
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/org/jabref/gui/actions/StandardActions.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,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),
Expand Down
16 changes: 11 additions & 5 deletions src/main/java/org/jabref/gui/importer/NewDatabaseAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,31 @@
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.
*/
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);
}
}
2 changes: 1 addition & 1 deletion src/main/java/org/jabref/gui/preferences/GeneralTab.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<ComboBox fx:id="language" prefWidth="200.0" GridPane.columnIndex="1"/>
<Label text="%Default encoding" GridPane.rowIndex="1"/>
<ComboBox fx:id="defaultEncoding" prefWidth="200.0" GridPane.columnIndex="1" GridPane.rowIndex="1"/>
<Label text="%Default bibliography mode" GridPane.rowIndex="2"/>
<Label text="%Default library mode" GridPane.rowIndex="2"/>
<ComboBox fx:id="biblatexMode" prefWidth="200.0" GridPane.columnIndex="1" GridPane.rowIndex="2"/>
</GridPane>
<CheckBox fx:id="inspectionWarningDuplicate"
Expand Down
3 changes: 1 addition & 2 deletions src/main/resources/l10n/JabRef_en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1368,7 +1368,7 @@ Automatically\ setting\ file\ links=Automatically setting file links
Regenerating\ citation\ keys\ according\ to\ metadata=Regenerating citation keys according to metadata
Regenerate\ all\ keys\ for\ the\ entries\ in\ a\ BibTeX\ file=Regenerate all keys for the entries in a BibTeX file
Show\ debug\ level\ messages=Show debug level messages
Default\ bibliography\ mode=Default bibliography mode
Default\ library\ mode=Default library mode
Show\ only\ preferences\ deviating\ from\ their\ default\ value=Show only preferences deviating from their default value
default=default
key=key
Expand Down Expand Up @@ -1870,7 +1870,6 @@ Find\ duplicates=Find duplicates
JabRef\ resources=JabRef resources
Manage\ journal\ abbreviations=Manage journal abbreviations
Manage\ protected\ terms=Manage protected terms
New\ %0\ library=New %0 library
New\ entry\ from\ plain\ text=New entry from plain text
New\ sublibrary\ based\ on\ AUX\ file=New sublibrary based on AUX file
Push\ entries\ to\ external\ application\ (%0)=Push entries to external application (%0)
Expand Down