Skip to content

Commit

Permalink
bugfix for compability issue caused by stupid Kotlin.
Browse files Browse the repository at this point in the history
version change to 2.0.1.1x for making version checkers think it is a version later than 2.0.1
  • Loading branch information
XenoAmess committed Apr 10, 2020
1 parent 11231ab commit 9211f75
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 19 deletions.
2 changes: 1 addition & 1 deletion idea-plugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ allprojects {

dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
testCompile group: 'junit', name: 'junit', version: '4.11'
testCompile group: 'junit', name: 'junit', version: '4.13'
}
}

2 changes: 1 addition & 1 deletion idea-plugin/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ idea_version=IU-201.6668.121
plugin_name=Alibaba Java Coding Guidelines
gradle_jetbrains_version=0.4.16
systemProp.file.encoding=UTF-8
plugin_version=2.0.1.x1
plugin_version=2.0.1.1x
8 changes: 6 additions & 2 deletions idea-plugin/p3c-common/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
plugins {
id 'java'
id "org.jetbrains.intellij" version "0.4.16"
id "org.jetbrains.intellij" version "0.4.18"

// id 'application'
id 'maven'
id "com.github.ben-manes.versions" version "0.28.0"
}
apply plugin: 'kotlin'
apply plugin: 'idea'
Expand Down Expand Up @@ -47,7 +51,7 @@ ext.isReleaseVersion = !version.endsWith("SNAPSHOT")

dependencies {
compile group: 'org.freemarker', name: 'freemarker', version: '2.3.25-incubating'
compile 'com.alibaba.p3c:p3c-pmd:2.0.1.x1'
compile 'com.alibaba.p3c:p3c-pmd:2.0.1.1x'
compile group: 'org.javassist', name: 'javassist', version: '3.21.0-GA'
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import com.intellij.openapi.progress.ProcessCanceledException
import com.intellij.openapi.project.Project
import com.intellij.openapi.project.ProjectManager
import com.intellij.openapi.ui.Messages
import org.apache.http.MethodNotSupportedException
import java.awt.Component
import java.net.UnknownHostException

Expand All @@ -34,10 +35,10 @@ import java.net.UnknownHostException
*/
object BalloonNotifications {
val displayId = "SmartFox Intellij IDEA Balloon Notification"
val balloonGroup = NotificationGroup(displayId, NotificationDisplayType.BALLOON, true)
val balloonGroup = buildNotificationGroup(displayId, NotificationDisplayType.BALLOON, true)

val stickyBalloonDisplayId = "SmartFox Intellij IDEA Notification"
val stickyBalloonGroup = NotificationGroup(stickyBalloonDisplayId, NotificationDisplayType.STICKY_BALLOON, true)
val stickyBalloonGroup = buildNotificationGroup(stickyBalloonDisplayId, NotificationDisplayType.STICKY_BALLOON, true)
val TITLE = "SmartFox Intellij IDEA Plugin"

fun showInfoDialog(component: Component, title: String, message: String) {
Expand All @@ -56,29 +57,29 @@ object BalloonNotifications {
}

fun showSuccessNotification(message: String, project: Project? = ProjectManager.getInstance().defaultProject,
title: String = TITLE, sticky: Boolean = false) {
title: String = TITLE, sticky: Boolean = false) {
showNotification(message, project, title, NotificationType.INFORMATION, null, sticky)
}

fun showWarnNotification(message: String, project: Project? = ProjectManager.getInstance().defaultProject,
title: String = TITLE, sticky: Boolean = false) {
title: String = TITLE, sticky: Boolean = false) {
showNotification(message, project, title, NotificationType.WARNING, null, sticky)
}

fun showErrorNotification(message: String, project: Project? = ProjectManager.getInstance().defaultProject,
title: String = TITLE, sticky: Boolean = false) {
title: String = TITLE, sticky: Boolean = false) {
showNotification(message, project, title, NotificationType.ERROR, null, sticky)
}

fun showSuccessNotification(message: String, project: Project?,
notificationListener: NotificationListener, title: String = TITLE, sticky: Boolean = false) {
notificationListener: NotificationListener, title: String = TITLE, sticky: Boolean = false) {
showNotification(message, project, title, NotificationType.INFORMATION, notificationListener, sticky)
}

fun showNotification(message: String, project: Project? = ProjectManager.getInstance().defaultProject,
title: String = TITLE,
notificationType: NotificationType = NotificationType.INFORMATION,
notificationListener: NotificationListener? = null, sticky: Boolean = false) {
title: String = TITLE,
notificationType: NotificationType = NotificationType.INFORMATION,
notificationListener: NotificationListener? = null, sticky: Boolean = false) {
val group = if (sticky) {
stickyBalloonGroup
} else {
Expand All @@ -100,7 +101,8 @@ object BalloonNotifications {
}

object LogNotifications {
val group = NotificationGroup(BalloonNotifications.displayId, NotificationDisplayType.NONE, true)

val group = buildNotificationGroup(displayId = BalloonNotifications.displayId, displayType = NotificationDisplayType.NONE, isLogByDefault = true);

fun log(message: String, project: Project? = ProjectManager.getInstance().defaultProject,
title: String = BalloonNotifications.TITLE,
Expand All @@ -109,3 +111,15 @@ object LogNotifications {
group.createNotification(title, message, notificationType, notificationListener).notify(project)
}
}


fun buildNotificationGroup(displayId: String, displayType: NotificationDisplayType, isLogByDefault: Boolean): NotificationGroup {
var notificationGroupClass = Class.forName("com.intellij.notification.NotificationGroup")
notificationGroupClass.constructors.forEach {
if (it.parameters.size == 3) {
return it.newInstance(displayId, displayType, isLogByDefault)
as NotificationGroup;
}
}
throw MethodNotSupportedException("cannot find a suitable constructor for NotificationGroup who accepts [String,NotificationDisplayType,Boolean]");
}
6 changes: 5 additions & 1 deletion idea-plugin/p3c-idea/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
plugins {
id 'java'
id "org.jetbrains.intellij" version "0.4.16"
id "org.jetbrains.intellij" version "0.4.18"

// id 'application'
id 'maven'
id "com.github.ben-manes.versions" version "0.28.0"
}
apply plugin: 'kotlin'
apply plugin: 'idea'
Expand Down
10 changes: 7 additions & 3 deletions idea-plugin/p3c-idea/src/main/resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
<idea-plugin>
<id>com.alibaba.p3c.xenoamess</id>
<name>Alibaba Java Coding Guidelines(XenoAmess TPM)</name>
<vendor
email="[email protected]"
url="https://github.com/XenoAmess"
>XenoAmess</vendor>
<description><![CDATA[
<p><b>Alibaba Java Coding Guidelines plugin support.</b></p>
<br/>
Expand All @@ -25,7 +29,7 @@
<change-notes>
<![CDATA[
<ul>
2.0.1.x1
2.0.1.1x
<li>Fix idea 2020.1 compatibility issue</li>
<li>fix javadoc in p3c-cmd</li>
<li>fix clinic dependency in p3c-cmd</li>
Expand Down Expand Up @@ -97,9 +101,9 @@
</ul>
]]>
</change-notes>
<vendor>XenoAmess</vendor>
<version>2.0.1.x1</version>

<idea-version since-build="145.0"/>

<depends optional="true">com.intellij.velocity</depends>
<depends optional="true" config-file="p3c.xml">com.intellij.modules.java</depends>
<depends>com.intellij.modules.platform</depends>
Expand Down
2 changes: 1 addition & 1 deletion p3c-pmd/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</parent>
<groupId>com.alibaba.p3c</groupId>
<artifactId>p3c-pmd</artifactId>
<version>2.0.1.x1</version>
<version>2.0.1.1x</version>
<packaging>jar</packaging>
<name>p3c-pmd</name>
<properties>
Expand Down

0 comments on commit 9211f75

Please sign in to comment.