-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
105 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
plugin/src/main/kotlin/org/jetbrains/spek/idea/DynamicConfigurationType.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package org.jetbrains.spek.idea | ||
|
||
import com.intellij.execution.configurations.ConfigurationFactory | ||
import com.intellij.execution.configurations.ConfigurationType | ||
import javax.swing.Icon | ||
|
||
class DynamicConfigurationType: ConfigurationType { | ||
val manager by lazy { SpekPluginManager() } | ||
val extensionFactory by lazy { manager.extensionFactory } | ||
val type by lazy { extensionFactory.createConfigurationType() } | ||
|
||
override fun getIcon(): Icon { | ||
return type.icon | ||
} | ||
|
||
override fun getConfigurationTypeDescription(): String { | ||
return type.configurationTypeDescription | ||
} | ||
|
||
override fun getId(): String { | ||
return type.id | ||
} | ||
|
||
override fun getDisplayName(): String { | ||
return type.displayName | ||
} | ||
|
||
override fun getConfigurationFactories(): Array<ConfigurationFactory> { | ||
return type.configurationFactories | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
plugin/src/main/kotlin/org/jetbrains/spek/idea/ExtensionFactory.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package org.jetbrains.spek.idea | ||
|
||
import com.intellij.execution.configurations.ConfigurationType | ||
|
||
interface ExtensionFactory { | ||
fun createConfigurationType(): ConfigurationType | ||
} |
11 changes: 11 additions & 0 deletions
11
plugin/src/main/kotlin/org/jetbrains/spek/idea/PluginOverride.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package org.jetbrains.spek.idea | ||
|
||
import com.intellij.openapi.extensions.ExtensionPointName | ||
|
||
interface PluginOverride { | ||
fun createExtensionFactory(): ExtensionFactory | ||
|
||
companion object { | ||
val PLUGIN_OVERRIDE_EP = ExtensionPointName.create<PluginOverride>("org.jetbrains.spek.spek-idea-plugin.pluginOverride") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
plugin/src/main/kotlin/org/jetbrains/spek/idea/SpekJvmRunConfigurationType.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
package org.jetbrains.spek.idea | ||
|
||
class SpekJvmRunConfigurationType: SpekRunConfigurationType( | ||
class SpekJvmRunConfigurationType: SpekConfigurationType( | ||
"org.spekframework.spek-jvm", | ||
"Spek" | ||
) { | ||
override fun createConfigurationFactory(type: SpekRunConfigurationType): SpekConfigurationFactory { | ||
override fun createConfigurationFactory(type: SpekConfigurationType): SpekConfigurationFactory { | ||
return SpekJvmConfigurationFactory(type) | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
plugin/src/main/kotlin/org/jetbrains/spek/idea/SpekPluginManager.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package org.jetbrains.spek.idea | ||
|
||
import com.intellij.execution.configurations.ConfigurationType | ||
import com.intellij.openapi.extensions.Extensions | ||
|
||
class SpekPluginManager { | ||
val extensionFactory by lazy { | ||
val override = Extensions.getExtensions(PluginOverride.PLUGIN_OVERRIDE_EP) | ||
.firstOrNull() | ||
|
||
override?.createExtensionFactory() ?: createDefaultExtensionFactory() | ||
} | ||
|
||
private fun createDefaultExtensionFactory(): ExtensionFactory { | ||
return object: ExtensionFactory { | ||
override fun createConfigurationType(): ConfigurationType { | ||
return SpekJvmRunConfigurationType() | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
plugin/src/main/kotlin/org/jetbrains/spek/idea/androidstudio/PluginAndroidOverride.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package org.jetbrains.spek.idea.androidstudio | ||
|
||
import com.intellij.execution.configurations.ConfigurationType | ||
import org.jetbrains.spek.idea.ExtensionFactory | ||
import org.jetbrains.spek.idea.PluginOverride | ||
|
||
class PluginAndroidOverride: PluginOverride { | ||
override fun createExtensionFactory(): ExtensionFactory { | ||
return object: ExtensionFactory { | ||
override fun createConfigurationType(): ConfigurationType { | ||
return SpekAndroidConfigurationType() | ||
} | ||
} | ||
} | ||
} |
8 changes: 4 additions & 4 deletions
8
plugin/src/main/kotlin/org/jetbrains/spek/idea/androidstudio/SpekAndroidConfigurationType.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
package org.jetbrains.spek.idea.androidstudio | ||
|
||
import org.jetbrains.spek.idea.SpekConfigurationFactory | ||
import org.jetbrains.spek.idea.SpekRunConfigurationType | ||
import org.jetbrains.spek.idea.SpekConfigurationType | ||
|
||
class SpekAndroidConfigurationType: SpekRunConfigurationType( | ||
class SpekAndroidConfigurationType: SpekConfigurationType( | ||
"SpecsRunConfiguration", // hardcoded :( | ||
"Spek - Android" | ||
"Spek" | ||
) { | ||
override fun createConfigurationFactory(type: SpekRunConfigurationType): SpekConfigurationFactory { | ||
override fun createConfigurationFactory(type: SpekConfigurationType): SpekConfigurationFactory { | ||
return SpekAndroidConfigurationFactory(type) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<idea-plugin> | ||
<extensions defaultExtensionNs="org.jetbrains.spek.spek-idea-plugin"> | ||
<pluginOverride implementation="org.jetbrains.spek.idea.androidstudio.PluginAndroidOverride"/> | ||
</extensions> | ||
</idea-plugin> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.