Allow to report exceptions in internal mode when updates are available
This commit is contained in:
+1
-1
@@ -20,7 +20,7 @@ import com.intellij.ide.util.PropertiesComponent
|
|||||||
|
|
||||||
class KotlinInternalMode {
|
class KotlinInternalMode {
|
||||||
companion object Instance {
|
companion object Instance {
|
||||||
val INTERNAL_MODE_PROPERTY = "kotlin.internal.mode.enabled"
|
private val INTERNAL_MODE_PROPERTY = "kotlin.internal.mode.enabled"
|
||||||
|
|
||||||
var enabled: Boolean
|
var enabled: Boolean
|
||||||
get() = PropertiesComponent.getInstance()!!.getBoolean(
|
get() = PropertiesComponent.getInstance()!!.getBoolean(
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import com.intellij.util.Consumer
|
|||||||
import org.jetbrains.kotlin.idea.KotlinPluginUpdater
|
import org.jetbrains.kotlin.idea.KotlinPluginUpdater
|
||||||
import org.jetbrains.kotlin.idea.KotlinPluginUtil
|
import org.jetbrains.kotlin.idea.KotlinPluginUtil
|
||||||
import org.jetbrains.kotlin.idea.PluginUpdateStatus
|
import org.jetbrains.kotlin.idea.PluginUpdateStatus
|
||||||
|
import org.jetbrains.kotlin.idea.actions.internal.KotlinInternalMode
|
||||||
import java.awt.Component
|
import java.awt.Component
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -33,10 +34,13 @@ class KotlinReportSubmitter : ITNReporter() {
|
|||||||
private var hasUpdate = false
|
private var hasUpdate = false
|
||||||
private var hasLatestVersion = false
|
private var hasLatestVersion = false
|
||||||
|
|
||||||
override fun showErrorInRelease(event: IdeaLoggingEvent) = !hasUpdate
|
override fun showErrorInRelease(event: IdeaLoggingEvent) = !hasUpdate || KotlinInternalMode.enabled
|
||||||
|
|
||||||
override fun submit(events: Array<IdeaLoggingEvent>, additionalInfo: String?, parentComponent: Component, consumer: Consumer<SubmittedReportInfo>): Boolean {
|
override fun submit(events: Array<IdeaLoggingEvent>, additionalInfo: String?, parentComponent: Component, consumer: Consumer<SubmittedReportInfo>): Boolean {
|
||||||
if (hasUpdate) {
|
if (hasUpdate) {
|
||||||
|
if (KotlinInternalMode.enabled) {
|
||||||
|
return super.submit(events, additionalInfo, parentComponent, consumer)
|
||||||
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -47,9 +51,14 @@ class KotlinReportSubmitter : ITNReporter() {
|
|||||||
KotlinPluginUpdater.getInstance().runUpdateCheck { status ->
|
KotlinPluginUpdater.getInstance().runUpdateCheck { status ->
|
||||||
if (status is PluginUpdateStatus.Update) {
|
if (status is PluginUpdateStatus.Update) {
|
||||||
hasUpdate = true
|
hasUpdate = true
|
||||||
|
|
||||||
|
if (KotlinInternalMode.enabled) {
|
||||||
|
super.submit(events, additionalInfo, parentComponent, consumer)
|
||||||
|
}
|
||||||
|
|
||||||
val rc = Messages.showDialog(parentComponent,
|
val rc = Messages.showDialog(parentComponent,
|
||||||
"You're running Kotlin plugin version ${KotlinPluginUtil.getPluginVersion()}, " +
|
"You're running Kotlin plugin version ${KotlinPluginUtil.getPluginVersion()}, " +
|
||||||
"while the latest version is ${status.pluginDescriptor.version}",
|
"while the latest version is ${status.pluginDescriptor.version}",
|
||||||
"Update Kotlin Plugin",
|
"Update Kotlin Plugin",
|
||||||
arrayOf("Update", "Ignore"),
|
arrayOf("Update", "Ignore"),
|
||||||
0, Messages.getInformationIcon())
|
0, Messages.getInformationIcon())
|
||||||
|
|||||||
Reference in New Issue
Block a user