Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修复启动时报错 do not use constructor injection #962

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions idea-plugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,9 @@ allprojects {
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
testCompile group: 'junit', name: 'junit', version: '4.11'
}

tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
kotlinOptions.jvmTarget = "1.8"
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ import java.util.concurrent.locks.ReentrantReadWriteLock
* @date 2016/12/13
*/
class AliProjectComponent(
private val project: Project,
val p3cConfig: P3cConfig
private val project: Project
) : AliBaseProjectComponent {
private val listener: VirtualFileListener
private val javaExtension = ".java"
Expand All @@ -55,6 +54,7 @@ class AliProjectComponent(
private val fileContexts = ConcurrentHashMap<String, FileContext>()

init {
val p3cConfig = P3cConfig.getInstance()
listener = object : VirtualFileAdapter() {
override fun contentsChanged(event: VirtualFileEvent) {
val path = getFilePath(event) ?: return
Expand Down Expand Up @@ -98,6 +98,7 @@ class AliProjectComponent(
}

override fun initComponent() {
val p3cConfig = P3cConfig.getInstance()
I18nResources.changeLanguage(p3cConfig.locale)
val analyticsGroup = ActionManager.getInstance().getAction(analyticsGroupId)
analyticsGroup.templatePresentation.text = P3cBundle.getMessage(analyticsGroupText)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package com.alibaba.p3c.idea.config
import com.intellij.openapi.components.PersistentStateComponent
import com.intellij.openapi.components.State
import com.intellij.openapi.components.Storage
import com.intellij.openapi.components.service
import com.intellij.util.xmlb.XmlSerializerUtil
import java.util.Locale

Expand Down Expand Up @@ -64,5 +65,8 @@ class P3cConfig : PersistentStateComponent<P3cConfig> {
companion object {
val localeEn = Locale.ENGLISH.language!!
val localeZh = Locale.CHINESE.language!!

@JvmStatic
fun getInstance(): P3cConfig = service<P3cConfig>()
}
}