Skip to content

Refactor combo box with browse#372

Merged
cj-radcliff merged 17 commits into
flutter:refactor-combo-box-with-browsefrom
cj-radcliff:refactor-combo-box-with-browse
May 5, 2026
Merged

Refactor combo box with browse#372
cj-radcliff merged 17 commits into
flutter:refactor-combo-box-with-browsefrom
cj-radcliff:refactor-combo-box-with-browse

Conversation

@cj-radcliff
Copy link
Copy Markdown
Collaborator

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.

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 introduces a custom DartComboBoxWithBrowseButton component and refactors several Dart configuration editors to perform SDK and project path resolution asynchronously using non-blocking read actions. While these changes improve UI responsiveness, several critical threading violations were identified in DartGeneratorPeer where UI components are accessed or updated from background threads. There are also concerns regarding potential memory leaks due to DocumentListener registrations that lack proper disposal, and a minor simplification was suggested for project path handling.

Comment thread third_party/src/main/java/com/jetbrains/lang/dart/sdk/DartSdkUtil.java Outdated
@cj-radcliff
Copy link
Copy Markdown
Collaborator Author

/gemini

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.

This is awesome!

Consider also re-running the baselines so we can see the fruits of your cleanup?

./third_party/tool/update_baselines.sh

Comment thread third_party/src/main/java/com/jetbrains/lang/dart/sdk/DartConfigurable.java Outdated
Comment thread third_party/build.gradle.kts Outdated
Comment thread third_party/gradlew.bat
Comment thread third_party/src/main/java/com/jetbrains/lang/dart/sdk/DartSdkUtil.java Outdated
@cj-radcliff
Copy link
Copy Markdown
Collaborator Author

This is awesome!

Consider also re-running the baselines so we can see the fruits of your cleanup?

./third_party/tool/update_baselines.sh

Does the build not update baselines? I didn't know this was a manual process

@pq
Copy link
Copy Markdown
Collaborator

pq commented May 4, 2026

Correct. A script is as automatic as we want it since we want to ensure a thoughtful manual review. (My biggest worry is the baselines creeping out without us realizing it.)

If this creates a lot of friction down the road, I'd be more than happy to discuss alternatives.

Thanks!

Copy link
Copy Markdown
Collaborator Author

@cj-radcliff cj-radcliff left a comment

Choose a reason for hiding this comment

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

Updated to re-add deleted comments.

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 a million for your thoughtful follow-ups!

@pq
Copy link
Copy Markdown
Collaborator

pq commented May 5, 2026

Once the verifier bits are fixed up, LGTM!

Adding windows version of update_baselines.bat
@cj-radcliff cj-radcliff merged commit ac329ac into flutter:refactor-combo-box-with-browse May 5, 2026
7 checks passed
cj-radcliff added a commit that referenced this pull request May 5, 2026
cj-radcliff added a commit that referenced this pull request May 6, 2026
* Refactor combo box with browse and reset functionality

* Checkpointing: Updating the code to use async file loading. Working but still throwing an exception.

* Fixing EDT exception

* Try 2026.1.1 (not verified) (#360)

* 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

* Bump gradle-wrapper from 9.4.1 to 9.5.0 in /third_party (#366)

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>

* [infra] trigger kokoro builds w/ the “kokoro:run” label (#370)

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>

* Finalizing refactor

* Addressing comments in PR: #372 (comment)

* Simplified logic as per PR comments

* Fixing requested issues with PR

* Updating to eliminate newly introduced plugin verification error

* Rolling back accidental changes.

* Fixing newly introduced verification error

* Readding deleted comments

* Removing flutter plugin to avoid any circular dependencies.

* Rename DartComboBoxWithBrowseButton to BasicComboBoxWithBrowseButton

* Removing the aggressive addition to checkValid calls

* Rolling back restart because it is deprecated and threw a verify error

* updating baselines
Adding windows version of update_baselines.bat

* Refactor combo box with browse and reset functionality

* Checkpointing: Updating the code to use async file loading. Working but still throwing an exception.

* Fixing EDT exception

* Finalizing refactor

* Addressing comments in PR: #372 (comment)

* Simplified logic as per PR comments

* Fixing requested issues with PR

* Updating to eliminate newly introduced plugin verification error

* Rolling back accidental changes.

* Fixing newly introduced verification error

* Readding deleted comments

* Removing flutter plugin to avoid any circular dependencies.

* Rename DartComboBoxWithBrowseButton to BasicComboBoxWithBrowseButton

* Removing the aggressive addition to checkValid calls

* Rolling back restart because it is deprecated and threw a verify error

* updating baselines
Adding windows version of update_baselines.bat

* reverting gradlew.bat

* Updated baseline

---------

Co-authored-by: Helin Shiah <helinx@google.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Phil Quitslund <pq@users.noreply.github.com>
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.

2 participants