Skip to content

Commit

Permalink
Revised hotkey system
Browse files Browse the repository at this point in the history
  • Loading branch information
mairdl committed Jun 29, 2016
1 parent 12ae6e3 commit 3b2d110
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 19 deletions.
3 changes: 2 additions & 1 deletion src/main/java/net/sf/jabref/gui/JabRefFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -1864,7 +1864,8 @@ public EditAction(String command, String menuTitle, String description, KeyStrok
putValue(Action.SHORT_DESCRIPTION, description);
}

@Override public void actionPerformed(ActionEvent e) {
@Override
public void actionPerformed(ActionEvent e) {

LOGGER.debug(Globals.focusListener.getFocused().toString());
JComponent source = Globals.focusListener.getFocused();
Expand Down
5 changes: 0 additions & 5 deletions src/main/java/net/sf/jabref/gui/PreviewPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -185,10 +185,6 @@ private void createKeyBindings(){
final String copy = "copy";
inputMap.put(Globals.getKeyPrefs().getKey(KeyBinding.COPY_PREVIEW), copy);
actionMap.put(copy, this.copyPreviewAction);

final String print = "print";
inputMap.put(Globals.getKeyPrefs().getKey(KeyBinding.PRINT_ENTRY_PREVIEW), print);
actionMap.put(print, this.printAction);
}

private JPopupMenu createPopupMenu() {
Expand Down Expand Up @@ -328,7 +324,6 @@ public PrintAction() {
super(Localization.lang("Print entry preview"), IconTheme.JabRefIcon.PRINTED.getIcon());

putValue(Action.SHORT_DESCRIPTION, Localization.lang("Print entry preview"));
putValue(Action.ACCELERATOR_KEY, Globals.getKeyPrefs().getKey(KeyBinding.PRINT_ENTRY_PREVIEW));
}


Expand Down
25 changes: 13 additions & 12 deletions src/main/java/net/sf/jabref/gui/keyboard/KeyBinding.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ public enum KeyBinding {
"Abbreviate", Localization.lang("Abbreviate journal names"), "ctrl alt A"),
AUTOGENERATE_BIBTEX_KEYS("Autogenerate BibTeX keys", Localization.lang("Autogenerate BibTeX keys"), "ctrl G"),
AUTOMATICALLY_LINK_FILES(
"Automatically link files", Localization.lang("Automatically set file links"), "alt F"),
"Automatically link files", Localization.lang("Automatically set file links"), "F7"),
BACK("Back", Localization.lang("Back"), "alt LEFT"),
CLEANUP(
"Cleanup", Localization.lang("Cleanup entries"), "ctrl shift F7"),
"Cleanup", Localization.lang("Cleanup entries"), "F8"),
CLEAR_SEARCH("Clear search", Localization.lang("Clear search"), "ESCAPE"),
CLOSE_DATABASE("Close database", Localization.lang("Close database"), "ctrl W"),
CLOSE_DIALOG("Close dialog", Localization.lang("Close dialog"), "ESCAPE"),
Expand All @@ -25,7 +25,7 @@ public enum KeyBinding {
DECREASE_TABLE_FONT_SIZE("Decrease table font size", Localization.lang("Decrease table font size"), "ctrl MINUS"),
DELETE_ENTRY("Delete entry", Localization.lang("Delete entry"), "DELETE"),
EDIT_ENTRY("Edit entry", Localization.lang("Edit entry"), "ctrl E"),
EDIT_PREAMBLE("Edit preamble", Localization.lang("Edit preamble"), "ctrl P"),
EDIT_PREAMBLE("Edit preamble", Localization.lang("Edit preamble"), "alt S"),
EDIT_STRINGS("Edit strings", Localization.lang("Edit strings"), "ctrl T"),
ENTRY_EDITOR_NEXT_ENTRY("Entry editor, next entry", Localization.lang("Entry editor, next entry"), "ctrl shift DOWN"),
ENTRY_EDITOR_NEXT_PANEL("Entry editor, next panel", Localization.lang("Entry editor, next panel"), "ctrl TAB"),
Expand All @@ -37,10 +37,10 @@ public enum KeyBinding {
FILE_LIST_EDITOR_MOVE_ENTRY_DOWN("File list editor, move entry down", Localization.lang("File list editor, move entry down"), "ctrl DOWN"),
FILE_LIST_EDITOR_MOVE_ENTRY_UP("File list editor, move entry up", Localization.lang("File list editor, move entry up"), "ctrl UP"),
FIND_UNLINKED_FILES("Find unlinked files", Localization.lang("Find unlinked files"), "shift F7"),
FOCUS_ENTRY_TABLE("Focus entry table", Localization.lang("Focus entry table"), "ctrl shift E"),
FOCUS_ENTRY_TABLE("Focus entry table", Localization.lang("Focus entry table"), "alt 1"),
FORWARD("Forward", Localization.lang("Forward"), "alt RIGHT"),
HELP("Help", Localization.lang("Help"), "F1"),
HIDE_SHOW_TOOLBAR("Hide/show toolbar", Localization.lang("Hide/show toolbar"), "ctrl alt T"),
HIDE_SHOW_TOOLBAR("Hide/show toolbar", Localization.lang("Hide/show toolbar"), "alt 6"),
IMPORT_INTO_CURRENT_DATABASE("Import into current database", Localization.lang("Import into current database"), "ctrl I"),
IMPORT_INTO_NEW_DATABASE("Import into new database", Localization.lang("Import into new database"), "ctrl alt I"),
INCREASE_TABLE_FONT_SIZE("Increase table font size", Localization.lang("Increase table font size"), "ctrl PLUS"),
Expand All @@ -54,16 +54,16 @@ public enum KeyBinding {
NEW_PHDTHESIS("New phdthesis", Localization.lang("New phdthesis"), "ctrl shift T"),
NEW_PROCEEDINGS("New proceedings", Localization.lang("New proceedings"), "ctrl shift P"),
NEW_UNPUBLISHED("New unpublished", Localization.lang("New unpublished"), "ctrl shift U"),
NEW_TECHREPORT("New technical report", Localization.lang("New technical report"), "ctrl shift R"),
NEXT_TAB("Next tab", Localization.lang("Next tab"), "ctrl PAGE_DOWN"),
OPEN_CONSOLE("Open terminal here", Localization.lang("Open terminal here"), "ctrl shift J"),
OPEN_CONSOLE("Open terminal here", Localization.lang("Open terminal here"), "ctrl shift L"),
OPEN_DATABASE("Open database", Localization.lang("Open database"), "ctrl O"),
OPEN_FILE("Open file", Localization.lang("Open file"), "F4"),
OPEN_FOLDER("Open folder", Localization.lang("Open folder"), "ctrl shift O"),
OPEN_URL_OR_DOI("Open URL or DOI", Localization.lang("Open URL or DOI"), "F3"),
PASTE("Paste", Localization.lang("Paste"), "ctrl V"),
PREAMBLE_EDITOR_STORE_CHANGES("Preamble editor, store changes", Localization.lang("Preamble editor, store changes"), "alt S"),
PREVIOUS_TAB("Previous tab", Localization.lang("Previous tab"), "ctrl PAGE_UP"),
PRINT_ENTRY_PREVIEW("Print entry preview", Localization.lang("Print entry preview"), "alt P"),
PUSH_TO_APPLICATION("Push to application", Localization.lang("Push to application"), "ctrl L"),
QUIT_JABREF("Quit JabRef", Localization.lang("Quit JabRef"), "ctrl Q"),
REDO("Redo", Localization.lang("Redo"), "ctrl Y"),
Expand All @@ -80,14 +80,15 @@ public enum KeyBinding {
STRING_DIALOG_ADD_STRING("String dialog, add string", Localization.lang("String dialog, add string"), "ctrl N"),
STRING_DIALOG_REMOVE_STRING("String dialog, remove string", Localization.lang("String dialog, remove string"), "shift DELETE"),
SWITCH_PREVIEW_LAYOUT("Switch preview layout", Localization.lang("Switch preview layout"), "F9"),
SYNCHRONIZE_FILES("Synchronize files", Localization.lang("Synchronize files"), "ctrl F4"),
TOGGLE_ENTRY_PREVIEW("Toggle entry preview", Localization.lang("Toggle entry preview"), "ctrl F9"),
TOGGLE_GROUPS_INTERFACE("Toggle groups interface", Localization.lang("Toggle groups interface"), "ctrl shift G"),
SYNCHRONIZE_FILES("Synchronize files", Localization.lang("Synchronize files"), "ctrl shift F7"),
TOGGLE_ENTRY_PREVIEW("Toggle entry preview", Localization.lang("Toggle entry preview"), "alt 2"),
TOGGLE_GROUPS_INTERFACE("Toggle groups interface", Localization.lang("Toggle groups interface"), "alt 3"),
UNABBREVIATE("Unabbreviate", Localization.lang("Unabbreviate"), "ctrl alt shift A"),
UNDO("Undo", Localization.lang("Undo"), "ctrl Z"),
UNMARK_ENTRIES("Unmark entries", Localization.lang("Unmark entries"), "ctrl shift M"),
WEB_SEARCH("Web search", Localization.lang("Web search"), "F5"),
WRITE_XMP("Write XMP", Localization.lang("Write XMP"), "ctrl F7"),;
WEB_SEARCH("Web search", Localization.lang("Web search"), "alt + 5"),
WRITE_XMP("Write XMP", Localization.lang("Write XMP"), "F6"),
OPEN_OFFICE_LIBRE_CONNECTION("Open office/libre connection", Localization.lang("Open office/libre connection"), "alt 4"),;

private final String key;
private final String localization;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public KeyBindingsDialog(KeyBindingRepository keyBindingRepository) {
updateTableData();
//JScrollPane listScroller = new JScrollPane(list);
JScrollPane listScroller = new JScrollPane(table);
listScroller.setPreferredSize(new Dimension(250, 400));
listScroller.setPreferredSize(new Dimension(500, 500));
getContentPane().add(listScroller, BorderLayout.CENTER);

grabB.addKeyListener(new KeyBindingsListener(table));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public ChangeEntryTypeMenu () {
entryShortCuts.put(BibtexEntryTypes.INBOOK.getName(), Globals.getKeyPrefs().getKey(KeyBinding.NEW_INBOOK));
entryShortCuts.put(BibtexEntryTypes.PROCEEDINGS.getName(), Globals.getKeyPrefs().getKey(KeyBinding.NEW_PROCEEDINGS));
entryShortCuts.put(BibtexEntryTypes.UNPUBLISHED.getName(), Globals.getKeyPrefs().getKey(KeyBinding.NEW_UNPUBLISHED));
entryShortCuts.put(BibtexEntryTypes.TECHREPORT.getName(), Globals.getKeyPrefs().getKey(KeyBinding.NEW_TECHREPORT));
}

public JMenu getChangeEntryTypeMenu(BasePanel panel) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ public JMenuItem getMenuItem() {
JMenuItem item = new JMenuItem(Localization.lang("OpenOffice/LibreOffice connection"),
IconTheme.getImage("openoffice"));
item.addActionListener(event -> manager.show(getName()));
item.setAccelerator(Globals.getKeyPrefs().getKey(KeyBinding.OPEN_OFFICE_LIBRE_CONNECTION));
return item;
}

Expand Down

0 comments on commit 3b2d110

Please sign in to comment.