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

Fix delete entry keybindings bug #1815

Merged
merged 5 commits into from
Sep 21, 2016

Conversation

Braunch
Copy link
Contributor

@Braunch Braunch commented Aug 22, 2016

When using a different localization then English, setting the keybindings does not work correctly (see here #1235 ). I figured out that the problem is that the KeyEvent returns localized key texts so you can not use this to set the KeyBindings(the JabRef KeyBindings use English key texts). At the moment I only see two possibilities that do not end up in comparing tons of Strings to manually get the english localization.

First would be to change the locale to English, so that the KeyEvent returns english key texts, but I don't know what I might break with that and if the rest of the localization will still work.

Second solution would be to change the KeyBindings so that they use KeyCodes instead of Strings. This would IMHO improve the KeyBindings system but it would mean a lot of changes in all the KeyBinding related code.
See the comment below for my approach #1815 (comment).

  • Manually tested changed features in running JabRef

@Braunch Braunch added bug Confirmed bugs or reports that are very likely to be bugs stupro labels Aug 22, 2016
@@ -299,3 +299,4 @@ @siumed.edu
url = {http://dx.doi.org/10.1016/j.jneumeth.2008.01.009}
}

@Comment{jabref-meta: databaseType:bibtex;}
Copy link
Member

Choose a reason for hiding this comment

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

This is JabRef 3.x - do not change bib files created with old versions of JabRef

@koppor koppor added the status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers label Aug 24, 2016
@koppor koppor added this to the v3.6 milestone Aug 24, 2016
@Braunch Braunch added stupro-ready-for-internal-review and removed status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers labels Aug 25, 2016
@Braunch Braunch force-pushed the FixDeleteEntryKeybindingsBug branch from 17cc8aa to 86dbd96 Compare August 25, 2016 10:42
@Braunch
Copy link
Contributor Author

Braunch commented Aug 25, 2016

I now found a way to fix it. I am building a String with the English modifier key text using the triggered KeyEvents is-ModifierKey-Down methods

@koppor koppor modified the milestones: v3.7, v3.6 Aug 25, 2016
@@ -77,6 +77,7 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `#
- Fixed a number of issues related to accessing the GUI from outside the EDT
- Added a few missing translation strings
- Fixed NullPointerException when opening Customize entry type dialog without an open database
- Fixed localization error when changing key bindings while not using the english localization
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of "Fixed localization error when changing key bindings ..." I would rather write "Fixed modified keybindings not working ..."

@boceckts
Copy link
Contributor

Please resolve conflicts and minor comments, then it's good to me 👍

@Braunch
Copy link
Contributor Author

Braunch commented Aug 29, 2016

@boceckts can you test it on win and mac for me please? The meta key does not work on my linux system since there are OS functions on it.

@boceckts
Copy link
Contributor

@Braunch Windows uses the windows key for its own shortcuts, same as with some linux distributions. On mac it now does work to make shortcuts directly with the command(meta) key....but I just realized that if you create a shortcut with the control key, e.g. "ctrl + S" it will automatically be replaced by "command(meta) + S".
So I guess the meta key doesn't have to be listened to..sry for that.

@Braunch
Copy link
Contributor Author

Braunch commented Aug 31, 2016

Is this intended? Why should the grabbed keys differ from the keys actually used by the user? I changed the behavior so that you can set the 'meta + key' shortcut with the meta.

@boceckts boceckts added the status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers label Aug 31, 2016
@Braunch Braunch force-pushed the FixDeleteEntryKeybindingsBug branch 2 times, most recently from 5717b1e to 285f1ba Compare September 1, 2016 11:15
@boceckts boceckts changed the title [WIP] Fix delete entry keybindings bug Fix delete entry keybindings bug Sep 1, 2016
@Braunch
Copy link
Contributor Author

Braunch commented Sep 3, 2016

Any opinion on my solution with the meta key from the @JabRef/developers ?

@Braunch Braunch force-pushed the FixDeleteEntryKeybindingsBug branch 2 times, most recently from 5c01a6d to fc2b753 Compare September 6, 2016 10:12

/**
* respond to grabKey and display the key binding
*/
public class KeyBindingsListener extends KeyAdapter {

private final KeyBindingTable table;
private boolean isDeleteKey;
Copy link
Member

Choose a reason for hiding this comment

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

You don't need to make them class variables, do you?

Copy link
Member

@koppor koppor Sep 11, 2016

Choose a reason for hiding this comment

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

Still unanswered. 😇 - maybe these variables can now just be deleted?

Copy link
Member

Choose a reason for hiding this comment

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

BUMP

@koppor koppor removed the status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers label Sep 7, 2016
boolean isDeleteKey = kc == KeyEvent.VK_DELETE;
isFunctionKey = (kc >= KeyEvent.VK_F1) && (kc <= KeyEvent.VK_F12);
isEscapeKey = kc == KeyEvent.VK_ESCAPE;
isDeleteKey = kc == KeyEvent.VK_DELETE;
if (!(isFunctionKey || isEscapeKey || isDeleteKey)) {
return; // need a modifier except for function, escape and delete keys
Copy link
Member

Choose a reason for hiding this comment

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

Move comment form after the return to the line above

Copy link
Member

Choose a reason for hiding this comment

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

BUMP

@koppor
Copy link
Member

koppor commented Sep 11, 2016

Please merge upstream/mater and fix minor comments. Then, it should be good to go.

@Braunch
Copy link
Contributor Author

Braunch commented Sep 12, 2016

I addressed the small comments and resolved the conflicts.

@Braunch Braunch added the stupro label Sep 12, 2016
@koppor
Copy link
Member

koppor commented Sep 12, 2016

You commited with both your st university address and your normal development address. Please double check your git config.

Please merge upstream/master again. Can you make one commit as described at https://github.com/JabRef/jabref/wiki/Tools#rebase-everything-as-one-commit-on-master? Then, I can resolve the conflicts by myself.

@Braunch
Copy link
Contributor Author

Braunch commented Sep 13, 2016

I resolved the conflicts and squashed my commits. Should be good to go.

@koppor
Copy link
Member

koppor commented Sep 14, 2016

Please do not squash, this makes reviewing very hard as we cannot see, what has been adressed. I added a BUMP on all my unaswered comments. Please fix/answer.

You can see all comments at https://github.com/JabRef/jabref/pull/1815/files

@Braunch
Copy link
Contributor Author

Braunch commented Sep 15, 2016

I addressed your comments and merged the upstream/master. I squashed following your comment #1815 (comment) Did I get that wrong?

@@ -45,12 +45,13 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `#
- Selecting an entry in the search result Window will now select the correct entry in the bib file
- Entries in the SearchResultDialog are now converted to Unicode
- Suggestions in the autocomplete (search) are now in Unicode
- Fixed NullPointerException when opening search result window for an untitled database
- Fixed NullPointerException when opening search result window for an untitled database
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I encountered an unnecessary space so i deleted it

@boceckts boceckts added the status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers label Sep 19, 2016
@Siedlerchr Siedlerchr merged commit 6c50dcf into JabRef:master Sep 21, 2016
zesaro pushed a commit to zesaro/jabref that referenced this pull request Nov 22, 2016
* Fix delete entry keybindings bug

* Fix comments and unnecessary class variables
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Confirmed bugs or reports that are very likely to be bugs status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants