Skip to content

Commit 48ae360

Browse files
authored
Merge pull request #2527 from webcreative24/5.4.0-develop
add app/design path
2 parents 4bce544 + 115b4b0 commit 48ae360

File tree

10 files changed

+76
-62
lines changed

10 files changed

+76
-62
lines changed

.github/workflows/uitests.yml

+3-4
Original file line numberDiff line numberDiff line change
@@ -69,17 +69,16 @@ jobs:
6969
./gradlew test -PexcludeTests="**/reference/**,**/linemarker/**,**/inspections/**,**/completion/**,**/actions/**"
7070
7171
# Uncomment if investigation is needed:
72-
72+
#
7373
# - name: Capture Test Artifacts on Failure
74-
# if: failure() && matrix.os == 'windows-latest'
74+
# if: failure() && matrix.os == 'ubuntu-latest'
7575
# run: tar -cvzf video.tgz ./video
7676
# shell: bash
7777
#
7878
# - name: Upload Test Video Artifact
79-
# if: failure() && matrix.os == 'windows-latest'
79+
# if: failure() && matrix.os == 'ubuntu-latest'
8080
# uses: actions/upload-artifact@v4
8181
# with:
8282
# name: latest-test-video
8383
# path: video.tgz
8484
# overwrite: true
85-

CHANGELOG.md

+7
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file.
44

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

7+
## 2025.1.1
8+
9+
### Fixed
10+
11+
- The themes select is empty [#2527](https://github.com/magento/magento2-phpstorm-plugin/pull/2527)
12+
- PS.MarkRootGroup isn't registered so the action won't be added to it [#2527](https://github.com/magento/magento2-phpstorm-plugin/pull/2527)
13+
714
## 2025.1.0
815

916
### Added

README.md

-28
Original file line numberDiff line numberDiff line change
@@ -12,36 +12,8 @@
1212
<strong>PhpStorm IDE Plugin</strong> for a better Magento 2 development workflow.
1313
</caption>
1414
<thead>
15-
<tr style="background-color: #f4f4f4;">
16-
<td colspan="3" style="padding: 10px; font-size: 1.2em;">
17-
<strong>Version 2025.0.0 - Contributors</strong>
18-
</td>
19-
</tr>
2015
</thead>
2116
<tbody>
22-
<tr>
23-
<td align="center" style="padding: 15px;">
24-
<a href="https://github.com/YevhenZvieriev" style="text-decoration: none;">
25-
<img src="https://avatars.githubusercontent.com/u/43544955?v=4" width="120px" height="120px" style="border-radius: 50%;" alt="Yevhen Zvieriev"/>
26-
<br/>
27-
<sub style="font-size: 1em;"><b>Yevhen Zvieriev</b></sub>
28-
</a>
29-
</td>
30-
<td align="center" style="padding: 15px;">
31-
<a href="https://github.com/SilinMykola" style="text-decoration: none;">
32-
<img src="https://avatars.githubusercontent.com/u/15772032?v=4" width="120px" height="120px" style="border-radius: 50%;" alt="Mykola Silin"/>
33-
<br/>
34-
<sub style="font-size: 1em;"><b>Mykola Silin</b></sub>
35-
</a>
36-
</td>
37-
<td align="center" style="padding: 15px;">
38-
<a href="https://github.com/VitaliyBoyko" style="text-decoration: none;">
39-
<img src="https://avatars.githubusercontent.com/u/20116393?v=4" width="120px" height="120px" style="border-radius: 50%;" alt="Vitalii Boiko"/>
40-
<br/>
41-
<sub style="font-size: 1em;"><b>Vitalii Boiko</b></sub>
42-
</a>
43-
</td>
44-
</tr>
4517
</tbody>
4618
<tfoot>
4719
<tr style="background-color: #f9f9f9;">

gradle.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
pluginGroup = com.magento.idea.magento2plugin
22
pluginName = Magento PhpStorm
33
pluginRepositoryUrl = https://github.com/magento/magento2-phpstorm-plugin
4-
pluginVersion = 2025.1.0
4+
pluginVersion = 2025.1.1
55
pluginSinceBuild = 243.3
66
pluginUntilBuild = 258.*
77
platformType = PS

src/main/java/com/magento/idea/magento2plugin/magento/packages/Package.java

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
public class Package { //NOPMD
99
public static final String V_FILE_SEPARATOR = "/";
1010
public static String packagesRoot = "app/code";
11+
public static String packagesDesignRoot = "app/design";
1112
public static String libWebRoot = "lib/web";
1213
public static String frameworkRootComposer = "vendor/magento/framework";
1314
public static String frameworkRootGit = "lib/internal/Magento/Framework";

src/main/java/com/magento/idea/magento2plugin/util/magento/IsFileInEditableModuleUtil.java

+17-20
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import com.intellij.openapi.vfs.VirtualFile;
1010
import com.intellij.psi.PsiFile;
1111
import com.magento.idea.magento2plugin.project.Settings;
12+
import java.util.ArrayList;
1213
import java.util.List;
1314

1415
public final class IsFileInEditableModuleUtil {
@@ -29,37 +30,33 @@ public static boolean execute(final PsiFile file) {
2930
}
3031

3132
/**
32-
* Validates if a given virtual file is located within editable paths defined by Magento project structure.
33+
* Validates if a given virtual file is located within editable paths.
3334
*
3435
* @param project the current project containing the virtual file
3536
* @param virtualFile the file to check against editable module directories
3637
* @return true if the file is in an editable module directory, false otherwise
3738
*/
3839
public static boolean execute(final Project project, final VirtualFile virtualFile) {
39-
final Settings settings = Settings.getInstance(project);
40-
List<String> magentoToFolders = settings.getMagentoFolders();
41-
final String magentoPathUrl = MagentoPathUrlUtil.execute(project);
42-
if (magentoPathUrl != null) {
43-
if (magentoToFolders == null) {
44-
magentoToFolders = List.of(
45-
magentoPathUrl
46-
);
47-
} else {
48-
magentoToFolders.add(
49-
magentoPathUrl
50-
);
51-
}
40+
final String magentoRootPath = MagentoPathUrlUtil.execute(project);
41+
if (magentoRootPath == null) {
42+
return false;
5243
}
5344

45+
final Settings settings = Settings.getInstance(project);
46+
List<String> editablePaths = settings.getMagentoFolders();
47+
if (editablePaths == null) {
48+
editablePaths = new ArrayList<>();
49+
}
5450

55-
56-
if (magentoToFolders == null) {
57-
return false;
51+
editablePaths.add(magentoRootPath);
52+
final String magentoDesignPath = MagentoPathUrlUtil.getDesignPath(project);
53+
if (magentoDesignPath != null) {
54+
editablePaths.add(magentoDesignPath);
5855
}
5956

60-
final String filePath = virtualFile.getUrl();
61-
for (final String editablePath : magentoToFolders) {
62-
if (normalizeUrl(filePath).startsWith(normalizeUrl(editablePath))) {
57+
final String currentFilePath = virtualFile.getUrl();
58+
for (final String editablePath : editablePaths) {
59+
if (normalizeUrl(currentFilePath).startsWith(normalizeUrl(editablePath))) {
6360
return true;
6461
}
6562
}

src/main/java/com/magento/idea/magento2plugin/util/magento/MagentoPathUrlUtil.java

+30-3
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,22 @@
1111
import com.magento.idea.magento2plugin.magento.packages.Package;
1212
import com.magento.idea.magento2plugin.project.Settings;
1313

14-
public class MagentoPathUrlUtil {
14+
public final class MagentoPathUrlUtil {
15+
16+
/**
17+
* Private constructor to prevent instantiation of utility class.
18+
*/
19+
private MagentoPathUrlUtil() {
20+
}
21+
1522
/**
1623
* Constructs a file URL for the Magento packages root, based on the project settings.
1724
*
1825
* @param project the project instance
1926
* @return the constructed file URL
2027
*/
21-
public static String execute(Project project) {
22-
String magentoPath = Settings.getMagentoPath(project);
28+
public static String execute(final Project project) {
29+
final String magentoPath = Settings.getMagentoPath(project);
2330
if (magentoPath != null) {
2431
return VirtualFileManager.constructUrl(
2532
"file",
@@ -31,4 +38,24 @@ public static String execute(Project project) {
3138

3239
return null;
3340
}
41+
42+
/**
43+
* Constructs a file URL for the Magento packages root, based on the project settings.
44+
*
45+
* @param project the project instance
46+
* @return the constructed file URL
47+
*/
48+
public static String getDesignPath(final Project project) {
49+
final String magentoPath = Settings.getMagentoPath(project);
50+
if (magentoPath != null) {
51+
return VirtualFileManager.constructUrl(
52+
"file",
53+
magentoPath
54+
+ File.separator
55+
+ Package.packagesDesignRoot
56+
);
57+
}
58+
59+
return null;
60+
}
3461
}

src/main/resources/META-INF/plugin.xml

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<idea-plugin require-restart="true">
88
<id>com.magento.idea.magento2plugin</id>
99
<name>Magento PhpStorm</name>
10-
<version>2025.1.0</version>
10+
<version>2025.1.1</version>
1111
<vendor url="https://github.com/magento/magento2-phpstorm-plugin">Magento Inc.</vendor>
1212

1313
<description><![CDATA[
@@ -176,10 +176,10 @@
176176
</group>
177177

178178
<action id="AddMagentoContentRoot" class="com.magento.idea.magento2plugin.actions.content.root.MarkDirectoryAsMagentoContentRot" text="Mark Directory As Magento Code Root" description="Adds Magento code root">
179-
<add-to-group group-id="PS.MarkRootGroup" anchor="last"/>
179+
<add-to-group group-id="MarkRootGroup" anchor="last"/>
180180
</action>
181181
<action id="RemoveMagentoContentRoot" class="com.magento.idea.magento2plugin.actions.content.root.UnmarkDirectoryAsMagentoContentRot" text="Unmark Directory As Magento Code Root" description="Removes Magento code root">
182-
<add-to-group group-id="PS.MarkRootGroup" anchor="last"/>
182+
<add-to-group group-id="MarkRootGroup" anchor="last"/>
183183
</action>
184184
</actions>
185185

src/test/kotlin/com/magento/idea/magento2plugin/pages/IdeaFrame.kt

+11-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ import com.intellij.remoterobot.RemoteRobot
99
import com.intellij.remoterobot.data.RemoteComponent
1010
import com.intellij.remoterobot.fixtures.*
1111
import com.intellij.remoterobot.search.locators.byXpath
12+
import com.intellij.remoterobot.utils.keyboard
13+
import java.awt.event.KeyEvent.VK_ALT
14+
import java.awt.event.KeyEvent.VK_1
1215
import java.time.Duration
1316

1417

@@ -25,7 +28,14 @@ class IdeaFrame(remoteRobot: RemoteRobot, remoteComponent: RemoteComponent) :
2528
get() = actionLink(byXpath("//div[@accessiblename='Enable Magento support for this project?' and @class='JEditorPane']"))
2629

2730
val projectViewTree
28-
get() = find<ContainerFixture>(byXpath("//div[@class='ProjectViewTree']"))
31+
get() = try {
32+
find<ContainerFixture>(byXpath("//div[@class='ProjectViewTree']"))
33+
} catch (e: Exception) {
34+
keyboard {
35+
hotKey(VK_ALT, VK_1)
36+
}
37+
find<ContainerFixture>(byXpath("//div[@class='ProjectViewTree']"))
38+
}
2939

3040
fun isProjectViewVisible(): Boolean {
3141
return try {

src/test/kotlin/com/magento/idea/magento2plugin/steps/SharedSteps.kt

+3-2
Original file line numberDiff line numberDiff line change
@@ -115,16 +115,16 @@ class SharedSteps(private val remoteRobot: RemoteRobot) {
115115
DialogFixture::class.java, byXpath("//div[@class='MyDialog']")
116116
)
117117
dialog.button("Close").click()
118+
closeBrowser()
118119

119120
try {
120121
Thread.sleep(10000)
121122
} catch (e: InterruptedException) {
122123
Thread.currentThread().interrupt()
123124
throw RuntimeException(e)
124125
}
125-
126-
closeBrowser()
127126
} else {
127+
closeBrowser()
128128
val dialog = remoteRobot.find(
129129
DialogFixture::class.java, byXpath("//div[@class='MyDialog']")
130130
)
@@ -196,6 +196,7 @@ class SharedSteps(private val remoteRobot: RemoteRobot) {
196196
} else if (os.contains("nix") || os.contains("nux")) {
197197
// For Linux-based systems: Kill typical browser processes
198198
Runtime.getRuntime().exec("killall -9 firefox")
199+
Runtime.getRuntime().exec("killall -9 chrome")
199200
}
200201
} catch (e: IOException) {
201202
e.printStackTrace()

0 commit comments

Comments
 (0)