Use distinct icon for Kotlin/JS module and libraries

This commit is contained in:
Dmitry Jemerov
2017-07-19 15:29:40 +02:00
parent 6eff8c7b4b
commit 6dbaec0cc6
8 changed files with 22 additions and 11 deletions
@@ -52,4 +52,6 @@ public interface KotlinIcons {
Icon FROM_IMPL = IconLoader.getIcon("/org/jetbrains/kotlin/idea/icons/fromImpl.png"); Icon FROM_IMPL = IconLoader.getIcon("/org/jetbrains/kotlin/idea/icons/fromImpl.png");
Icon LAUNCH = IconLoader.getIcon("/org/jetbrains/kotlin/idea/icons/kotlin_launch_configuration.png"); Icon LAUNCH = IconLoader.getIcon("/org/jetbrains/kotlin/idea/icons/kotlin_launch_configuration.png");
Icon JS = IconLoader.getIcon("/org/jetbrains/kotlin/idea/icons/kotlin_js.png");
} }
Binary file not shown.

After

Width:  |  Height:  |  Size: 313 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 601 B

@@ -31,9 +31,10 @@ import org.jetbrains.plugins.gradle.frameworkSupport.GradleFrameworkSupportProvi
import javax.swing.Icon import javax.swing.Icon
abstract class GradleKotlinFrameworkSupportProvider(val frameworkTypeId: String, abstract class GradleKotlinFrameworkSupportProvider(val frameworkTypeId: String,
val displayName: String) : GradleFrameworkSupportProvider() { val displayName: String,
val frameworkIcon: Icon) : GradleFrameworkSupportProvider() {
override fun getFrameworkType(): FrameworkTypeEx = object : FrameworkTypeEx(frameworkTypeId) { override fun getFrameworkType(): FrameworkTypeEx = object : FrameworkTypeEx(frameworkTypeId) {
override fun getIcon(): Icon = KotlinIcons.SMALL_LOGO override fun getIcon(): Icon = frameworkIcon
override fun getPresentableName(): String = displayName override fun getPresentableName(): String = displayName
@@ -74,7 +75,7 @@ abstract class GradleKotlinFrameworkSupportProvider(val frameworkTypeId: String,
protected abstract fun getPluginDefinition(): String protected abstract fun getPluginDefinition(): String
} }
class GradleKotlinJavaFrameworkSupportProvider : GradleKotlinFrameworkSupportProvider("KOTLIN", "Kotlin (Java)") { class GradleKotlinJavaFrameworkSupportProvider : GradleKotlinFrameworkSupportProvider("KOTLIN", "Kotlin (Java)", KotlinIcons.SMALL_LOGO) {
override fun getPluginDefinition() = override fun getPluginDefinition() =
KotlinWithGradleConfigurator.getGroovyApplyPluginDirective(KotlinGradleModuleConfigurator.KOTLIN) KotlinWithGradleConfigurator.getGroovyApplyPluginDirective(KotlinGradleModuleConfigurator.KOTLIN)
@@ -91,7 +92,7 @@ class GradleKotlinJavaFrameworkSupportProvider : GradleKotlinFrameworkSupportPro
} }
} }
class GradleKotlinJSFrameworkSupportProvider : GradleKotlinFrameworkSupportProvider("KOTLIN_JS", "Kotlin (JavaScript)") { class GradleKotlinJSFrameworkSupportProvider : GradleKotlinFrameworkSupportProvider("KOTLIN_JS", "Kotlin (JavaScript)", KotlinIcons.JS) {
override fun getPluginDefinition(): String = override fun getPluginDefinition(): String =
KotlinWithGradleConfigurator.getGroovyApplyPluginDirective(KotlinJsGradleModuleConfigurator.KOTLIN_JS) KotlinWithGradleConfigurator.getGroovyApplyPluginDirective(KotlinJsGradleModuleConfigurator.KOTLIN_JS)
@@ -25,9 +25,9 @@ class JSFrameworkType : FrameworkTypeEx("kotlin-js-framework-id") {
override fun createProvider(): FrameworkSupportInModuleProvider = JSFrameworkSupportProvider() override fun createProvider(): FrameworkSupportInModuleProvider = JSFrameworkSupportProvider()
override fun getPresentableName() = "Kotlin (JavaScript)" override fun getPresentableName() = "Kotlin/JS"
override fun getIcon(): Icon = KotlinIcons.SMALL_LOGO override fun getIcon(): Icon = KotlinIcons.JS
companion object { companion object {
val instance: JSFrameworkType val instance: JSFrameworkType
@@ -48,7 +48,7 @@ class JSLibraryType : LibraryType<DummyLibraryProperties>(JSLibraryKind) {
project) project)
} }
override fun getIcon(properties: DummyLibraryProperties?) = KotlinIcons.SMALL_LOGO override fun getIcon(properties: DummyLibraryProperties?) = KotlinIcons.JS
companion object { companion object {
fun getInstance() = Extensions.findExtension(EP_NAME, JSLibraryType::class.java) fun getInstance() = Extensions.findExtension(EP_NAME, JSLibraryType::class.java)
@@ -23,15 +23,17 @@ import com.intellij.ide.util.projectWizard.WizardContext
import com.intellij.openapi.roots.ui.configuration.ModulesProvider import com.intellij.openapi.roots.ui.configuration.ModulesProvider
import org.jetbrains.kotlin.idea.KotlinIcons import org.jetbrains.kotlin.idea.KotlinIcons
import org.jetbrains.kotlin.resolve.TargetPlatform import org.jetbrains.kotlin.resolve.TargetPlatform
import javax.swing.Icon
class KotlinModuleBuilder( class KotlinModuleBuilder(
val targetPlatform: TargetPlatform, val builderName: String, val builderDescription: String) : JavaModuleBuilder() { val targetPlatform: TargetPlatform, val builderName: String, val builderDescription: String, val icon: Icon
) : JavaModuleBuilder() {
override fun getBuilderId() = "kotlin.module.builder" override fun getBuilderId() = "kotlin.module.builder"
override fun getName() = builderName override fun getName() = builderName
override fun getPresentableName() = builderName override fun getPresentableName() = builderName
override fun getDescription() = builderDescription override fun getDescription() = builderDescription
override fun getBigIcon() = KotlinIcons.KOTLIN_LOGO_24 override fun getBigIcon() = KotlinIcons.KOTLIN_LOGO_24
override fun getNodeIcon() = KotlinIcons.SMALL_LOGO override fun getNodeIcon() = icon
override fun getGroupName() = KotlinTemplatesFactory.KOTLIN_GROUP_NAME override fun getGroupName() = KotlinTemplatesFactory.KOTLIN_GROUP_NAME
override fun createWizardSteps(wizardContext: WizardContext, modulesProvider: ModulesProvider) = ModuleWizardStep.EMPTY_ARRAY override fun createWizardSteps(wizardContext: WizardContext, modulesProvider: ModulesProvider) = ModuleWizardStep.EMPTY_ARRAY
@@ -33,7 +33,13 @@ class KotlinTemplatesFactory : ProjectTemplatesFactory() {
override fun createTemplates(group: String?, context: WizardContext?) = override fun createTemplates(group: String?, context: WizardContext?) =
arrayOf( arrayOf(
BuilderBasedTemplate(KotlinModuleBuilder(JvmPlatform, "Kotlin (JVM)", "Kotlin module for JVM target")), BuilderBasedTemplate(KotlinModuleBuilder(JvmPlatform,
BuilderBasedTemplate(KotlinModuleBuilder(JsPlatform, "Kotlin (JavaScript)", "Kotlin module for JavaScript target")) "Kotlin/JVM",
"Kotlin module for JVM target",
KotlinIcons.SMALL_LOGO)),
BuilderBasedTemplate(KotlinModuleBuilder(JsPlatform, "Kotlin/JS",
"Kotlin module for JavaScript target",
KotlinIcons.JS))
) )
} }