Use Kotlin extension function to retrieve service

This commit is contained in:
Casper Boone 2020-10-30 17:05:21 +01:00 committed by GitHub
parent 624c6950be
commit e3e031bd96
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View File

@ -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

View File

@ -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>()
}
}