-
-
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
After creation of a group, the group should be focused #11449
Comments
I think i know where to add those "three lines", in src/main/java/org/jabref/gui/groups/GroupTreeViewModel.java there is a function addNewGroupToRoot() which is called when a new group is made using the "Add group button" but i cant figure out which function to call inside this function so that the newly added group should be focused. I think its maybe setSelectedGroup() function of StateManager class but i am not able to use it correctly, any help is appreciated. |
Building on Divyam's sluthing, I've made a fork and a branch on it that is able to successfully select and focus the new node. However, I wonder if this actually desirable behavior? In many use cases, I can imagine wanting to select a number of entries, create a new group, and add them to that group. In the current version, this is straightforward: select entries -> Add group -> right click on group -> Add selected entries. The new behavior, however, means that changing the group will deselect those entries. Now, if a person attempts to select before making the group, their selection will be lost and they'll have to navigate back to the previous page before they can reselect -> right-click on group -> Add selected entries. I might suggest two options, which sort of go hand-in-hand. One is a new option in the Add group dialogue's Collection options, which would be From selection and include all selected entries. The second would be that right clicking on an entry or a group of selected entries would allow the option to Add group from selection, which would launch the Add group dialogue with the From selection option pre-selected. Both would reduce the length of time it takes to generate a group in this manner, and seem fairly straight forward to implement. I'll submit a pull request with the current fix, but think it may be wise to implement these sorts of feature additions before it is merged into main. If this seems reasonable, I would be happy to go ahead and work to implement those changes. |
can i ask which function did you finally end up using to focus the added group, for my knowledge? |
Had to change things in three spots:
Trickiest part was that the state was being stored in three separate places, and I had to figure out how to keep the updates between the three of them accurate. |
Both are cool. I think, the first one is even more simpler to implement Add checkbox - and remember in the preference the state of the checkbox. |
Yes, exactly what I was thinking. Since it really only matters as an option if you currently have entries selected, instead of messing with preferences, I think it would make more sense to pass |
Expected result: Group "Test" focused:
This issue is very much about code reading and understanding how JavaFX and JabRef works. The fix itself probably will be three lines of code. The challenge is really: Which three lines and where to put these lines.
The text was updated successfully, but these errors were encountered: