Skip to content

Refactor combo box with browse#384

Merged
cj-radcliff merged 41 commits into
mainfrom
refactor-combo-box-with-browse
May 6, 2026
Merged

Refactor combo box with browse#384
cj-radcliff merged 41 commits into
mainfrom
refactor-combo-box-with-browse

Conversation

@cj-radcliff
Copy link
Copy Markdown
Collaborator

This PR replaces a deprecated ComboBoxWithBrowse button and eliminates a verification error. It was vibe coded with Gemini.

This change removes the deprecated ComboBoxWithBrowse button from the dart plugin. It exchanges it with a standard ComboBox. The functionality has been tested and is confirmed to be identical.

New Component: DartComboBoxWithBrowseButton.java is included in the branch.
EDT Safety: All three major UI areas (Remote Debug Configuration, SDK Settings, and Project Generator) are now using asynchronous, non-blocking ReadActions
for file system operations.
Build: The project compiles successfully with ./gradlew compileJava.
Scope: The changes are strictly limited to the UI refactoring and necessary threading fixes.
Summary of Changes

Core Component: Implemented DartComboBoxWithBrowseButton as a reusable, async-safe UI component.
Remote Debug Editor: Moved project indexing and searching to background threads.
SDK Settings: Refactored SDK validation and version loading to be non-blocking.
Project Generator: Implemented async SDK validation with result caching to satisfy the wizard's synchronous validation requirements without blocking the EDT.
The places to test:

Launch the IDE
Run the following command from the third_party directory:
1 ./gradlew runIde
(Note: Based on the build.gradle.kts, you can also specify a target version, e.g., ./gradlew runIde -Pide=IntelliJ -PideV=2024.2)

Verify the Changes
Once the IDE is running, you can find the modified UI components in these locations:
Dart Remote Debug Configuration (Smart Suggestions)

Open a Dart project or create a new one.
Go to Run -> Edit Configurations...
Click the + button and select Dart Remote Debug.
Look at the Dart project field.
Verification: In the combo-box-reset branch, this should be a ComboBox with a browse icon (folder icon) on the right. It should automatically suggest paths to any folders containing a pubspec.yaml file in your current workspace.
Dart SDK Settings (Centralized Setup)

Go to File -> Settings (or IntelliJ IDEA -> Settings on macOS).
Navigate to Languages & Frameworks -> Dart.
Look at the Dart SDK path field.
Verification: This field should now use the new ExtendableTextField implementation. When you click the browse button or change the path, the version label below it should update automatically using the centralized logic in DartSdkUtil.
New Project Wizard

Go to File -> New -> Project...
Select Dart from the left sidebar.
Check the Dart SDK path field here as well.

cj-radcliff and others added 30 commits April 30, 2026 09:46
* Try 2026.1.1 (not verified)

* Add java version resolver

* Use newer version

* Upgrade again

* Use v1

* Update baselines

* Fix tests by adding caret

* Update kotlin

* Remove old comment
Bumps [gradle-wrapper](https://github.com/gradle/gradle) from 9.4.1 to 9.5.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/gradle/gradle/releases">gradle-wrapper's releases</a>.</em></p>
<blockquote>
<h2>9.5.0</h2>
<p>The Gradle team is excited to announce Gradle 9.5.0.</p>
<p>Here are the highlights of this release:</p>
<ul>
<li>Task provenance in reports and failure messages</li>
<li>Type-safe accessors for precompiled Kotlin Settings plugins</li>
</ul>
<p><a href="https://docs.gradle.org/9.5.0/release-notes.html">Read the Release Notes</a></p>
<p>We would like to thank the following community members for their contributions to this release of Gradle:
<a href="https://github.com/atm1020">atm1020</a>,
<a href="https://github.com/mataha">mataha</a>,
<a href="https://github.com/aSemy">Adam</a>,
<a href="https://github.com/kelemen">Attila Kelemen</a>,
<a href="https://github.com/britter">Benedikt Ritter</a>,
<a href="https://github.com/Vampire">Björn Kautler</a>,
<a href="https://github.com/budindepunk">Caro Silva Rode</a>,
<a href="https://github.com/chanani">CHANHAN</a>,
<a href="https://github.com/DmitryNez">Dmitry Nezavitin</a>,
<a href="https://github.com/Juneezee">Eng Zer Jun</a>,
<a href="https://github.com/KugelLibelle">KugelLibelle</a>,
<a href="https://github.com/vmadalin">Madalin Valceleanu</a>,
<a href="https://github.com/quijote">Markus Gaisbauer</a>,
<a href="https://github.com/koppor">Oliver Kopp</a>,
<a href="https://github.com/hfhbd">Philip Wedemann</a>,
<a href="https://github.com/ploober">ploober</a>,
<a href="https://github.com/rpalcolea">Roberto Perez Alcolea</a>,
<a href="https://github.com/R0h1tAnand">Rohit Anand</a>,
<a href="https://github.com/Suvrat1629">Suvrat Acharya</a>,
<a href="https://github.com/usv240">Ujwal Suresh Vanjare</a>,
<a href="https://github.com/urdak">Victor Merkulov</a></p>
<h2>Upgrade instructions</h2>
<p>Switch your build to use Gradle 9.5.0 by updating your wrapper:</p>
<pre><code>./gradlew wrapper --gradle-version=9.5.0 &amp;&amp; ./gradlew wrapper
</code></pre>
<p>See the Gradle <a href="https://docs.gradle.org/9.5.0/userguide/upgrading_version_9.html">9.x upgrade guide</a> to learn about deprecations, breaking changes and other considerations when upgrading.</p>
<p>For Java, Groovy, Kotlin and Android compatibility, see the <a href="https://docs.gradle.org/9.5.0/userguide/compatibility.html">full compatibility notes</a>.</p>
<h2>Reporting problems</h2>
<p>If you find a problem with this release, please file a bug on <a href="https://github.com/gradle/gradle/issues">GitHub Issues</a> adhering to our issue guidelines.
If you're not sure you're encountering a bug, please use the <a href="https://discuss.gradle.org/c/help-discuss">forum</a>.</p>
<p>We hope you will build happiness with Gradle, and we look forward to your feedback via <a href="https://twitter.com/gradle">Twitter</a> or on <a href="https://github.com/gradle">GitHub</a>.</p>
<h2>9.5.0 RC4</h2>
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/gradle/gradle/commit/3fe117d68f3907790f3809f121aa36303a9151f8"><code>3fe117d</code></a> Update jdks.yaml (<a href="https://redirect.github.com/gradle/gradle/issues/37703">#37703</a>)</li>
<li><a href="https://github.com/gradle/gradle/commit/33d145af6fbe7cf7c9d84646b6d7f32fea91d5e2"><code>33d145a</code></a> Update jdks.yaml</li>
<li><a href="https://github.com/gradle/gradle/commit/f7a05d1ed48442eb5da4d6e2b6593da55cdec1da"><code>f7a05d1</code></a> Update Gradle wrapper to version 9.5.0-rc-4 (<a href="https://redirect.github.com/gradle/gradle/issues/37654">#37654</a>)</li>
<li><a href="https://github.com/gradle/gradle/commit/266facdcbcb0b4c60120cc118eaf0f652bfcdfe5"><code>266facd</code></a> Update Gradle wrapper to version 9.5.0-rc-4</li>
<li><a href="https://github.com/gradle/gradle/commit/0ad6dd8e143455707e444aa7e3d38327a3366513"><code>0ad6dd8</code></a> Suppress OSC taskbar reset on plain/piped stdout (<a href="https://redirect.github.com/gradle/gradle/issues/37646">#37646</a>)</li>
<li><a href="https://github.com/gradle/gradle/commit/966025d5850d46c9158a2f25e4096222277ecf57"><code>966025d</code></a> Suppress OSC taskbar reset on plain/piped stdout</li>
<li><a href="https://github.com/gradle/gradle/commit/e7455734449e422accebf44cf7b31bf93e3a770c"><code>e745573</code></a> Polish IP docs (<a href="https://redirect.github.com/gradle/gradle/issues/37642">#37642</a>)</li>
<li><a href="https://github.com/gradle/gradle/commit/d5cfd079acd2c8f1182edd6ec23dbab571132d0a"><code>d5cfd07</code></a> Ensure BuildOperationQueue will progress without extra leases (<a href="https://redirect.github.com/gradle/gradle/issues/37629">#37629</a>)</li>
<li><a href="https://github.com/gradle/gradle/commit/acdf0c36fa13ba09a7ff5b51f79b9af4b1a097ee"><code>acdf0c3</code></a> Ensure BuildOperationQueue will progress without extra leases</li>
<li><a href="https://github.com/gradle/gradle/commit/f7d0e4f6f7896426a8b24091388e4c252b62faef"><code>f7d0e4f</code></a> Rename anchor</li>
<li>Additional commits viewable in <a href="https://github.com/gradle/gradle/compare/v9.4.1...v9.5.0">compare view</a></li>
</ul>
</details>
<br />

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=gradle-wrapper&package-manager=gradle&previous-version=9.4.1&new-version=9.5.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

</details>
Fixes: #369 

---

<details>
  <summary>Contribution guidelines:</summary><br>

- See our [contributor guide]([https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md](https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md) for general expectations for PRs.
- Larger or significant changes should be discussed in an issue before creating a PR.
- Dart contributions to our repos should follow the [Dart style guide](https://dart.dev/guides/language/effective-dart) and use `dart format`.
- Java and Kotlin contributions should strive to follow Java and Kotlin best practices ([discussion](flutter/flutter-intellij#8098)).
</details>
Adding windows version of update_baselines.bat
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request replaces the deprecated ComboboxWithBrowseButton with a custom BasicComboBoxWithBrowseButton across several UI components and refactors heavy operations, such as SDK validation and project searching, to run asynchronously using non-blocking ReadAction. These changes improve UI responsiveness and resource management by properly registering disposables for listeners. However, a regression was identified in the DartGeneratorPeer where the removal of a state listener prevents the wizard from updating the enabled state of navigation buttons; manual re-validation is recommended to ensure the wizard UI behaves correctly.

myCreateSampleProjectCheckBox.addActionListener(e -> stateListener.stateChanged(validate() == null));

myTemplatesList.addListSelectionListener(e -> stateListener.stateChanged(validate() == null));
public void dispose() {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

By removing the addSettingsStateListener method, the project wizard no longer receives updates when the validation state changes (e.g., after the asynchronous SDK path validation completes). This can lead to the 'Next'/'Finish' button having an incorrect enabled state.

To fix this, you need to trigger validation manually. The SettingsStep passed to buildUI provides a checkValid() method for this purpose.

  1. Store the SettingsStep in a field:

    private @Nullable SettingsStep mySettingsStep;
    
    @Override
    public void buildUI(final @NotNull SettingsStep settingsStep) {
      mySettingsStep = settingsStep;
      // ... existing code
    }
  2. Trigger re-validation in onSdkPathChanged after the async validation completes:

    // inside .finishOnUiThread() in onSdkPathChanged()
    mySdkPathValidationError = errorMessage;
    if (mySettingsStep != null) {
        mySettingsStep.checkValid();
    }
    // ... existing code

This will ensure the wizard UI updates correctly.

References
  1. This is a logical bug in the UI. According to the style guide, logical bugs are considered [MUST-FIX].

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pq fyi, we decided to remove the checkValid stuff. Happy to chase this down if you think Gemini is right here.

Copy link
Copy Markdown
Collaborator

@pq pq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@cj-radcliff cj-radcliff merged commit 622ceea into main May 6, 2026
8 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants