-
-
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
Add "Do not ask again" for empty entry confirmation #8297
Conversation
/** | ||
* Get the preference of whether to give a confirmation dialog when empty entries are detected in the library | ||
* | ||
* @return true if the preference is set as yes | ||
*/ | ||
public boolean shouldConfirmEmptyEntries() { | ||
return confirmEmptyEntries.get(); | ||
} | ||
|
||
/** | ||
* Get the BooleanProperty of the preference of whether to give a confirmation dialog when empty entries are detected in the library | ||
* | ||
* @return BooleanProperty | ||
*/ | ||
public BooleanProperty confirmEmptyEntriesProperty() { | ||
return confirmEmptyEntries; | ||
} | ||
|
||
/** | ||
* Set the preference of whether to give a confirmation dialog when empty entries are detected in the library | ||
* | ||
* @param confirmEmptyEntries boolean for the preference | ||
*/ | ||
public void setConfirmEmptyEntries(boolean confirmEmptyEntries) { | ||
this.confirmEmptyEntries.set(confirmEmptyEntries); | ||
} | ||
|
||
/** | ||
* Get the preference of whether to delete the empty entries detected in the library if confirmation dialog is opted out | ||
* | ||
* @return true if the preference is set as yes (delete) | ||
*/ | ||
public boolean shouldDeleteEmptyEntries() { | ||
return deleteEmptyEntries.get(); | ||
} | ||
|
||
/** | ||
* Get the BooleanProperty of the preference of whether to delete the empty entries detected in the library if confirmation dialog is opted out | ||
* | ||
* @return BooleanProperty | ||
*/ | ||
public BooleanProperty deleteEmptyEntriesProperty() { | ||
return deleteEmptyEntries; | ||
} | ||
|
||
/** | ||
* Set the preference of whether to delete the empty entries detected in the library if confirmation dialog is opted out | ||
* | ||
* @param deleteEmptyEntries boolean for the preference | ||
*/ | ||
public void setDeleteEmptyEntries(boolean deleteEmptyEntries) { | ||
this.deleteEmptyEntries.set(deleteEmptyEntries); | ||
} |
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 javadoc is superfluous. Please comment on the the variable or the property, but not on every getter and setter
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.
Sorry about this. I removed these comments. Let me know if you would like have any other changes.
@@ -1181,11 +1191,22 @@ private Boolean confirmEmptyEntry(LibraryTab libraryTab, BibDatabaseContext cont | |||
ButtonType keepEmptyEntries = new ButtonType(Localization.lang("Keep empty entries"), ButtonBar.ButtonData.NO); | |||
ButtonType cancel = new ButtonType(Localization.lang("Return to JabRef"), ButtonBar.ButtonData.CANCEL_CLOSE); | |||
|
|||
Optional<ButtonType> response = dialogService.showCustomButtonDialogAndWait(Alert.AlertType.CONFIRMATION, | |||
Optional<ButtonType> response = dialogService.showCustomButtonDialogWithOptOutAndWait(Alert.AlertType.CONFIRMATION, |
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.
Why don't you use the showConfirmationDialogWithOptOutAndWait? The AlertType.CONFIRMATION is used there too.
This looks to me like unnecessary code duplication, or didn't I see anything?
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.
The reason I added showCustomButtonDialogWithOptOutAndWait is because I would like to include the 'Return to JabRef' option as it has now. I believe showConfirmationDialogWithOptOutAndWait only allows for Yes/No choice, but not the third option.
Would this make it into stable 5.4? |
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.
From my point of view it's good to go. Waiting for final approval from @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.
Hi, I took a look into your PR again, there is still an issue with some code duplication.
Also I tested your PR manually and it did not work as expected.
- Create file with just
@Article{, }
- Import as new library
- Close again
- Dialog shows up
- Select return to JabRef
- Close tab
- Tab wont close
- Select other tab
- Tab cannot be selected again
Please look into these issues.
@Override | ||
public Optional<ButtonType> showCustomButtonDialogWithOptOutAndWait(Alert.AlertType type, String title, String content, | ||
String optOutMessage, Consumer<Boolean> optOutAction, | ||
ButtonType... buttonTypes) { | ||
FXDialog alert = createDialogWithOptOut(AlertType.CONFIRMATION, title, content, optOutMessage, optOutAction); | ||
alert.getButtonTypes().setAll(buttonTypes); | ||
return alert.showAndWait(); | ||
} | ||
|
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 still seems to be some code duplication with showConfirmationDialogWithOptOutAndWait
, which is basically now a subset of this method here. Should call this instead.
Also the method argument type
in the method signature, but is not used in the method.
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.
The tab gets blocked. Please investigate
Closing this pull request due to inactivity 💤 |
Another issue with the current implementation: #8645 |
Fixes #8296, a follow-up from #8096 (comment)
CHANGELOG.md
described in a way that is understandable for the average user (if applicable)