Skip to content

2080: thread context was already set fix #2550

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 22 commits into
base: 5.4.0-develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 40 additions & 2 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,50 @@ jobs:
run: chmod +x gradlew
- id: file_changes
uses: trilom/file-changes-action@v1.2.4
- name: Filter Java Files
id: filter_java_files
run: |
# Get modified and added files
MODIFIED_FILES=${{ steps.file_changes.outputs.files_modified }}
ADDED_FILES=${{ steps.file_changes.outputs.files_added }}

echo "Modified files: $MODIFIED_FILES"
echo "Added files: $ADDED_FILES"

# Simple approach using shell commands to filter Java files
# Remove brackets and quotes from the JSON arrays
MODIFIED_FILES=$(echo "$MODIFIED_FILES" | sed 's/^\[//;s/\]$//;s/"//g;s/,/ /g')
ADDED_FILES=$(echo "$ADDED_FILES" | sed 's/^\[//;s/\]$//;s/"//g;s/,/ /g')

# Combine the files and filter for .java files
ALL_FILES="$MODIFIED_FILES $ADDED_FILES"
JAVA_FILES=""

# If there are files to process
if [ ! -z "$ALL_FILES" ]; then
# Filter for Java files and format as JSON array
for file in $ALL_FILES; do
if [[ "$file" == *.java ]]; then
if [ -z "$JAVA_FILES" ]; then
JAVA_FILES="\"$file\""
else
JAVA_FILES="$JAVA_FILES,\"$file\""
fi
fi
done
fi

# Create a proper JSON array
JAVA_FILES="[$JAVA_FILES]"

echo "JAVA_FILES=$JAVA_FILES" >> $GITHUB_ENV
echo "Filtered Java Files: $JAVA_FILES"
- name: Run Code Style Check
run: ./gradlew checkstyleCI --no-daemon
env:
MODIFIED_FILES: ${{ steps.file_changes.outputs.files}}
MODIFIED_FILES: ${{ env.JAVA_FILES }}
ACTIONS_STEP_DEBUG: true
- name: Run PMD Quality Check
run: ./gradlew pmdCI --no-daemon
env:
MODIFIED_FILES: ${{ steps.file_changes.outputs.files}}
MODIFIED_FILES: ${{ env.JAVA_FILES }}
22 changes: 8 additions & 14 deletions .github/workflows/uitests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,17 +68,11 @@ jobs:
export DISPLAY=:99.0
./gradlew test -PexcludeTests="**/reference/**,**/linemarker/**,**/inspections/**,**/completion/**,**/actions/**"

# Uncomment if investigation is needed:
#
# - name: Capture Test Artifacts on Failure
# if: failure() && matrix.os == 'ubuntu-latest'
# run: tar -cvzf video.tgz ./video
# shell: bash
#
# - name: Upload Test Video Artifact
# if: failure() && matrix.os == 'ubuntu-latest'
# uses: actions/upload-artifact@v4
# with:
# name: latest-test-video
# path: video.tgz
# overwrite: true
#Uncomment if investigation is needed:
- name: Upload Test Video Artifact
if: failure() && matrix.os == 'ubuntu-latest'
uses: actions/upload-artifact@v4
with:
name: latest-test-video
path: ./video
overwrite: true
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0).

## 2025.2.0

## 2025.1.1

### Fixed
Expand Down
6 changes: 3 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ repositories {

intellijPlatform {
defaultRepositories()
maven("https://www.jetbrains.com/intellij-repository/snapshots")
}
}

Expand All @@ -51,12 +52,9 @@ dependencies {

bundledPlugins(providers.gradleProperty("platformBundledPlugins").map { it.split(',') })
plugins(providers.gradleProperty("platformPlugins").map { it.split(',') })
plugin("com.intellij.lang.jsgraphql", "243.21565.122")
pluginVerifier()
zipSigner()
testFramework(TestFrameworkType.Platform)

phpstorm("2024.3")
}
}

Expand Down Expand Up @@ -174,6 +172,8 @@ intellijPlatformTesting {
"-Dide.mac.message.dialogs.as.sheets=false",
"-Djb.privacy.policy.text=<!--999.999-->",
"-Djb.consents.confirmation.enabled=false",
"-Deap.require.license=true",
"-Dide.show.tips.on.startup.default.value=false"
)
}
}
Expand Down
11 changes: 11 additions & 0 deletions check_modified.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

# Get the list of modified files
MODIFIED_FILES=$(git diff --name-only HEAD | grep -E '\.java$' | sed 's/^/"/;s/$/"/' | tr '\n' ',' | sed 's/,$//')
MODIFIED_FILES="[$MODIFIED_FILES]"

# Export the environment variable
export MODIFIED_FILES

# Run the checkstyle and PMD tasks
./gradlew checkstyleCI pmdCI
8 changes: 4 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
pluginGroup = com.magento.idea.magento2plugin
pluginName = Magento PhpStorm
pluginRepositoryUrl = https://github.com/magento/magento2-phpstorm-plugin
pluginVersion = 2025.1.1
pluginSinceBuild = 243.3
pluginVersion = 2025.2.0
pluginSinceBuild = 251.*
pluginUntilBuild = 258.*
platformType = PS
platformVersion = 2024.3
platformPlugins =
platformVersion = 252.18003.43
platformPlugins = com.intellij.lang.jsgraphql:252.18003.27
platformBundledPlugins = com.intellij.modules.json,com.jetbrains.php,JavaScript,com.intellij.copyright
gradleVersion = 8.10.2
kotlin.stdlib.default.dependency = false
Expand Down
4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ junit = "4.13.2"

# plugins
changelog = "2.2.1"
intelliJPlatform = "2.4.0"
kotlin = "1.9.25"
intelliJPlatform = "2.6.0"
kotlin = "2.1.0"
kover = "0.8.3"
qodana = "2024.2.3"

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
package com.magento.idea.magento2plugin.actions.generation.dialog;

import com.intellij.openapi.application.WriteAction;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.DialogWrapper;
import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.util.Pair;
import com.magento.idea.magento2plugin.actions.generation.data.ui.ComboBoxItemData;
import com.magento.idea.magento2plugin.actions.generation.dialog.prompt.PlaceholderInitializerUtil;
Expand All @@ -17,29 +20,26 @@
import com.magento.idea.magento2plugin.bundles.CommonBundle;
import com.magento.idea.magento2plugin.bundles.ValidatorBundle;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Toolkit;
import java.awt.event.ComponentEvent;
import java.awt.event.ComponentListener;
import java.lang.reflect.Field;
import java.util.LinkedList;
import java.util.List;
import javax.swing.JComboBox;
import javax.swing.JComponent;
import javax.swing.JDialog;
import javax.swing.JOptionPane;
import javax.swing.JTabbedPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

/**
* All code generate dialog should extend this class.
*/
@SuppressWarnings({
"PMD.TooManyMethods"
})
public abstract class AbstractDialog extends JDialog {
public abstract class AbstractDialog extends DialogWrapper {

protected transient CommonBundle bundle;
protected final transient ValidatorBundle validatorBundle = new ValidatorBundle();
Expand All @@ -50,21 +50,54 @@ public abstract class AbstractDialog extends JDialog {

/**
* Abstract Dialog Constructor.
*
* @param project Project
*/
public AbstractDialog() {
super();
public AbstractDialog(final @Nullable Project project) {
super(project, true);
bundle = new CommonBundle();
errorTitle = bundle.message("common.error");
fieldsValidationsList = new TypeFieldsRulesParser(this).parseValidationRules();
init();
}

/**
* Abstract Dialog Constructor without project.
*/
public AbstractDialog() {
this(null);
}

/**
* Center the dialog on the screen.
* Note: This is handled automatically by DialogWrapper,
* so this method is kept for compatibility.
*
* @param dialog AbstractDialog
* @deprecated This method is no longer needed as DialogWrapper handles centering automatically.
* It is kept for backward compatibility with existing code.
*/
@Deprecated
@SuppressWarnings({
"PMD.UncommentedEmptyMethod",
"PMD.EmptyMethodInAbstractClassShouldBeAbstract"
})
protected void centerDialog(final AbstractDialog dialog) {
final Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
final int coordinateX = screenSize.width / 2 - dialog.getSize().width / 2;
final int coordinateY = screenSize.height / 2 - dialog.getSize().height / 2;
dialog.setLocation(coordinateX, coordinateY);
// DialogWrapper handles centering automatically
// This method is intentionally left with minimal implementation
// as it's deprecated and only kept for backward compatibility
}

/**
* Create the center panel for the dialog.
* This method must be implemented by subclasses to provide the content panel.
*
* @return JComponent
*/
@Nullable
@Override
protected abstract JComponent createCenterPanel();

/**
* Default on cancel action.
*/
Expand All @@ -76,7 +109,7 @@ protected void onCancel() {
* Right way to hide dialog window.
*/
protected void exit() {
dispose();
close(CANCEL_EXIT_CODE);
}

/**
Expand All @@ -102,6 +135,24 @@ protected final void onOK() {
}
}

/**
* Called when the OK button is pressed.
* This method is called by DialogWrapper.
*/
@Override
public void doOKAction() {
onOK();
}

/**
* Called when the Cancel button is pressed.
* This method is called by DialogWrapper.
*/
@Override
public void doCancelAction() {
onCancel();
}

/**
* Validate all form fields.
*
Expand All @@ -113,8 +164,8 @@ protected final void onOK() {
"PMD.CognitiveComplexity"
})
protected boolean validateFormFields() {
boolean dialogHasErrors;
isValidationErrorShown = dialogHasErrors = false;
boolean dialogHasErrors = false;
isValidationErrorShown = false;
clearValidationHighlighting();

for (final FieldValidationData fieldValidationData : getFieldsToValidate()) {
Expand Down Expand Up @@ -217,11 +268,10 @@ protected void showErrorMessage(final String errorMessage) {
if (isValidationErrorShown) {
return;
}
JOptionPane.showMessageDialog(
this,
Messages.showErrorDialog(
getContentPanel(),
errorMessage,
errorTitle,
JOptionPane.ERROR_MESSAGE
errorTitle
);
isValidationErrorShown = true;
}
Expand Down Expand Up @@ -302,10 +352,13 @@ private int getParentTabPaneForComponent(final @NotNull Container component) {
return getParentTabPaneForComponent(parent);
}

@Override
public void setVisible(final boolean status) {
/**
* Show the dialog.
* This method should be used instead of setVisible(true).
*/
public void showDialog() {
new PlaceholderInitializerUtil(this).initialize();
super.setVisible(status);
show();
}

/**
Expand All @@ -317,7 +370,7 @@ public void setVisible(final boolean status) {
* <p>1) specify method in which desired field is focused:</p><br/>
* <pre>
* public void focusOnTheSampleField() {
* sampleField.requestFocusInWindow();
* sampleField.requestFocus();
* }
* </pre>
*
Expand All @@ -327,8 +380,6 @@ public void setVisible(final boolean status) {
* new FocusOnAFieldListener(this::focusOnTheSampleField)
* )
* </pre>
*
* @see #requestFocusInWindow()
*/
public static final class FocusOnAFieldListener implements ComponentListener {

Expand Down
Loading
Loading