Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
9ee8971
Refactor combo box with browse and reset functionality
cj-radcliff Apr 30, 2026
fd7c2f4
Checkpointing: Updating the code to use async file loading. Working b…
cj-radcliff May 1, 2026
c5a0cf1
Fixing EDT exception
cj-radcliff May 1, 2026
20c491a
Try 2026.1.1 (not verified) (#360)
helin24 Apr 30, 2026
f1c802e
Bump gradle-wrapper from 9.4.1 to 9.5.0 in /third_party (#366)
dependabot[bot] Apr 30, 2026
de1e540
[infra] trigger kokoro builds w/ the “kokoro:run” label (#370)
pq Apr 30, 2026
5093db4
Finalizing refactor
cj-radcliff May 1, 2026
4b98954
Merge branch 'flutter:refactor-combo-box-with-browse' into refactor-c…
cj-radcliff May 1, 2026
c0bb2dd
Addressing comments in PR: https://github.com/flutter/dart-intellij-t…
cj-radcliff May 1, 2026
b0e0e02
Simplified logic as per PR comments
cj-radcliff May 1, 2026
eb313ab
Fixing requested issues with PR
cj-radcliff May 1, 2026
9facc81
Updating to eliminate newly introduced plugin verification error
cj-radcliff May 1, 2026
abde78c
Rolling back accidental changes.
cj-radcliff May 1, 2026
130ef73
Fixing newly introduced verification error
cj-radcliff May 1, 2026
462814a
Readding deleted comments
cj-radcliff May 5, 2026
c4c90d7
Removing flutter plugin to avoid any circular dependencies.
cj-radcliff May 5, 2026
c63fb41
Rename DartComboBoxWithBrowseButton to BasicComboBoxWithBrowseButton
cj-radcliff May 5, 2026
78ca81a
Removing the aggressive addition to checkValid calls
cj-radcliff May 5, 2026
51c3a0d
Rolling back restart because it is deprecated and threw a verify error
cj-radcliff May 5, 2026
21b65a3
updating baselines
cj-radcliff May 5, 2026
f5c452e
Refactor combo box with browse and reset functionality
cj-radcliff Apr 30, 2026
878cf3c
Checkpointing: Updating the code to use async file loading. Working b…
cj-radcliff May 1, 2026
8070915
Fixing EDT exception
cj-radcliff May 1, 2026
d61d2ed
Finalizing refactor
cj-radcliff May 1, 2026
e6cacd9
Addressing comments in PR: https://github.com/flutter/dart-intellij-t…
cj-radcliff May 1, 2026
1240a39
Simplified logic as per PR comments
cj-radcliff May 1, 2026
1b8f582
Fixing requested issues with PR
cj-radcliff May 1, 2026
4b7b953
Updating to eliminate newly introduced plugin verification error
cj-radcliff May 1, 2026
5f9a91d
Rolling back accidental changes.
cj-radcliff May 1, 2026
b5626ee
Fixing newly introduced verification error
cj-radcliff May 1, 2026
57a1f4d
Readding deleted comments
cj-radcliff May 5, 2026
5a4fc3e
Removing flutter plugin to avoid any circular dependencies.
cj-radcliff May 5, 2026
3121b93
Rename DartComboBoxWithBrowseButton to BasicComboBoxWithBrowseButton
cj-radcliff May 5, 2026
4a5ef24
Removing the aggressive addition to checkValid calls
cj-radcliff May 5, 2026
5b61dc2
Rolling back restart because it is deprecated and threw a verify error
cj-radcliff May 5, 2026
ac329ac
updating baselines
cj-radcliff May 5, 2026
46fbca3
Merge branch 'flutter:refactor-combo-box-with-browse' into refactor-c…
cj-radcliff May 5, 2026
55f568e
reverting gradlew.bat
cj-radcliff May 5, 2026
fc9715a
fixing merge but will rerun
cj-radcliff May 5, 2026
f2ec838
Updated baseline
cj-radcliff May 6, 2026
7961b03
Merge pull request #378 from cj-radcliff/refactor-combo-box-with-browse
cj-radcliff May 6, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
164 changes: 82 additions & 82 deletions third_party/gradlew.bat

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<text resource-bundle="messages/DartBundle" key="remote.debug.search.sources.in"/>
</properties>
</component>
<component id="e3762" class="com.intellij.ui.ComboboxWithBrowseButton" binding="myDartProjectCombo">
<component id="e3762" class="com.jetbrains.lang.dart.ui.BasicComboBoxWithBrowseButton" binding="myDartProjectCombo" custom-create="true">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false">
<minimum-size width="100" height="-1"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,28 @@
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.jetbrains.lang.dart.ide.runner.server.ui;

import com.intellij.openapi.application.ModalityState;
import com.intellij.openapi.application.ReadAction;
import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory;
import com.intellij.openapi.options.SettingsEditor;
import com.intellij.openapi.progress.ProgressManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.roots.ProjectRootManager;
import com.intellij.openapi.ui.TextComponentAccessor;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.vfs.LocalFileSystem;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.search.FileTypeIndex;
import com.intellij.psi.search.FilenameIndex;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.psi.search.GlobalSearchScopesCore;
import com.intellij.ui.ComboboxWithBrowseButton;
import com.intellij.ui.SimpleListCellRenderer;
import com.intellij.ui.components.JBLabel;
import com.intellij.util.concurrency.AppExecutorUtil;
import com.jetbrains.lang.dart.DartBundle;
import com.jetbrains.lang.dart.DartFileType;
import com.jetbrains.lang.dart.ide.runner.server.DartRemoteDebugConfiguration;
import com.jetbrains.lang.dart.ide.runner.server.DartRemoteDebugParameters;
import com.jetbrains.lang.dart.ui.BasicComboBoxWithBrowseButton;
import com.jetbrains.lang.dart.util.PubspecYamlUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
Expand All @@ -32,50 +36,55 @@
public class DartRemoteDebugConfigurationEditor extends SettingsEditor<DartRemoteDebugConfiguration> {

private JPanel myMainPanel;
private ComboboxWithBrowseButton myDartProjectCombo;
private BasicComboBoxWithBrowseButton<NameAndPath> myDartProjectCombo;
private JBLabel myHintLabel;

private final Project myProject;
private final SortedSet<NameAndPath> myComboItems = new TreeSet<>();

public DartRemoteDebugConfigurationEditor(final @NotNull Project project) {
myProject = project;
myDartProjectCombo.addBrowseFolderListener(DartBundle.message("button.browse.dialog.title.select.dart.project.path"),
myProject,
FileChooserDescriptorFactory.createSingleFolderDescriptor()
.withTitle(DartBundle.message("button.browse.dialog.title.select.dart.project.path")),
this::resolveNameAndPath,
this::applySelectedProjectPath);
initDartProjectsCombo(project);
myHintLabel.setCopyable(true);
}

private void initDartProjectsCombo(final @NotNull Project project) {
myDartProjectCombo.getComboBox().setRenderer(SimpleListCellRenderer.create("", NameAndPath::getPresentableText));
myDartProjectCombo.setRenderer(SimpleListCellRenderer.create("", NameAndPath::getPresentableText));

if (!project.isDefault()) {
if (project.isDefault()) return;

ReadAction.nonBlocking(() -> {
SortedSet<NameAndPath> items = new TreeSet<>();
for (VirtualFile pubspecFile : FilenameIndex.getVirtualFilesByName(PUBSPEC_YAML, GlobalSearchScope.projectScope(project))) {
myComboItems.add(new NameAndPath(PubspecYamlUtil.getDartProjectName(pubspecFile), pubspecFile.getParent().getPath()));
ProgressManager.checkCanceled();
items.add(new NameAndPath(PubspecYamlUtil.getDartProjectName(pubspecFile), pubspecFile.getParent().getPath()));
}

if (myComboItems.isEmpty()) {
if (items.isEmpty()) {
for (VirtualFile contentRoot : ProjectRootManager.getInstance(project).getContentRoots()) {
ProgressManager.checkCanceled();
if (FileTypeIndex.containsFileOfType(DartFileType.INSTANCE, GlobalSearchScopesCore.directoryScope(project, contentRoot, true))) {
myComboItems.add(new NameAndPath(null, contentRoot.getPath()));
items.add(new NameAndPath(null, contentRoot.getPath()));
}
}
}
}

myDartProjectCombo.getComboBox().setModel(new DefaultComboBoxModel<>(myComboItems.toArray()));

myDartProjectCombo.addBrowseFolderListener(
project,
FileChooserDescriptorFactory.createSingleFolderDescriptor(),
new TextComponentAccessor<>() {
@Override
public String getText(final JComboBox combo) {
final Object item = combo.getSelectedItem();
return item instanceof NameAndPath ? ((NameAndPath)item).myPath : "";
}

@Override
public void setText(final JComboBox combo, final @NotNull String path) {
setSelectedProjectPath(FileUtil.toSystemIndependentName(path));
return items;
})
.finishOnUiThread(ModalityState.any(), items -> {
final Object selectedItem = myDartProjectCombo.getSelectedItem();
myComboItems.addAll(items);
myDartProjectCombo.setModel(new DefaultComboBoxModel<>(myComboItems.toArray(NameAndPath[]::new)));
if (selectedItem != null) {
myDartProjectCombo.setSelectedItem(selectedItem);
}
});
})
.submit(AppExecutorUtil.getAppExecutorService());
}

@Override
Expand All @@ -92,23 +101,34 @@ protected void resetEditorFrom(final @NotNull DartRemoteDebugConfiguration confi
private void setSelectedProjectPath(final @NotNull String projectPath) {
if (projectPath.isEmpty()) return;

ReadAction.nonBlocking(() -> resolveNameAndPath(projectPath))
.finishOnUiThread(ModalityState.any(), this::applySelectedProjectPath)
.submit(AppExecutorUtil.getAppExecutorService());
}

private @NotNull NameAndPath resolveNameAndPath(final @NotNull String projectPath) {
final VirtualFile pubspecFile = LocalFileSystem.getInstance().findFileByPath(projectPath + "/" + PUBSPEC_YAML);
final String projectName = pubspecFile == null ? null : PubspecYamlUtil.getDartProjectName(pubspecFile);
final NameAndPath item = new NameAndPath(projectName, projectPath);
return new NameAndPath(projectName, projectPath);
}

private void applySelectedProjectPath(final @NotNull NameAndPath item) {
if (!myComboItems.contains(item)) {
myComboItems.add(item);
myDartProjectCombo.getComboBox().setModel(new DefaultComboBoxModel(myComboItems.toArray()));
myDartProjectCombo.setModel(new DefaultComboBoxModel<>(myComboItems.toArray(NameAndPath[]::new)));
}

myDartProjectCombo.getComboBox().setSelectedItem(item);
myDartProjectCombo.setSelectedItem(item);
}

@Override
protected void applyEditorTo(final @NotNull DartRemoteDebugConfiguration config) {
final DartRemoteDebugParameters params = config.getParameters();
final Object selectedItem = myDartProjectCombo.getComboBox().getSelectedItem();
params.setDartProjectPath(selectedItem instanceof NameAndPath ? ((NameAndPath)selectedItem).myPath : "");
final Object selectedItem = myDartProjectCombo.getSelectedItem();
params.setDartProjectPath(selectedItem == null ? "" : selectedItem.toString().trim());
}

private void createUIComponents() {
myDartProjectCombo = new BasicComboBoxWithBrowseButton<>();
}

private static class NameAndPath implements Comparable<NameAndPath> {
Expand All @@ -126,7 +146,7 @@ public String getPresentableText() {

@Override
public String toString() {
return getPresentableText();
return myPath;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<text resource-bundle="messages/DartBundle" key="dart.sdk.path.label"/>
</properties>
</component>
<component id="b09db" class="com.intellij.ui.ComboboxWithBrowseButton" binding="mySdkPathComboWithBrowse" custom-create="true">
<component id="b09db" class="com.jetbrains.lang.dart.ui.BasicComboBoxWithBrowseButton" binding="mySdkPathComboWithBrowse" custom-create="true">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="7" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
Expand Down
Loading
Loading