IDEA-354377 Create workspace via Project Wizard

status text + indent removed

GitOrigin-RevId: fc7808eb60840cc53f7118c17749b7267e7ef18f
This commit is contained in:
Dmitry Avdeev
2024-06-04 16:49:27 +02:00
committed by intellij-monorepo-bot
parent 9e5909a854
commit c97d567cf4
4 changed files with 18 additions and 8 deletions

View File

@@ -577,6 +577,7 @@ action.add.projects.text=Add Projects\u2026
dialog.message.project.can.t.be.added.to.workspace=Project ''{0}'' cannot be added to workspace
workspace.project.type.name=Workspace
workspace.project.type.comment=A special project type intended to work with multiple projects in the same window
status.text.no.projects.added=No projects added
target.usages.option=usages
target.text.occurrences.option=text occurrences

View File

@@ -47,7 +47,7 @@ internal class ManageWorkspaceDialog(private val project: Project) : DialogWrapp
.component
}
row {
cell(subprojectList.createDecorator().createPanel()).align(Align.FILL)
cell(subprojectList.decoratorPanel).align(Align.FILL)
}
}
}

View File

@@ -42,7 +42,7 @@ class NewWorkspaceWizard: GeneratorNewProjectWizard {
override fun setupUI(builder: Panel) {
builder.row {
cell(subprojectList.createDecorator().createPanel()).align(Align.FILL)
cell(subprojectList.decoratorPanel).align(Align.FILL)
}
}

View File

@@ -12,12 +12,14 @@ import com.intellij.util.SystemProperties
import java.nio.file.Path
import javax.swing.Icon
import javax.swing.JList
import javax.swing.JPanel
import kotlin.io.path.pathString
internal class SubprojectList(private val currentProject: Project?) {
private val listModel: CollectionListModel<Item>
private val projectList: JBList<Item>
val decoratorPanel: JPanel
init {
val subprojects = currentProject?.let { getAllSubprojects(currentProject) } ?: emptyList()
@@ -25,13 +27,20 @@ internal class SubprojectList(private val currentProject: Project?) {
projectList = JBList(listModel).apply {
cellRenderer = Renderer().apply { iconTextGap = 3 }
}
}
@Suppress("DialogTitleCapitalization") val actionText = LangBundle.message("action.add.projects.text")
val toolbarDecorator = ToolbarDecorator.createDecorator(projectList)
.setPanelBorder(IdeBorderFactory.createTitledBorder(LangBundle.message("border.title.linked.projects"), false))
.disableUpDownActions()
.setAddActionName(actionText)
.setAddAction { addProjects() }
decoratorPanel = toolbarDecorator.createPanel()
fun createDecorator(): ToolbarDecorator = ToolbarDecorator.createDecorator(projectList)
.setPanelBorder(IdeBorderFactory.createTitledBorder(LangBundle.message("border.title.linked.projects")))
.disableUpDownActions()
.setAddActionName(LangBundle.message("action.add.projects.text"))
.setAddAction { addProjects() }
projectList.emptyText
.appendText(LangBundle.message("status.text.no.projects.added"))
.appendLine(actionText, SimpleTextAttributes.LINK_PLAIN_ATTRIBUTES) {
addProjects()
}
}
val projectPaths: List<String>
get() = listModel.items.map { it.path }