Skip to content

Commit

Permalink
Merge branch 'release/1.0.0-alpha.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
nekofar committed Mar 11, 2022
2 parents ce1cb79 + 351eaea commit a083f6f
Show file tree
Hide file tree
Showing 10 changed files with 126 additions and 18 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,10 @@
All notable changes to this project will be documented in this file.

## [Unreleased]
## [1.0.0-alpha.4] - 2022-03-11

### Features

- Implement project creation through wizard

<!-- generated by git-cliff -->
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ pluginGroup = com.nekofar.milad
pluginName = IntelliJ Truffle Plugin

# SemVer format -> https://semver.org
pluginVersion = 1.0.0-alpha.3
pluginVersion = 1.0.0-alpha.4

# See https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
# for insight into build numbers and IntelliJ Platform versions.
Expand Down
14 changes: 14 additions & 0 deletions src/main/kotlin/com/nekofar/milad/intellij/slim/SlimBundle.kt
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)
}
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()
}
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);
}
}
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())
}
3 changes: 2 additions & 1 deletion src/main/resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
<depends>com.intellij.modules.platform</depends>

<extensions defaultExtensionNs="com.intellij">
<!-- Add your extensions here -->
<directoryProjectGenerator implementation="com.nekofar.milad.intellij.slim.SlimProjectGenerator" />
<projectTemplatesFactory implementation="com.nekofar.milad.intellij.slim.SlimProjectTemplatesFactory" />
</extensions>

<actions>
Expand Down
22 changes: 14 additions & 8 deletions src/main/resources/META-INF/pluginIcon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 14 additions & 8 deletions src/main/resources/icons/logoIcon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions src/main/resources/messages/SlimBundle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
slim.project.generator.description=
slim.project.generator.name=Slim

0 comments on commit a083f6f

Please sign in to comment.