-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Corrected shortcut #6960
Corrected shortcut #6960
Conversation
I would remove all the standard keybindings for https://github.com/JabRef/jabref/pull/6960/files#diff-920a3cf78140f82ffcd3ba5b495cf73fL49-L54. Then you can leave the pull changes keybinding at "ctrl + shift + r". What do you think? |
I'm against removing the shortcuts, at least article should be kept. Let's say what the other @JabRef/developers say about this |
Yes, article, book, new entry and new entry from plaintext should be kept. But masterthesis, phdthesis etc are not that important to have a default keybinding. (I don't suggest to completely remove these bindings, just their default value so that users can still activate them if they want). |
@tobiasdiez , correct? |
I wouldn't remove them at all, but their default value. |
Yes, just provide an empty string as the third argument of these enum values, and include NEW_TECHREPORT as well. |
Empty string doesn't works. )) When I try to open the menu, it shows an error. java.lang.StringIndexOutOfBoundsException: begin 0, end 1, length 0 |
@Gena928 You pasated a PNG instead of using a link into the code (offered by the GitHub UI) (or maybe additoinally) The affected keys are at Can't we just add @Gena928 While you are on it, could you please add a shortcot for |
@koppor |
@Gena928 You should be able to fix this error by adding a few additional if-statements if the keybinding string is empty. |
@tobiasdiez , @koppor Please review changes.
|
Could you please resolve the conflicts. Please merge
LGTM.
It was on purpose to add an additional modifier and not to change the modifier. I was thinking that an additoinal moddifier is easer to remember instead of another modifier. However, having our discussion in mind, we should just leave these shortcuts empty. A user seldomly will use these shortcuts.
That's good. Please revert your change to change the modifier to
Looks good.
I don't quite get what you are referring to with "this menu item". In the normal entry creation menu, it is already there: https://docs.jabref.org/collect/add-entry-manually I think, your current code enough. I think, it should also be added to |
Corrected TypeEditorViewModel & KeyBinding
@koppor Please review |
src/main/java/org/jabref/gui/fieldeditors/TypeEditorViewModel.java
Outdated
Show resolved
Hide resolved
@@ -113,8 +113,10 @@ public int size() { | |||
|
|||
public Optional<KeyBinding> mapToKeyBinding(KeyEvent keyEvent) { | |||
for (KeyBinding binding : KeyBinding.values()) { | |||
if (checkKeyCombinationEquality(binding, keyEvent)) { | |||
return Optional.of(binding); | |||
if (!binding.getDefaultKeyBinding().isEmpty()){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure this works? I would gess getDefaultKeyBinding
is always empty for NEW_INBOOK
even though the user has overwritten it. On first glance, I would suggest to change the getKeyCombination
method below to public Optional<KeyCombination> getKeyCombination(KeyBinding bindName)
and return an empty optional if binding
is empty.
Moreover, get
should probably return en empty string instead of "Not associated"
to be consistent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It works. If I change the next statement
from public KeyCombination getKeyCombination(KeyBinding bindName)
to Optional<KeyCombination> getKeyCombination(KeyBinding bindName)
I have to change other parts of code. For example line 141
from KeyCombination keyCombination = getKeyCombination(binding);
to KeyCombination keyCombination = getKeyCombination(binding).get()
;
Is this what you mean?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, can you briefly explain why it works? I thought "getDefaultKeyBinding" then always returns an empty string, so this check is always false.
Yeah, there are more code changes required for my suggestion. I think it would provide a clean solution to handle the case that for a given keybinding there is not necessarily a keycombination. But I didn't had the time yet to check the code in detail. So if your solution indeed works, then it's fine with me as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In case this is done, the code fragment is getKeyCombination(binding).ifpresent(combination -> ...)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Gena928 Exactly! So if you change the keybinding for "New inbook" to something, then getDefaultKeybinding
should still return an empty string, so the code never goes into the if body in this case (although it should to match the new-user defined key).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tobiasdiez
I agree. If you change default shortcut, this code will not work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll try to fix today.
@Gena928 Please try to merge upstream/master to resolve the merge conflicts. |
# Conflicts: # src/main/resources/l10n/JabRef_en.properties
@koppor , @tobiasdiez , Also please give your comments for TypeEditorViewModel class - this comment from @tobiasdiez |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good work so far, keep on coding and learning.
Got three little remarks.
src/main/java/org/jabref/gui/keyboard/KeyBindingRepository.java
Outdated
Show resolved
Hide resolved
@calixtus , |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still three issues. ;-)
src/main/java/org/jabref/gui/keyboard/KeyBindingRepository.java
Outdated
Show resolved
Hide resolved
@calixtus |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM to me now. Thanks for your efforts!
Also OK for me. Still have to update CHANGELOG.md, because keyboard shortcuts were removed in this PR. |
Fixes #6867
A new shortcut combination added for "Pull changes from shared database", because current ctrl+shift+R is already assigned for "Create tech report" command.