-
-
Notifications
You must be signed in to change notification settings - Fork 793
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
103 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,14 @@ | ||
# suppress inspection "UnusedProperty" for whole file | ||
version=2.7.2 | ||
version=2.7.3 | ||
buildNumber= | ||
#buildNumber=SNAPSHOT | ||
ideaVersion=IU-2017.1 | ||
javaVersion=1.8 | ||
javaTargetVersion=1.8 | ||
kotlinLanguageVersion=1.3 | ||
kotlinTargetVersion=1.1 | ||
sources=false | ||
customSinceBuild=171 | ||
customUntilBuild= | ||
customUntilBuild=201.* | ||
kotlin.code.style=official | ||
org.gradle.jvmargs='-Dfile.encoding=UTF-8' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
src/main/kotlin/cn/yiiguxing/plugin/translate/activity/IdeaVersionUpgradeNoticeActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package cn.yiiguxing.plugin.translate.activity | ||
|
||
import cn.yiiguxing.plugin.translate.message | ||
import cn.yiiguxing.plugin.translate.util.Application | ||
import cn.yiiguxing.plugin.translate.util.IdeVersion | ||
import cn.yiiguxing.plugin.translate.util.show | ||
import com.intellij.ide.util.PropertiesComponent | ||
import com.intellij.notification.* | ||
import com.intellij.openapi.actionSystem.AnActionEvent | ||
import com.intellij.openapi.project.DumbAware | ||
import com.intellij.openapi.project.Project | ||
import com.intellij.openapi.startup.StartupActivity | ||
|
||
class IdeaVersionUpgradeNoticeActivity : StartupActivity, DumbAware { | ||
|
||
private var veryFirstProjectOpening: Boolean = true | ||
|
||
override fun runActivity(project: Project) { | ||
if (IdeVersion.isIde2019OrNewer | ||
|| !veryFirstProjectOpening | ||
|| Application.isUnitTestMode | ||
|| PropertiesComponent.getInstance().getBoolean(DO_NOT_NOTIFY_AGAIN_PROPERTY, false) | ||
) { | ||
return | ||
} | ||
|
||
println(DO_NOT_NOTIFY_AGAIN_PROPERTY) | ||
|
||
veryFirstProjectOpening = false | ||
Activity.runLater(project, 3) { | ||
showNotification(project) | ||
} | ||
} | ||
|
||
private class DoNotShowAgainAction : NotificationAction(message("notification.idea.version.do.not.show.again")) { | ||
override fun actionPerformed(e: AnActionEvent, notification: Notification) { | ||
notification.expire() | ||
PropertiesComponent.getInstance().setValue(DO_NOT_NOTIFY_AGAIN_PROPERTY, true) | ||
} | ||
} | ||
|
||
companion object { | ||
private const val DISPLAY_ID = "Outdated IDE Version" | ||
|
||
private val DO_NOT_NOTIFY_AGAIN_PROPERTY = | ||
"yii.guxing.translate.IdeaVersionUpgradeNotice.${IdeVersion.buildNumber}.disable" | ||
|
||
private fun showNotification(project: Project) { | ||
NotificationGroup(DISPLAY_ID, NotificationDisplayType.STICKY_BALLOON, false) | ||
.createNotification( | ||
message("notification.idea.version.title"), | ||
message("notification.idea.version"), | ||
NotificationType.WARNING, | ||
null | ||
) | ||
.addAction(DoNotShowAgainAction()) | ||
.setImportant(true) | ||
.show(project) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 5 additions & 1 deletion
6
src/main/kotlin/cn/yiiguxing/plugin/translate/util/IdeVersion.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters