mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-280087 introduce API and implementation for searching within New Project node by Languages/Build systems
GitOrigin-RevId: 1d37643fe71cedb45747a9b60e897e18e3532455
This commit is contained in:
committed by
intellij-monorepo-bot
parent
b103bbf69c
commit
1ee67d8074
@@ -151,7 +151,7 @@ public final class ProjectTypeStep extends ModuleWizardStep implements SettingsS
|
||||
|
||||
String emptyCard = "emptyCard";
|
||||
ProjectTypeListWithSearch<TemplatesGroup> listWithFilter = new ProjectTypeListWithSearch<>(
|
||||
myContext, myProjectTypeList, new JBScrollPane(myProjectTypeList), group -> group.getName(), () -> {
|
||||
myContext, myProjectTypeList, new JBScrollPane(myProjectTypeList), getNamer(), () -> {
|
||||
showCard(emptyCard);
|
||||
wizard.updateButtons(true, false, true);
|
||||
});
|
||||
@@ -225,6 +225,20 @@ public final class ProjectTypeStep extends ModuleWizardStep implements SettingsS
|
||||
myTemplatesList.restoreSelection();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private Function<TemplatesGroup, String> getNamer() {
|
||||
return group -> {
|
||||
ModuleBuilder builder = group.getModuleBuilder();
|
||||
String name = group.getName();
|
||||
if (builder == null) return name;
|
||||
|
||||
ModuleWizardStep step = myCustomSteps.get(builder.getBuilderId());
|
||||
if (!(step instanceof NewProjectWizardStep)) return name;
|
||||
|
||||
return name + (" " + ((NewProjectWizardStep)step).getTextToSearch());
|
||||
};
|
||||
}
|
||||
|
||||
private static ModuleType getModuleType(TemplatesGroup group) {
|
||||
ModuleBuilder moduleBuilder = group.getModuleBuilder();
|
||||
return moduleBuilder == null ? null : moduleBuilder.getModuleType();
|
||||
|
||||
+2
@@ -42,6 +42,8 @@ abstract class AbstractNewProjectWizardMultiStepBase(
|
||||
steps = initSteps()
|
||||
step = step.ifBlank { steps.keys.first() }
|
||||
|
||||
textToSearch.append(" ").append(steps.keys.joinToString(" "))
|
||||
|
||||
with(builder) {
|
||||
row(label) {
|
||||
setupSwitcherUi(this@row)
|
||||
|
||||
@@ -17,4 +17,6 @@ abstract class AbstractNewProjectWizardStep(parentStep: NewProjectWizardStep) :
|
||||
final override val propertyGraph by parentStep::propertyGraph
|
||||
|
||||
final override val data by parentStep::data
|
||||
|
||||
final override val textToSearch by parentStep::textToSearch
|
||||
}
|
||||
@@ -30,6 +30,11 @@ interface NewProjectWizardStep {
|
||||
*/
|
||||
val propertyGraph: PropertyGraph
|
||||
|
||||
/**
|
||||
* The text that is used for search field input pattern matching
|
||||
*/
|
||||
val textToSearch: StringBuilder
|
||||
|
||||
/**
|
||||
* Data holder that needed to share step data.
|
||||
*
|
||||
|
||||
@@ -4,10 +4,13 @@ package com.intellij.ide.wizard
|
||||
import com.intellij.ide.util.projectWizard.WizardContext
|
||||
import com.intellij.openapi.observable.properties.PropertyGraph
|
||||
import com.intellij.openapi.util.UserDataHolderBase
|
||||
import java.lang.StringBuilder
|
||||
|
||||
class RootNewProjectWizardStep(override val context: WizardContext) : NewProjectWizardStep {
|
||||
|
||||
override val data = UserDataHolderBase()
|
||||
|
||||
override val propertyGraph = PropertyGraph("New project wizard")
|
||||
|
||||
override var textToSearch = StringBuilder()
|
||||
}
|
||||
Reference in New Issue
Block a user