diff --git a/build.gradle b/build.gradle
index 96d150c..6ab645f 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,10 +1,10 @@
plugins {
id 'java'
- id 'org.jetbrains.intellij' version '0.6.5'
+ id 'org.jetbrains.intellij' version '1.9.0'
}
group 'ch.repnik'
-version '1.1.2'
+version '1.2.0'
repositories {
mavenCentral()
@@ -12,13 +12,14 @@ repositories {
dependencies {
testImplementation 'org.hamcrest:hamcrest:2.2'
- testImplementation 'org.junit.jupiter:junit-jupiter-api:5.6.2'
- testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.6.2'
+ testImplementation 'org.junit.jupiter:junit-jupiter-api:5.9.0'
+ testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.9.0'
+ testRuntimeOnly 'org.junit.platform:junit-platform-launcher:1.9.0'
}
java {
- sourceCompatibility = JavaVersion.VERSION_11
- targetCompatibility = JavaVersion.VERSION_11
+ sourceCompatibility = JavaVersion.VERSION_17
+ targetCompatibility = JavaVersion.VERSION_17
}
test {
@@ -30,16 +31,17 @@ test {
// See https://github.com/JetBrains/gradle-intellij-plugin/
intellij {
- version '2021.2'
+ version.set('2022.2.2')
plugins = ['git4idea']
}
runPluginVerifier{
- ideVersions = ["IC-2021.2"]
+ ideVersions = ["IC-2022.2.2"]
}
patchPluginXml {
- untilBuild null
+ sinceBuild.set("222")
+ untilBuild.set(null)
}
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index a4b4429..ae04661 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
diff --git a/src/main/java/ch/repnik/intellij/CommitPrefixCheckinHandler.java b/src/main/java/ch/repnik/intellij/CommitPrefixCheckinHandler.java
index c86deae..a47233e 100644
--- a/src/main/java/ch/repnik/intellij/CommitPrefixCheckinHandler.java
+++ b/src/main/java/ch/repnik/intellij/CommitPrefixCheckinHandler.java
@@ -1,6 +1,7 @@
package ch.repnik.intellij;
import ch.repnik.intellij.settings.PluginSettings;
+import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vcs.BranchChangeListener;
@@ -15,6 +16,7 @@
import git4idea.GitLocalBranch;
import git4idea.branch.GitBranchUtil;
import git4idea.repo.GitRepository;
+import git4idea.status.GitRefreshListener;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -22,38 +24,37 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-public class CommitPrefixCheckinHandler extends CheckinHandler implements BranchChangeListener {
+public class CommitPrefixCheckinHandler extends CheckinHandler implements BranchChangeListener, GitRefreshListener {
private final Logger log = Logger.getInstance(getClass());
- private CheckinProjectPanel panel;
+ private final CheckinProjectPanel panel;
private static final Pattern branchNamePattern = Pattern.compile("(?<=\\/)*([A-Z0-9]+-[0-9]+)");
private static final Pattern prefixPattern = Pattern.compile("[A-Z0-9]+-[0-9]+");
-
- private String newCommitMessage;
-
-
public CommitPrefixCheckinHandler(CheckinProjectPanel panel) {
this.panel = panel;
MessageBusConnection connect = panel.getProject().getMessageBus().connect();
connect.subscribe(BranchChangeListener.VCS_BRANCH_CHANGED, this);
+ connect.subscribe(GitRefreshListener.TOPIC, this);
//Sets the new message on the new commit UI
updateCommitMessage();
}
private void updateCommitMessage(){
- PsiDocumentManager psiInstance = PsiDocumentManager.getInstance(this.panel.getProject());
- if (psiInstance instanceof PsiDocumentManagerImpl){
- if (!((PsiDocumentManagerImpl) psiInstance).isCommitInProgress()){
- panel.setCommitMessage(getNewCommitMessage());
+ ApplicationManager.getApplication().invokeLater(() -> {
+ PsiDocumentManager psiInstance = PsiDocumentManager.getInstance(this.panel.getProject());
+ if (psiInstance instanceof PsiDocumentManagerImpl){
+ if (!((PsiDocumentManagerImpl) psiInstance).isCommitInProgress()){
+ panel.setCommitMessage(getNewCommitMessage());
+ }else{
+ log.info("PsiDocumentManager reported commit in progress. Skipping Git Auto Prefix");
+ }
}else{
- log.info("PsiDocumentManager reported commit in progress. Skipping Git Auto Prefix");
+ log.info("PsiDocumentManager is not an instance of PsiDocumentManagerImpl. Skipping Git Auto Prefix");
}
- }else{
- log.info("PsiDocumentManager is not an instance of PsiDocumentManagerImpl. Skipping Git Auto Prefix");
- }
+ });
}
@Nullable
@@ -71,9 +72,8 @@ private String getNewCommitMessage(){
Optional
+
+
Commit prefix (with delimiter) | Commit prefix (wrapped) | +|
---|---|---|
main | +no action | +no action | +
master | no action | @@ -66,7 +80,7 @@