#40709 Fix DROP confirmation dialog layout for long SQL#40714
#40709 Fix DROP confirmation dialog layout for long SQL#40714EastLord wants to merge 4 commits intodbeaver:develfrom
Conversation
ShadelessFox
left a comment
There was a problem hiding this comment.
Thanks for the contribution. The concept is good, but the implementation could've been better. :^)
96245ef to
11bf8a9
Compare
|
@ShadelessFox Thanks for the review. I’ve refactored the implementation to reuse ConfirmationDialog instead of keeping this logic in SQLEditor. Could you please take another look and let me know if there are any other issues? |
| @NotNull String id, | ||
| int type, | ||
| @Nullable String codeBlockText, | ||
| @Nullable String dialogBoundsSettingsId, |
| Shell parent, | ||
| String title, | ||
| String message, | ||
| String toggleMessage, | ||
| boolean toggleState, | ||
| String key, |
There was a problem hiding this comment.
Please infer nullability annotations
|
@ShadelessFox Thanks for the review and the suggestions. I’ve updated the implementation accordingly. Please let me know if there are any other issues. |
| if (queryTextForDisplay.length() > MAX_QUERY_PREVIEW_LENGTH) { | ||
| // Truncate string. Too big strings may freeze UI. | ||
| queryTextForDisplay = CommonUtils.truncateString(queryTextForDisplay, MAX_QUERY_PREVIEW_LENGTH) + | ||
| "... (truncated " + (queryTextForDisplay.length() - MAX_QUERY_PREVIEW_LENGTH) + " characters)"; | ||
| } |
There was a problem hiding this comment.
Use org.jkiss.utils.StringUtils#truncateText. (I don't think the number of characters truncated should be included)
There was a problem hiding this comment.
I see, can you introduce a method for it, then?
There was a problem hiding this comment.
Thanks, I’ve updated it according to your suggestion and switched to org.jkiss.utils.StringUtils#truncateText, without including the number of truncated characters.
About the old SQLQueryJob logic you pointed out: if we want to keep that style and extract it into a shared method, I’m not fully sure where the best place for that helper would be.
There was a problem hiding this comment.
Eek, let's keep the SQLQueryJob logic intact. We can't extract it to the org.jkiss.utils module as it would require proper localization, but since it must not depend on any Eclipse plugins, we won't have access to org.eclipse.osgi.util.NLS there.
There was a problem hiding this comment.
Thank you for the detailed explanation and for your patience. For the current version of the code, is there anything else that still needs to be changed?
There was a problem hiding this comment.
Please remove if (queryTextForDisplay.length() > MAX_QUERY_PREVIEW_LENGTH) check. It's already handled by StringUtils#truncateText. Don't forget to inline the variable
There was a problem hiding this comment.
Thanks, updated accordingly. I removed the explicit length check and inlined the variable, so it now directly uses StringUtils.truncateText(...).
…t` for query preview
|
@ShadelessFox Thanks for the review and the suggestions. I’ve updated the implementation accordingly. |
|
@ShadelessFox Could you please review the code ? Thank you ! |
|
Sorry, I forgot to submit my review. Fixed :^) |
…xt with `StringUtils.truncateText`.
|
We passed your PR to our QA team for testing. |

Closes: #40709
Test Steps
3.Verify the confirmation dialog appears before execution
After Fix