Use Kotlin extension function to retrieve service

pull/58/head
Casper Boone 4 years ago committed by GitHub
parent 624c6950be
commit e3e031bd96
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -14,6 +14,7 @@
- Dependencies - upgrade `org.jetbrains.intellij` to `0.6.1`
- GitHub Actions - `gradleValidation` update to `gradle/wrapper-validation-action@v1.0.3`
- GitHub Actions - `releaseDraft` update to `actions/download-artifact@v2`
- Use [Kotlin extension function](https://jetbrains.org/intellij/sdk/docs/basics/plugin_structure/plugin_services.html?search=servic#retrieving-a-service) to retrieve the `MyProjectService` in the `MyProjectManagerListener`
### Removed
- Remove Third-party IntelliJ Plugin Verifier GitHub Action

@ -1,5 +1,6 @@
package org.jetbrains.plugins.template.listeners
import com.intellij.openapi.components.service
import com.intellij.openapi.project.Project
import com.intellij.openapi.project.ProjectManagerListener
import org.jetbrains.plugins.template.services.MyProjectService
@ -7,6 +8,6 @@ import org.jetbrains.plugins.template.services.MyProjectService
internal class MyProjectManagerListener : ProjectManagerListener {
override fun projectOpened(project: Project) {
project.getService(MyProjectService::class.java)
project.service<MyProjectService>()
}
}

Loading…
Cancel
Save