Skip to content

Commit

Permalink
feat-2.6
Browse files Browse the repository at this point in the history
  • Loading branch information
rookie-ricardo committed Nov 16, 2024
1 parent 1dd422b commit 8586505
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 39 deletions.
52 changes: 35 additions & 17 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
plugins {
id 'org.jetbrains.intellij' version '1.3.0'
id("org.jetbrains.intellij.platform") version "2.1.0"
id("org.jetbrains.changelog") version "2.1.0"
id 'java'
}

Expand All @@ -12,30 +13,41 @@ tasks.withType(Javadoc) {
}

group 'org.rookie.plugins'
version '2.5'
version '2.6'

sourceCompatibility = 1.8

repositories {
mavenCentral()
mavenLocal()
google()
maven{ url 'https://maven.aliyun.com/repository/gradle-plugin'}
intellijPlatform {
defaultRepositories()
}
}

dependencies {
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.2'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.2'
intellijPlatform {
create("IC", "2024.2")
bundledPlugin('com.intellij.java')
pluginVerifier()
zipSigner()
instrumentationTools()
}
}
intellijPlatform {

// See https://github.com/JetBrains/gradle-intellij-plugin/
intellij {
version = '2021.3'
plugins = ['com.intellij.java']
updateSinceUntilBuild = false
}
patchPluginXml {
changeNotes = """
pluginConfiguration {
name = "BeanMappingKey"
version = '2.6'

ideaVersion {
sinceBuild = "242"
untilBuild = provider { null }
}

changeNotes = """
2.6 (2024-11-16) <br>
<ul>
<li>Upgrade IntelliJ Platform 2.X, remove expired APIs, and support IDEA 2024.2+ for JDK21.</li>
</ul>
2.5 (2022-12-02) <br>
<ul>
<li>Support all subsequent versions without updating</li>
Expand Down Expand Up @@ -78,8 +90,14 @@ patchPluginXml {
<li>The first version has been developed and supports three code generation modes.</li>
</ul>
"""
}


sinceBuild = "201"
pluginVerification {
ides {
recommended()
}
}
}
test {
useJUnitPlatform()
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
systemProp.http.proxyHost=mirrors.neusoft.edu.cn
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.rookie.plugins.action;

import com.intellij.openapi.actionSystem.ActionUpdateThread;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.PlatformDataKeys;
Expand Down Expand Up @@ -46,4 +47,9 @@ private boolean isEffective(AnActionEvent e) {

return !StringUtils.isBlank(selectedText);
}

@Override
public @NotNull ActionUpdateThread getActionUpdateThread() {
return ActionUpdateThread.BGT;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public class BeanMappingJavaDelegate implements BeanMappingDelegate {
private static final String INFO_MSG = "BeanMapping : 已复制到粘贴板 (Copied to pasteboard) !";
private static final String ERROR_MSG = "BeanMapping : 当前所选对象不支持 (The currently selected object is not supported)";
private boolean isSuccessful = true;
private IntellijNotifyUtil notifyUtil = new IntellijNotifyUtil();

@Override
public void exec(AnActionEvent e) {
Expand Down Expand Up @@ -331,20 +332,20 @@ private void doPsiParameterImpl(PsiParameterImpl parameter) {
}

private boolean isNotAvailablePsiMethod(PsiMethod psiMethod) {
if (psiMethod.getParameterList().isEmpty() || PsiType.VOID.equals(psiMethod.getReturnType())) {
if (psiMethod.getParameterList().isEmpty() || PsiTypes.voidType().equals(psiMethod.getReturnType())) {
doErrorNotify(psiMethod.getProject());
return true;
}
return false;
}

private void doInfoNotify(Project project) {
IntellijNotifyUtil.notifyInfo(project, INFO_MSG);
notifyUtil.notifyInfo(project, INFO_MSG);
}

private void doErrorNotify(Project project) {
this.isSuccessful = false;
IntellijNotifyUtil.notifyError(project, ERROR_MSG);
notifyUtil.notifyError(project, ERROR_MSG);
}

}
24 changes: 11 additions & 13 deletions src/main/java/org/rookie/plugins/utils/IntellijNotifyUtil.java
Original file line number Diff line number Diff line change
@@ -1,29 +1,27 @@
package org.rookie.plugins.utils;

import com.intellij.notification.NotificationDisplayType;
import com.intellij.notification.NotificationGroup;
import com.intellij.notification.NotificationGroupManager;
import com.intellij.notification.NotificationType;
import com.intellij.openapi.project.Project;
import org.jetbrains.annotations.Nullable;

public class IntellijNotifyUtil {

private static final NotificationGroup NOTIFICATION_GROUP =
new NotificationGroup("BeanMappingKeyNotification",
NotificationDisplayType.BALLOON, true);
private NotificationGroup getNotificationGroup() {
return NotificationGroupManager.getInstance()
.getNotificationGroup("BeanMappingKeyNotification");
}

public static void notifyError(@Nullable Project project, String content) {
// 2020.3 before
NOTIFICATION_GROUP.createNotification(content, NotificationType.ERROR).notify(project);
public void notifyError(@Nullable Project project, String content) {
getNotificationGroup().createNotification(content, NotificationType.ERROR).notify(project);
}

public static void notifyWarning(@Nullable Project project, String content) {
// 2020.3 before
NOTIFICATION_GROUP.createNotification(content, NotificationType.WARNING).notify(project);
public void notifyWarning(@Nullable Project project, String content) {
getNotificationGroup().createNotification(content, NotificationType.WARNING).notify(project);
}

public static void notifyInfo(@Nullable Project project, String content) {
// 2020.3 before
NOTIFICATION_GROUP.createNotification(content, NotificationType.INFORMATION).notify(project);
public void notifyInfo(@Nullable Project project, String content) {
getNotificationGroup().createNotification(content, NotificationType.INFORMATION).notify(project);
}
}
9 changes: 4 additions & 5 deletions src/main/resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<idea-plugin>
<idea-plugin require-restart="false">
<id>org.rookie.plugins.BeanMappingKey</id>
<name>BeanMappingKey</name>
<vendor email="[email protected]" url="https://github.com/rookie-ricardo">Rookie</vendor>
Expand Down Expand Up @@ -26,7 +26,9 @@
<depends>com.intellij.modules.java</depends>

<extensions defaultExtensionNs="com.intellij">
<!-- Add your extensions here -->
<notificationGroup id="BeanMappingKeyNotification"
displayType="BALLOON"
key="notification.group.name"/>
</extensions>

<actions>
Expand All @@ -40,7 +42,4 @@
<keyboard-shortcut keymap="Mac OS X 10.5+" first-keystroke="ctrl alt M"/>
</action>
</actions>

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

</idea-plugin>

0 comments on commit 8586505

Please sign in to comment.