diff --git a/.run/Run Plugin.run.xml b/.run/Run Plugin.run.xml new file mode 100644 index 0000000..ce1940e --- /dev/null +++ b/.run/Run Plugin.run.xml @@ -0,0 +1,24 @@ + + + + + + + true + true + false + false + + + \ No newline at end of file diff --git a/build.gradle b/build.gradle index 0ef5f25..eea60f7 100644 --- a/build.gradle +++ b/build.gradle @@ -1,18 +1,21 @@ plugins { - id 'java' - id 'org.jetbrains.intellij' version '0.4.1' + id "org.jetbrains.intellij" version "1.17.2" } group 'com.dmitryzhelnin.intellij.plugin.git.extensions' -version '0.4.4' +version '0.4.5-az' -sourceCompatibility = 1.8 +sourceCompatibility = 17 + +repositories { + mavenCentral() +} dependencies { - testCompile group: 'junit', name: 'junit', version: '4.12' + testImplementation group: 'junit', name: 'junit', version: '4.13.2' } intellij { - intellij.version '2019.3' - intellij.updateSinceUntilBuild false + version = '2022.3' + updateSinceUntilBuild = false } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 115e6ac..b7e059c 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,6 @@ -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.10-bin.zip -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists +#Fri Mar 15 15:33:19 MSK 2024 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/src/main/java/gitextensions/commands/BaseAction.java b/src/main/java/gitextensions/commands/BaseAction.java index dc3bcc8..650d316 100644 --- a/src/main/java/gitextensions/commands/BaseAction.java +++ b/src/main/java/gitextensions/commands/BaseAction.java @@ -1,9 +1,7 @@ package gitextensions.commands; import com.google.common.base.Strings; -import com.intellij.openapi.actionSystem.AnAction; -import com.intellij.openapi.actionSystem.AnActionEvent; -import com.intellij.openapi.actionSystem.PlatformDataKeys; +import com.intellij.openapi.actionSystem.*; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.ui.Messages; import com.intellij.openapi.vfs.VirtualFile; @@ -26,11 +24,15 @@ public BaseAction(@NotNull String command) { this.command = command; } + @Override + public @NotNull ActionUpdateThread getActionUpdateThread() { + return ActionUpdateThread.BGT; //super.getActionUpdateThread(); + } + @Override public void actionPerformed(@NotNull AnActionEvent e) { try { - VirtualFile file = e.getData(PlatformDataKeys.VIRTUAL_FILE); - String fileName = getFileName(file); + String fileName = getFileNameFromEvent(e); if (fileName != null) { GitExtensionsService service = ApplicationManager.getApplication().getService(GitExtensionsService.class); @@ -57,6 +59,12 @@ public void actionPerformed(@NotNull AnActionEvent e) { } } + @Nullable + protected String getFileNameFromEvent(@NotNull AnActionEvent e) { + VirtualFile file = e.getData(PlatformDataKeys.VIRTUAL_FILE); + return getFileName(file); + } + protected String getFileName(@Nullable VirtualFile file) { return file != null ? file.getCanonicalPath() : null; } diff --git a/src/main/java/gitextensions/commands/Browse.java b/src/main/java/gitextensions/commands/Browse.java index fbf41dd..67216d0 100644 --- a/src/main/java/gitextensions/commands/Browse.java +++ b/src/main/java/gitextensions/commands/Browse.java @@ -1,7 +1,26 @@ package gitextensions.commands; +import com.intellij.openapi.actionSystem.AnActionEvent; +import com.intellij.openapi.actionSystem.PlatformDataKeys; +import com.intellij.openapi.project.Project; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + public class Browse extends BaseAction { public Browse() { super(Commands.BROWSE); } + + @Nullable + @Override + protected String getFileNameFromEvent(@NotNull AnActionEvent e) { + String result = super.getFileNameFromEvent(e); + if (result == null) { + Project project = e.getData(PlatformDataKeys.PROJECT); + if (project != null) { + result = project.getBasePath(); + } + } + return result; + } } diff --git a/src/main/resources/META-INF/plugin.xml b/src/main/resources/META-INF/plugin.xml index 53b47ca..7f5591e 100644 --- a/src/main/resources/META-INF/plugin.xml +++ b/src/main/resources/META-INF/plugin.xml @@ -2,7 +2,7 @@ com.dmitryzhelnin.intellij.plugin.gitextensions GitExtensions Dmitry Zhelnin - 0.4.4 + 0.4.5-az GitExtensions application from IDEs based on the IntelliJ platform @@ -11,6 +11,11 @@