-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Fix button placement at commit dialog #16739
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
Changes from all commits
1a008a8
d1d491a
6f98b57
ae877a6
04fa1f1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,7 +3,9 @@ | |
| import java.util.List; | ||
|
|
||
| import javafx.application.Platform; | ||
| import javafx.event.ActionEvent; | ||
| import javafx.fxml.FXML; | ||
| import javafx.scene.control.Button; | ||
| import javafx.scene.control.ButtonType; | ||
| import javafx.scene.control.TextArea; | ||
|
|
||
|
|
@@ -29,6 +31,7 @@ public class GitCommitDialogView extends BaseDialog<Void> { | |
|
|
||
| @FXML private TextArea commitMessage; | ||
| @FXML private ButtonType commitButton; | ||
| @FXML private ButtonType showDiffButton; | ||
|
|
||
| private GitCommitDialogViewModel viewModel; | ||
|
|
||
|
|
@@ -45,6 +48,11 @@ public GitCommitDialogView() { | |
| ViewLoader.view(this) | ||
| .load() | ||
| .setAsDialogPane(this); | ||
| Button showDiff = (Button) this.getDialogPane().lookupButton(showDiffButton); | ||
| showDiff.addEventFilter(ActionEvent.ACTION, event -> { | ||
| event.consume(); | ||
| showDiff(); | ||
|
Comment on lines
+51
to
+54
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 1. showdiff duplicates action helper The new event-filter wiring duplicates the existing ControlHelper.setAction utility, which already looks up a dialog button, invokes its action, and consumes the event. This creates avoidable duplicate GUI logic instead of reusing the repository convention. Agent Prompt
|
||
| }); | ||
|
Comment on lines
+51
to
+55
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ControlHelper.setAction?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good point — switching to ControlHelper.setAction and dropping the manual lookup. I'm away from my dev machine for a couple of days; will push the change as soon as I'm back.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure what " a couple of days" means. If it is more than a week, we should free this issue for another contributor; as you and we as team will loose context meanwhile.
Comment on lines
+51
to
+55
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why add this piece since the purpose is only to move the button position
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The wiring is a necessary because of the move : "Show diff" was previously a plain in the FXML content with onAction="#showDiff". Placing it in the same row as Commit and Cancel requires declaring it as a in — the button bar only renders ButtonTypes, and those can't declare onAction in FXML, so the handler has to be attached in code. The event filter and consume() preserve the previous behavior of keeping the dialog open. That said, @calixtus's suggestion is the cleaner way to do exactly this — switching to ControlHelper.setAction.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please don't use an LLM to communicate. This is rude and not allowed in this repo. If I just wanted to talk to an LLM I would ignore you in the middle. Use your own words and your own brain. own your code.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also fully ai generated text have to be marked with a 🤖
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @pluto-han JavaFX is not using Button in button bars, but merely ButtonType. A controversial design decision about trying to unify an API for a ui representation of dialogs buttons order across all major desktops. See https://docs.oracle.com/en/java/java-components/javafx/26/docs/javafx.controls/javafx/scene/control/ButtonBar.html
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @calixtus Sorry, I drafted those replies with an AI. I wasn't trying to be rude — this is my first contribution and I'm still learning both JavaFX and the norms around here. That's on me, it won't happen again. My comments from here on are my own words, and I'll mark with 🤖 if any AI-generated content appears, as you said. I did set up the build locally, reproduce the dialog, make the changes and test them in the running app. My English is still improving, so I used AI for wording — but I understand that's no excuse here, and I'll write plainly myself. Thanks for the patience with a first-timer. |
||
| } | ||
|
|
||
| @FXML | ||
|
|
@@ -82,7 +90,6 @@ private void initialize() { | |
| } | ||
|
|
||
| // [impl->req~ux.git-commit.preview-current-library~1] | ||
| @FXML | ||
| private void showDiff() { | ||
| viewModel.diffTask() | ||
| .onSuccess(this::openDiffDialog) | ||
|
|
||
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.
No need to add a CHANGELOG.md entry, the feature was introduced during this release.