Skip to content

Commit

Permalink
Merge pull request #123 from leinardi/old-edt
Browse files Browse the repository at this point in the history
Fix #120: Defined action update thread for actions
  • Loading branch information
leinardi authored Oct 5, 2024
2 parents ef091d7 + 64a2d71 commit f81e52e
Show file tree
Hide file tree
Showing 25 changed files with 172 additions and 52 deletions.
26 changes: 16 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@ on:
paths-ignore:
- '**.md'
workflow_dispatch:
branches:
- master

# This allows a subsequently queued workflow run to interrupt previous runs
concurrency:
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
cancel-in-progress: true

jobs:
build:
Expand All @@ -24,13 +27,18 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup JDK 11
uses: actions/setup-java@v2
- name: Setup JDK
uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: 11
distribution: 'temurin'
java-version: 17.0.10

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4

- name: Copy CI gradle.properties
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties
Expand All @@ -40,6 +48,4 @@ jobs:

## Actual task
- name: Check and build
uses: gradle/gradle-build-action@v2
with:
arguments: check buildPlugin
run: ./gradlew check buildPlugin
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
**[0.16.3] 2024-10-04**

- Fixed #120: Defined action update thread for actions (thanks @dw-0 for the help!)
- New: Min IDEA version raised from PC-2022.1.4 to PC-2023.3.6
- Several dependency updates

**[0.16.2] 2023-10-16**

- Fix compatibility issues
Expand Down
14 changes: 7 additions & 7 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ buildscript {
}

plugins {
id 'org.jetbrains.intellij' version '1.15.0'
id 'net.ltgt.errorprone' version '3.1.0'
id 'org.jetbrains.intellij' version '1.17.4'
id 'net.ltgt.errorprone' version '4.0.1'
id 'idea'
id 'java'
id 'checkstyle'
id 'com.github.ben-manes.versions' version '0.47.0'
id 'com.github.ben-manes.versions' version '0.51.0'
id 'se.bjurr.violations.violation-comments-to-github-gradle-plugin' version '1.70.0'
}

Expand All @@ -64,8 +64,8 @@ gradle.projectsEvaluated {
group 'com.leinardi.pycharm'
version version

sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17

intellij {
version = ideVersion
Expand Down Expand Up @@ -117,7 +117,7 @@ dependencies {
if (hasPycharmPath) {
compileOnly name: 'pycharm'
}
errorprone 'com.google.errorprone:error_prone_core:2.21.1'
errorprone 'com.google.errorprone:error_prone_core:2.30.0'
}

def getChangelogHtml() {
Expand Down Expand Up @@ -147,6 +147,6 @@ task violationCommentsToGitHub(type: ViolationCommentsToGitHubTask) {
}

wrapper {
gradleVersion = "8.2.1"
gradleVersion = "8.10.2"
distributionType = Wrapper.DistributionType.ALL
}
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
# limitations under the License.
#
version=0.16.2
ideVersion=PC-2022.1.4
ideVersion=PC-2023.3.6
pythonPlugin=python-ce
sinceBuild=221.6008
sinceBuild=233.15325
untilBuild=
downloadIdeaSources=true
publishUsername=leinardi
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
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-8.2.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
22 changes: 13 additions & 9 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#

##############################################################################
#
Expand Down Expand Up @@ -55,7 +57,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand Down Expand Up @@ -83,7 +85,9 @@ done
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
' "$PWD" ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down Expand Up @@ -144,15 +148,15 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down Expand Up @@ -201,11 +205,11 @@ fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.

set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
Expand Down
22 changes: 12 additions & 10 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem

@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
Expand Down Expand Up @@ -43,11 +45,11 @@ set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand All @@ -57,11 +59,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto execute

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package com.leinardi.pycharm.mypy.actions;

import com.intellij.openapi.actionSystem.ActionUpdateThread;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.Presentation;
import com.intellij.openapi.diagnostic.Logger;
Expand All @@ -42,6 +43,11 @@ public abstract class BaseAction extends DumbAwareAction {

private static final Logger LOG = Logger.getInstance(BaseAction.class);

@Override
public @NotNull ActionUpdateThread getActionUpdateThread() {
return ActionUpdateThread.EDT;
}

@Override
public void update(final @NotNull AnActionEvent event) {
try {
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/com/leinardi/pycharm/mypy/actions/ClearAll.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Modifications:
* - 2024-10-03: Modified by Dominik Willner to fix ActionUpdateThread deprecation warnings.
*/

package com.leinardi.pycharm.mypy.actions;
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/com/leinardi/pycharm/mypy/actions/Close.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Modifications:
* - 2024-10-03: Modified by Dominik Willner to fix ActionUpdateThread deprecation warnings.
*/

package com.leinardi.pycharm.mypy.actions;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Modifications:
* - 2024-10-03: Modified by Dominik Willner to fix ActionUpdateThread deprecation warnings.
*/

package com.leinardi.pycharm.mypy.actions;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,14 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Modifications:
* - 2024-10-03: Modified by Dominik Willner to fix ActionUpdateThread deprecation warnings.
*/

package com.leinardi.pycharm.mypy.actions;

import com.intellij.openapi.actionSystem.ActionUpdateThread;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.project.DumbAwareToggleAction;
import com.intellij.openapi.project.Project;
Expand All @@ -33,6 +37,11 @@
*/
public class DisplayErrors extends DumbAwareToggleAction {

@Override
public @NotNull ActionUpdateThread getActionUpdateThread() {
return ActionUpdateThread.EDT;
}

@Override
public boolean isSelected(final @NotNull AnActionEvent event) {
final Project project = getEventProject(event);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,14 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Modifications:
* - 2024-10-03: Modified by Dominik Willner to fix ActionUpdateThread deprecation warnings.
*/

package com.leinardi.pycharm.mypy.actions;

import com.intellij.openapi.actionSystem.ActionUpdateThread;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.PlatformDataKeys;
import com.intellij.openapi.project.DumbAwareToggleAction;
Expand All @@ -34,6 +38,11 @@
*/
public class DisplayNote extends DumbAwareToggleAction {

@Override
public @NotNull ActionUpdateThread getActionUpdateThread() {
return ActionUpdateThread.EDT;
}

@Override
public boolean isSelected(final AnActionEvent event) {
final Project project = PlatformDataKeys.PROJECT.getData(event.getDataContext());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,14 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Modifications:
* - 2024-10-03: Modified by Dominik Willner to fix ActionUpdateThread deprecation warnings.
*/

package com.leinardi.pycharm.mypy.actions;

import com.intellij.openapi.actionSystem.ActionUpdateThread;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.project.DumbAwareToggleAction;
import com.intellij.openapi.project.Project;
Expand All @@ -33,6 +37,11 @@
*/
public class DisplayWarnings extends DumbAwareToggleAction {

@Override
public @NotNull ActionUpdateThread getActionUpdateThread() {
return ActionUpdateThread.EDT;
}

@Override
public boolean isSelected(final @NotNull AnActionEvent event) {
final Project project = getEventProject(event);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Modifications:
* - 2024-10-03: Modified by Dominik Willner to fix ActionUpdateThread deprecation warnings.
*/

package com.leinardi.pycharm.mypy.actions;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,14 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Modifications:
* - 2024-10-03: Modified by Dominik Willner to fix ActionUpdateThread deprecation warnings.
*/

package com.leinardi.pycharm.mypy.actions;

import com.intellij.openapi.actionSystem.ActionUpdateThread;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.Presentation;
import com.intellij.openapi.diagnostic.Logger;
Expand All @@ -39,6 +43,11 @@ public class ScanCurrentChangeList extends BaseAction {

private static final Logger LOG = Logger.getInstance(ScanCurrentChangeList.class);

@Override
public @NotNull ActionUpdateThread getActionUpdateThread() {
return ActionUpdateThread.BGT;
}

@Override
public final void actionPerformed(final @NotNull AnActionEvent event) {
project(event).ifPresent(project -> {
Expand Down
Loading

0 comments on commit f81e52e

Please sign in to comment.