Add addSpinnerButton to InputPage for bounded integer settings (#56)#57
Merged
Conversation
Render small bounded positive integer settings with an SWT Spinner instead of a free-text Text field. The spinner offers up/down steppers, enforces integer-only input, and pins a minimum, eliminating the silent parse-failure path of the Text-backed addIntegerButton. addSpinnerButton is seed-safe in the same way as addIntegerButton (seeds defaultValue into the dialog settings when the key is absent). A stored value below the minimum is clamped by the spinner and read back so the consumer and settings stay consistent with the control. addIntegerButton is retained for unbounded or free-form integer entry; subclasses choose per field. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014ydAvERPms47vaUevbsoFX
There was a problem hiding this comment.
Pull request overview
Adds a new InputPage helper to render bounded integer settings using an SWT Spinner, intended to improve UX and avoid free-text parsing failures compared to addIntegerButton.
Changes:
- Introduces
addSpinnerButton(...)to create a label +Spinner, seed dialog settings, and propagate values via aConsumer<Integer>. - Adds SWT
Spinnerimport to support the new control.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+105
to
+107
| Spinner spinner = new Spinner(result, SWT.BORDER); | ||
| spinner.setMinimum(minimum); | ||
| spinner.setSelection(this.settings.getInt(key)); |
addSpinnerButton to InputPage for bounded integer settings (#56)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #56.
Adds a sibling
addSpinnerButtonalongsideInputPage.addIntegerButton:For settings that are small bounded positive integers (e.g. a k-CFA depth), an SWT
Spinneris a better control than the free-textTextfield: it offers up/down steppers, enforces integer-only input, and pins a minimum, eliminating the free-text parse-failure path theTextlistener silently swallows.Details
addIntegerButton—seedsdefaultValueinto the dialog settings whenkeyis absent.SpinnerwithsetMinimum(minimum); theModifyListenerreadsgetSelection()directly, so there is noInteger.parseInt/NumberFormatExceptionswallow.getSelection(), so the consumer and settings stay consistent with the displayed control (handles migration of an existing setting onto a spinner).addIntegerButtonis retained for unbounded or free-form integer entry; subclasses choose per field.Consumers
🤖 Generated with Claude Code