Wizard: remove unused project tags

This commit is contained in:
Ilya Kirillov
2020-03-20 13:48:27 +03:00
parent d2c8ca9230
commit 24d53d5d08
4 changed files with 4 additions and 65 deletions
@@ -67,7 +67,7 @@ class TemplateDescriptionComponent : Component() {
}
fun setTemplate(template: ProjectTemplate) {
descriptionLabel.text = template.htmlDescription
descriptionLabel.text = template.description
}
override val component: JComponent = descriptionLabel
@@ -1,6 +1,5 @@
package org.jetbrains.kotlin.tools.projectWizard.wizard.ui
import TemplateTag
import com.intellij.icons.AllIcons
import com.intellij.ide.plugins.newui.TagComponent
import com.intellij.openapi.actionSystem.ActionManager
@@ -181,15 +180,6 @@ fun <C : JComponent> C.addBorder(border: Border): C = apply {
this.border = BorderFactory.createCompoundBorder(border, this.border)
}
class TemplateTagUIComponent(tag: TemplateTag) : TagComponent(tag.text) {
override fun isInClickableArea(pt: Point?) = false
init {
RelativeFont.TINY.install(this)
tag.tooltip?.let { toolTipText = it }
}
}
fun <T> runWithProgressBar(title: String, action: () -> T): T =
ProgressManager.getInstance().runProcessWithProgressSynchronously(
ThrowableComputable<T, Exception> { action() },
@@ -1,28 +0,0 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
class TemplateTag private constructor(
val text: String,
val tooltip: String?,
val priority: Int
) {
companion object {
private val allTags = mutableListOf<TemplateTag>()
private fun tag(text: String, tooltip: String? = null): TemplateTag =
TemplateTag(text, tooltip, priority = allTags.size).also {
allTags += it
}
val ALL: List<TemplateTag>
get() = allTags
val MPP = tag("Multiplatform")
val JVM = tag("JVM")
val JS = tag("JS")
val NATIVE = tag("Native")
val ANDROID = tag("Android")
}
}
@@ -1,6 +1,5 @@
package org.jetbrains.kotlin.tools.projectWizard.projectTemplates
import TemplateTag
import org.intellij.lang.annotations.Language
import org.jetbrains.kotlin.tools.projectWizard.core.buildList
import org.jetbrains.kotlin.tools.projectWizard.core.entity.settings.*
@@ -14,21 +13,6 @@ import org.jetbrains.kotlin.tools.projectWizard.settings.DisplayableSettingItem
import org.jetbrains.kotlin.tools.projectWizard.settings.buildsystem.*
import org.jetbrains.kotlin.tools.projectWizard.templates.*
private fun Module.createTag(): TemplateTag? = when (configurator) {
is MppModuleConfigurator -> TemplateTag.MPP
is AndroidModuleConfigurator -> TemplateTag.ANDROID
is JSConfigurator -> TemplateTag.JS
is ModuleConfiguratorWithModuleType -> when (configurator.moduleType) {
ModuleType.jvm -> TemplateTag.JVM
ModuleType.js -> TemplateTag.JS
ModuleType.native -> TemplateTag.NATIVE
ModuleType.android -> TemplateTag.ANDROID
ModuleType.common -> null
null -> null
}
else -> null
}
sealed class ProjectTemplate : DisplayableSettingItem {
abstract val title: String
override val text: String get() = title
@@ -37,16 +21,6 @@ sealed class ProjectTemplate : DisplayableSettingItem {
abstract val projectKind: ProjectKind
open val id: String
get() = this::class.simpleName.toString().removeSuffix("Template").removeSuffix("Project")
val tags: List<TemplateTag>
get() = setsPluginSettings
.firstOrNull { it.setting == KotlinPlugin::modules.reference }
?.value
?.safeAs<List<Module>>()
?.withAllSubModules(includeSourcesets = true)
?.mapNotNull(Module::createTag)
?.distinct()
?.sortedBy(TemplateTag::priority)
.orEmpty()
private val setsDefaultValues: List<SettingWithValue<*, *>>
get() = listOf(KotlinPlugin::projectKind.reference withValue projectKind)
@@ -177,6 +151,7 @@ object JvmConsoleApplication : ProjectTemplate() {
object MultiplatformLibrary : ProjectTemplate() {
override val title = "Kotlin Multiplatform Library"
@Language("HTML")
override val htmlDescription = """
Multiplatform Gradle project allowing reuse of the same Kotlin code between all three main platforms
@@ -228,6 +203,7 @@ object JvmServerJsClient : ProjectTemplate() {
object AndroidApplication : ProjectTemplate() {
override val title = "Android Application"
@Language("HTML")
override val htmlDescription = """
Simple <b>Android</b> application with single activity
@@ -299,6 +275,7 @@ object JsBrowserApplication : ProjectTemplate() {
object IOSApplication : ProjectTemplate() {
override val title = "IOS Application"
@Language("HTML")
override val htmlDescription = """
Simple <b>IOS</b> application with single screen