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

Added preset for new entry keybindings and reintroduced defaults #7705

Merged
merged 16 commits into from
May 10, 2021
Merged
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve
- We added a feature that allows the user to copy highlighted text in the preview window. [#6962](https://github.com/JabRef/jabref/issues/6962)
- We added a feature that allows you to create new BibEntry via paste arxivId [#2292](https://github.com/JabRef/jabref/issues/2292)
- We added a feature that allows the user to choose whether to trust the target site when unable to find a valid certification path from the file download site. [#7616](https://github.com/JabRef/jabref/issues/7616)
- We added a keybinding preset for new entries. [#7705](https://github.com/JabRef/jabref/issues/7705)

### Changed

Expand All @@ -36,6 +37,7 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve
- Automatically found pdf files now have the linking button to the far left and uses a link icon with a plus instead of a briefcase. The file name also has lowered opacity(70%) until added. [#3607](https://github.com/JabRef/jabref/issues/3607)
- We simplified the select entry type form by splitting it into two parts ("Recommended" and "Others") based on internal usage data. [#6730](https://github.com/JabRef/jabref/issues/6730)
- The export to MS Office XML now uses the month name for the field `Month` instead of the two digit number [forum#2685](https://discourse.jabref.org/t/export-month-as-text-not-number/2685)
- We reintroduced missing default keybindings for new entries. [#7346](https://github.com/JabRef/jabref/issues/7346) [#7439](https://github.com/JabRef/jabref/issues/7439)

### Fixed

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/jabref/gui/entryeditor/EntryEditor.java
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ private void setupKeyBindings() {
event.consume();
break;
case CLOSE:
case CLOSE_ENTRY:
case EDIT_ENTRY:
close();
event.consume();
break;
Expand Down
15 changes: 8 additions & 7 deletions src/main/java/org/jabref/gui/keyboard/KeyBinding.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ public enum KeyBinding {
CHECK_INTEGRITY("Check integrity", Localization.lang("Check integrity"), "ctrl+F8", KeyBindingCategory.QUALITY),
CLEANUP("Cleanup", Localization.lang("Cleanup entries"), "alt+F8", KeyBindingCategory.QUALITY),
CLOSE_DATABASE("Close library", Localization.lang("Close library"), "ctrl+W", KeyBindingCategory.FILE),
CLOSE_ENTRY("Close entry", Localization.lang("Close entry"), "ctrl+E", KeyBindingCategory.VIEW),
CLOSE("Close dialog", Localization.lang("Close dialog"), "Esc", KeyBindingCategory.VIEW),
COPY("Copy", Localization.lang("Copy"), "ctrl+C", KeyBindingCategory.EDIT),
COPY_TITLE("Copy title", Localization.lang("Copy title"), "ctrl+shift+alt+T", KeyBindingCategory.EDIT),
Expand All @@ -44,7 +43,7 @@ public enum KeyBinding {
DELETE_ENTRY("Delete entry", Localization.lang("Delete entry"), "DELETE", KeyBindingCategory.BIBTEX),
DEFAULT_DIALOG_ACTION("Execute default action in dialog", Localization.lang("Execute default action in dialog"), "ctrl+ENTER", KeyBindingCategory.VIEW),
DOWNLOAD_FULL_TEXT("Download full text documents", Localization.lang("Download full text documents"), "alt+F7", KeyBindingCategory.QUALITY),
EDIT_ENTRY("Edit entry", Localization.lang("Edit entry"), "ctrl+E", KeyBindingCategory.BIBTEX),
EDIT_ENTRY("Open / close entry editor", Localization.lang("Open / close entry editor"), "ctrl+E", KeyBindingCategory.VIEW),
EXPORT("Export", Localization.lang("Export"), "ctrl+alt+e", KeyBindingCategory.FILE),
EXPORT_SELECTED("Export Selected", Localization.lang("Export selected entries"), "ctrl+shift+e", KeyBindingCategory.FILE),
EDIT_STRINGS("Edit strings", Localization.lang("Edit strings"), "ctrl+T", KeyBindingCategory.BIBTEX),
Expand All @@ -61,17 +60,19 @@ public enum KeyBinding {
IMPORT_INTO_CURRENT_DATABASE("Import into current library", Localization.lang("Import into current library"), "ctrl+I", KeyBindingCategory.FILE),
IMPORT_INTO_NEW_DATABASE("Import into new library", Localization.lang("Import into new library"), "ctrl+alt+I", KeyBindingCategory.FILE),
MERGE_ENTRIES("Merge entries", Localization.lang("Merge entries"), "ctrl+M", KeyBindingCategory.TOOLS),

NEW_ARTICLE("New article", Localization.lang("New article"), "ctrl+shift+A", KeyBindingCategory.BIBTEX),
NEW_BOOK("New book", Localization.lang("New book"), "ctrl+shift+B", KeyBindingCategory.BIBTEX),
NEW_ENTRY("New entry", Localization.lang("New entry"), "ctrl+N", KeyBindingCategory.BIBTEX),
NEW_ENTRY_FROM_PLAIN_TEXT("New entry from plain text", Localization.lang("New entry from plain text"), "ctrl+shift+N", KeyBindingCategory.BIBTEX),
NEW_INBOOK("New inbook", Localization.lang("New inbook"), "", KeyBindingCategory.BIBTEX),
NEW_MASTERSTHESIS("New mastersthesis", Localization.lang("New mastersthesis"), "", KeyBindingCategory.BIBTEX),
NEW_PHDTHESIS("New phdthesis", Localization.lang("New phdthesis"), "", KeyBindingCategory.BIBTEX),
NEW_PROCEEDINGS("New proceedings", Localization.lang("New proceedings"), "", KeyBindingCategory.BIBTEX),
NEW_UNPUBLISHED("New unpublished", Localization.lang("New unpublished"), "", KeyBindingCategory.BIBTEX),
NEW_INBOOK("New inbook", Localization.lang("New inbook"), "Ctrl+shift+I", KeyBindingCategory.BIBTEX),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think ctrl needs to be lowercase5, otherwise the Mac replacement with option might not work

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no idea, I just did it like the other keybindings... Could you test this please? Maybe this is an issue with other keys.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I test it now, works fine. ctrl is mapped to cmd

Siedlerchr marked this conversation as resolved.
Show resolved Hide resolved
NEW_MASTERSTHESIS("New mastersthesis", Localization.lang("New mastersthesis"), "Ctrl+shift+M", KeyBindingCategory.BIBTEX),
Siedlerchr marked this conversation as resolved.
Show resolved Hide resolved
NEW_PHDTHESIS("New phdthesis", Localization.lang("New phdthesis"), "Ctrl+shift+T", KeyBindingCategory.BIBTEX),
Siedlerchr marked this conversation as resolved.
Show resolved Hide resolved
NEW_PROCEEDINGS("New proceedings", Localization.lang("New proceedings"), "Ctrl+shift+P", KeyBindingCategory.BIBTEX),
Siedlerchr marked this conversation as resolved.
Show resolved Hide resolved
NEW_UNPUBLISHED("New unpublished", Localization.lang("New unpublished"), "Ctrl+shift+U", KeyBindingCategory.BIBTEX),
Siedlerchr marked this conversation as resolved.
Show resolved Hide resolved
NEW_TECHREPORT("New technical report", Localization.lang("New technical report"), "", KeyBindingCategory.BIBTEX),
NEW_INPROCEEDINGS("New inproceesings", Localization.lang("New inproceedings"), "", KeyBindingCategory.BIBTEX),

NEXT_PREVIEW_LAYOUT("Next preview layout", Localization.lang("Next preview layout"), "F9", KeyBindingCategory.VIEW),
NEXT_LIBRARY("Next library", Localization.lang("Next library"), "ctrl+PAGE_DOWN", KeyBindingCategory.VIEW),
OPEN_CONSOLE("Open terminal here", Localization.lang("Open terminal here"), "ctrl+shift+L", KeyBindingCategory.TOOLS),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import org.jabref.gui.preferences.PreferenceTabViewModel;
import org.jabref.gui.preferences.keybindings.presets.BashKeyBindingPreset;
import org.jabref.gui.preferences.keybindings.presets.KeyBindingPreset;
import org.jabref.gui.preferences.keybindings.presets.NewEntryBindingPreset;
import org.jabref.gui.util.OptionalObjectProperty;
import org.jabref.logic.l10n.Localization;
import org.jabref.preferences.PreferencesService;
Expand All @@ -45,6 +46,7 @@ public KeyBindingsTabViewModel(KeyBindingRepository keyBindingRepository, Dialog
this.preferences = Objects.requireNonNull(preferences);

keyBindingPresets.add(new BashKeyBindingPreset());
keyBindingPresets.add(new NewEntryBindingPreset());
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package org.jabref.gui.preferences.keybindings.presets;

import java.util.HashMap;
import java.util.Map;

import org.jabref.gui.keyboard.KeyBinding;

public class NewEntryBindingPreset implements KeyBindingPreset {

private static final Map<KeyBinding, String> KEY_BINDINGS = new HashMap<>();
calixtus marked this conversation as resolved.
Show resolved Hide resolved

static {
// Clear conflicting default presets
KEY_BINDINGS.put(KeyBinding.PULL_CHANGES_FROM_SHARED_DATABASE, "");
KEY_BINDINGS.put(KeyBinding.COPY_PREVIEW, "");

// Add new entry presets
KEY_BINDINGS.put(KeyBinding.NEW_ARTICLE, "Ctrl+shift+A");
Copy link
Member

@Siedlerchr Siedlerchr May 6, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to be consistent with the other keybindings, please lowercase the Ctrl

KEY_BINDINGS.put(KeyBinding.NEW_BOOK, "Ctrl+shift+B");
KEY_BINDINGS.put(KeyBinding.NEW_ENTRY, "Ctrl+N");
KEY_BINDINGS.put(KeyBinding.NEW_ENTRY_FROM_PLAIN_TEXT, "Ctrl+shift+N");
KEY_BINDINGS.put(KeyBinding.NEW_INBOOK, "Ctrl+shift+I");
KEY_BINDINGS.put(KeyBinding.NEW_INPROCEEDINGS, "Ctrl+shift+C");
KEY_BINDINGS.put(KeyBinding.NEW_MASTERSTHESIS, "Ctrl+shift+M");
KEY_BINDINGS.put(KeyBinding.NEW_PHDTHESIS, "Ctrl+shift+T");
KEY_BINDINGS.put(KeyBinding.NEW_PROCEEDINGS, "Ctrl+shift+P");
KEY_BINDINGS.put(KeyBinding.NEW_TECHREPORT, "Ctrl+shift+R");
KEY_BINDINGS.put(KeyBinding.NEW_UNPUBLISHED, "Ctrl+shift+U");
}

@Override
public String getName() {
return "New Entries";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find "new entries" a bit confusing, maybe something longer that better explains the purpose? Should be localized as well.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make a suggestion. We did not come up with something better yet.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New Entry types ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something like "Bindings for creating all entry types"?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remember this is just shown in the small menubutton below the the keybindings table
image

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A long text would just repeat information the user already has and would be imho extremely annoying.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I couldn't find a nice formulation that doesn't include "Bindings". But with "New entries" or "New entry types" it's really not clear what this is doing.

}

@Override
public Map<KeyBinding, String> getKeyBindings() {
return KEY_BINDINGS;
}
}
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 @@ -137,7 +137,7 @@ Clear=Clear

Clear\ fields=Clear fields

Close\ entry=Close entry
Open\ /\ close\ entry\ editor=Open / close entry editor

Close\ dialog=Close dialog

Expand Down Expand Up @@ -269,7 +269,6 @@ Each\ line\ must\ be\ of\ the\ following\ form\:\ \'tab\:field1;field2;...;field

Edit=Edit

Edit\ entry=Edit entry
Edit\ file\ type=Edit file type

Edit\ group=Edit group
Expand Down