-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'release/1.0.0-alpha.4'
- Loading branch information
Showing
10 changed files
with
126 additions
and
18 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
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
14 changes: 14 additions & 0 deletions
14
src/main/kotlin/com/nekofar/milad/intellij/slim/SlimBundle.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,14 @@ | ||
package com.nekofar.milad.intellij.slim | ||
|
||
import com.intellij.DynamicBundle | ||
import org.jetbrains.annotations.NonNls | ||
import org.jetbrains.annotations.PropertyKey | ||
|
||
@NonNls | ||
private const val BUNDLE = "messages.SlimBundle" | ||
|
||
object SlimBundle : DynamicBundle(BUNDLE) { | ||
@JvmStatic | ||
fun message(@NonNls @PropertyKey(resourceBundle = BUNDLE) key: String, vararg params: Any) = | ||
getMessage(key, *params) | ||
} |
10 changes: 10 additions & 0 deletions
10
src/main/kotlin/com/nekofar/milad/intellij/slim/SlimProjectGenerator.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,10 @@ | ||
package com.nekofar.milad.intellij.slim | ||
|
||
import com.jetbrains.php.composer.ComposerProjectGenerator | ||
|
||
class SlimProjectGenerator : ComposerProjectGenerator() { | ||
override fun getIcon() = SlimIcons.ProjectGenerator | ||
override fun getName() = SlimBundle.message("slim.project.generator.name") | ||
override fun getDescription() = SlimBundle.message("slim.project.generator.description") | ||
override fun createPeer() = SlimProjectGeneratorPeer() | ||
} |
54 changes: 54 additions & 0 deletions
54
src/main/kotlin/com/nekofar/milad/intellij/slim/SlimProjectGeneratorPeer.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,54 @@ | ||
package com.nekofar.milad.intellij.slim | ||
|
||
import com.intellij.ide.util.projectWizard.SettingsStep | ||
import com.intellij.openapi.ui.ValidationInfo | ||
import com.intellij.platform.WebProjectGenerator | ||
import com.intellij.util.textCompletion.TextFieldWithCompletion | ||
import com.jetbrains.php.composer.ComposerCreateProjectForm | ||
import com.jetbrains.php.composer.ComposerProjectPeer | ||
import com.jetbrains.php.composer.ComposerProjectSettings | ||
import com.jetbrains.php.composer.addDependency.ComposerPackage | ||
import javax.swing.JComponent | ||
import javax.swing.JPanel | ||
|
||
class SlimProjectGeneratorPeer : ComposerProjectPeer() { | ||
private val form = ComposerCreateProjectForm() | ||
private val packageName = "slim/slim-skeleton" | ||
|
||
override fun getComponent(): JComponent { | ||
return updatePackageField(form.contentPane) | ||
} | ||
|
||
override fun buildUI(settingsStep: SettingsStep) { | ||
val contentPane = updatePackageField(form.contentPane) | ||
settingsStep.addSettingsComponent(contentPane) | ||
} | ||
|
||
override fun getSettings(): ComposerProjectSettings { | ||
val settings = form.settings | ||
|
||
return ComposerProjectSettings( | ||
settings.isDownload, | ||
ComposerPackage(packageName), | ||
settings.version, | ||
settings.options, | ||
settings.execution | ||
) | ||
} | ||
|
||
private fun updatePackageField(contentPane: JComponent): JComponent { | ||
val components = ((contentPane.components[1] as JPanel).components[0] as JPanel).components | ||
val packageTextField = (components[1] as TextFieldWithCompletion) | ||
packageTextField.text = packageName | ||
return contentPane | ||
} | ||
|
||
override fun validate(): ValidationInfo? { | ||
return form.validate() | ||
} | ||
|
||
@Deprecated("Deprecated in Java") | ||
override fun addSettingsStateListener(listener: WebProjectGenerator.SettingsStateListener) { | ||
form.addSettingsStateListener(listener); | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
src/main/kotlin/com/nekofar/milad/intellij/slim/SlimProjectTemplatesFactory.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,9 @@ | ||
package com.nekofar.milad.intellij.slim | ||
|
||
import com.intellij.ide.util.projectWizard.WizardContext | ||
import com.intellij.platform.ProjectTemplatesFactory | ||
|
||
class SlimProjectTemplatesFactory : ProjectTemplatesFactory() { | ||
override fun getGroups() = arrayOf("PHP") | ||
override fun createTemplates(group: String?, context: WizardContext) = arrayOf(SlimProjectGenerator()) | ||
} |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,2 @@ | ||
slim.project.generator.description= | ||
slim.project.generator.name=Slim |