-
-
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
[WIP] Toggle group intersection/union solved #3739
Conversation
@@ -750,6 +750,13 @@ public void update() { | |||
actions.put(Actions.REMOVE_FROM_GROUP, new GroupAddRemoveDialog(this, false, false)); | |||
actions.put(Actions.MOVE_TO_GROUP, new GroupAddRemoveDialog(this, true, true)); | |||
|
|||
actions.put(Actions.INTERSECTION_PREF_GROUP, (BaseAction) () -> { | |||
System.out.println("blubb"); |
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.
remove
actions.put(Actions.INTERSECTION_PREF_GROUP, (BaseAction) () -> { | ||
System.out.println("blubb"); | ||
boolean state = Globals.prefs.getBoolean(JabRefPreferences.GROUP_INTERSECT_SELECTIONS); | ||
state = !state; |
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.
This code is hard to understand and not clear on the first sight.
Better create two variables: e.g. union and intersection and then store the corresponding value
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.
Ideally you would have an enum with two states, e.g. GroupState... but in this case this might be an overkill.
@@ -115,6 +115,7 @@ public void setValues() { | |||
keywordSeparator.setText(prefs.get(JabRefPreferences.KEYWORD_SEPARATOR)); | |||
autoAssignGroup.setSelected(prefs.getBoolean(JabRefPreferences.AUTO_ASSIGN_GROUP)); | |||
multiSelectionModeIntersection.setSelected(prefs.getBoolean(JabRefPreferences.GROUP_INTERSECT_SELECTIONS)); | |||
multiSelectionModeUnion.setSelected(!prefs.getBoolean(JabRefPreferences.GROUP_INTERSECT_SELECTIONS)); |
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.
this is really not a good idea. If you quickly go over the code you most certainly will oerlook the not sign.
The goal is to have clear code which is ideally understanding at first sight.
https://8thlight.com/blog/dariusz-pasciak/2015/05/28/alternatives-to-boolean-parameters.html
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.
See my comments about the handling of the boolean paramters.
Added an new boolean variable to make the code more readable.
Added @author javadoc comment. Set the groups union preference radiobutton, because if the group state was on union, the radiobutton was not activated. Used an own boolean variable for the state of the union preference.
@@ -750,6 +750,15 @@ public void update() { | |||
actions.put(Actions.REMOVE_FROM_GROUP, new GroupAddRemoveDialog(this, false, false)); | |||
actions.put(Actions.MOVE_TO_GROUP, new GroupAddRemoveDialog(this, true, true)); | |||
|
|||
/** |
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.
Remove your author comments.
We keep our authors in a separate file: https://github.com/JabRef/jabref/blob/master/AUTHORS
@Siedlerchr please decide whether you take over or just close the PR. |
Added new menu entry with the needed action.
The action gets and sets the group intersection/union preferences.
Fixes #3269
PE1_Blatt_5
Aufgabe 7G
Matrikelnummer: 3325847
Name: Tobias Stöver