Skip to content

Commit 8d3acc9

Browse files
Merge branch '4.4.0-develop' of github.com:magento/magento2-phpstorm-plugin into update-5.0.0-develop-from-4.4.0-develop
2 parents 0d0bcbc + f595d1b commit 8d3acc9

File tree

13 files changed

+278
-92
lines changed

13 files changed

+278
-92
lines changed

CHANGELOG.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,49 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0).
88

99
## 4.4.0
1010

11+
### Added
12+
13+
- Code generation of a Data Patch file with a Customer EAV attribute [#583](https://github.com/magento/magento2-phpstorm-plugin/pull/583)
14+
- Code generation of a Data Patch file with a Product EAV attribute [#527](https://github.com/magento/magento2-phpstorm-plugin/pull/527)
15+
- Code generation of a Data Patch file with a Category EAV attribute [#569](https://github.com/magento/magento2-phpstorm-plugin/pull/569)
16+
- Code generation of Readme file [#1133](https://github.com/magento/magento2-phpstorm-plugin/pull/1133)
17+
- Code generation of GraphQl schema file [#1123](https://github.com/magento/magento2-phpstorm-plugin/pull/1123)
18+
- Optional generation of Readme file during the creation of a new module [#1110](https://github.com/magento/magento2-phpstorm-plugin/pull/1110)
19+
- Code completion for `system.xml` and `config.xml` [#1077](https://github.com/magento/magento2-phpstorm-plugin/pull/1077)
20+
- Added easier navigation through plugins [#1121](https://github.com/magento/magento2-phpstorm-plugin/pull/1121)
21+
- Added inspection to check if type attr value in the virtual type tag attribute value exists [#1176](https://github.com/magento/magento2-phpstorm-plugin/pull/1176)
22+
- Added checks and detailed error messages during plugin activation [#1181](https://github.com/magento/magento2-phpstorm-plugin/pull/1181)
23+
24+
### Fixed
25+
26+
- Fixed NullPointerException at ObserverDeclarationInspection.java:188 [#1143](https://github.com/magento/magento2-phpstorm-plugin/issues/1143)
27+
- Fixed IncorrectOperationException: Rebind cannot be performed for class PolyVariantReferenceBase [#1173](https://github.com/magento/magento2-phpstorm-plugin/pull/1173)
28+
- Fixed create an observer for an event doesn't work through the context menu [#1166](https://github.com/magento/magento2-phpstorm-plugin/pull/1166)
29+
- Fixed IOException: Invalid file name at ReportBuilder [#1154](https://github.com/magento/magento2-phpstorm-plugin/pull/1154)
30+
- Fixed IllegalArgumentException in NewModuleAction class [#1150](https://github.com/magento/magento2-phpstorm-plugin/pull/1150)
31+
- Fixed null data in ModuleIndex class [#1132](https://github.com/magento/magento2-phpstorm-plugin/pull/1132)
32+
- Fixed StringIndexOutOfBoundsException: GitHubNewIssueBodyBuilderUtil [#1130](https://github.com/magento/magento2-phpstorm-plugin/pull/1130)
33+
- Fixed ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 0 in OverrideClassByAPreferenceDialog [#1129](https://github.com/magento/magento2-phpstorm-plugin/pull/1129)
34+
- Fixed PatternSyntaxException: MagentoBasePathUtil.isMagentoFolderValid:35 for Windows styled dir path separator [#1126](https://github.com/magento/magento2-phpstorm-plugin/pull/1126)
35+
- Fixed NullPointerException in the OverrideTemplateInThemeAction.isOverrideAllowed for virtualFile.getCanonicalPath() [#1125](https://github.com/magento/magento2-phpstorm-plugin/pull/1125)
36+
- Fixed IllegalArgumentException: Argument for @NotNull parameter 'dataKey' must not be null in CompareTemplateAction [#1117](https://github.com/magento/magento2-phpstorm-plugin/pull/1117)
37+
- Fixed argument for @NotNull parameter 'project' must not be null in the OverrideClassByAPreferenceAction [#1116](https://github.com/magento/magento2-phpstorm-plugin/pull/1116)
38+
- Fixed New layout action doesn't accept valid layout names [#1114](https://github.com/magento/magento2-phpstorm-plugin/pull/1114)
39+
40+
## 4.3.1
41+
42+
### Changed
43+
44+
- Added raw plugin verifier configuration in [#1065](https://github.com/magento/magento2-phpstorm-plugin/pull/1065)
45+
46+
### Fixed
47+
48+
- Fixed bug with the file separator on Windows OS (while saving plugin settings) in [#1062](https://github.com/magento/magento2-phpstorm-plugin/pull/1062)
49+
- Fixed bug with wrong text range for FilePathReferenceProvider.getReferencesByElement in [#1063](https://github.com/magento/magento2-phpstorm-plugin/pull/1063)
50+
- Fixed module files action group is accessible from the theme context in [#1064](https://github.com/magento/magento2-phpstorm-plugin/pull/1064)
51+
- Fixed bug with directory index is already disposed for Project in AllFilesExceptTestsScope.contains in [#1080](https://github.com/magento/magento2-phpstorm-plugin/pull/1080)
52+
- Fixed bug with DumbService cannot be created because container is already disposed in MagentoComponentManager.getComponents in [#1081](https://github.com/magento/magento2-phpstorm-plugin/pull/1081)
53+
1154
## 4.3.0
1255

1356
### Added

resources/magento2/validation.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
validator.notEmpty=The {0} field must not be empty
22
validator.box.notEmpty=The {0} field must contain a valid selection from the dropdown
33
validator.package.validPath=Please specify a valid Magento 2 installation path
4+
validator.package.validPathComposerFiles=File composer.json is missing in the current Magento 2 installation path
5+
validator.package.validPathVendor=Vendor dir is corrupt or missing in the current Magento 2 installation path
46
validator.properties.notEmpty=The properties must not be empty
57
validator.alphaNumericCharacters=The {0} field must contain letters and numbers only
68
validator.alphaNumericAndUnderscoreCharacters={0} must contain letters, numbers and underscores only

src/com/magento/idea/magento2plugin/actions/context/AbstractContextAction.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@
2020
import com.intellij.psi.PsiFile;
2121
import com.magento.idea.magento2plugin.MagentoIcons;
2222
import com.magento.idea.magento2plugin.magento.files.ModuleFileInterface;
23+
import com.magento.idea.magento2plugin.magento.packages.ComponentType;
2324
import com.magento.idea.magento2plugin.magento.packages.Package;
25+
import com.magento.idea.magento2plugin.project.Settings;
2426
import com.magento.idea.magento2plugin.util.magento.GetMagentoModuleUtil;
2527
import org.jetbrains.annotations.NotNull;
2628
import org.jetbrains.annotations.Nullable;
@@ -50,13 +52,14 @@ public AbstractContextAction(
5052
}
5153

5254
@Override
55+
@SuppressWarnings({"PMD.CyclomaticComplexity", "PMD.NPathComplexity"})
5356
public void update(final @NotNull AnActionEvent event) {
5457
event.getPresentation().setEnabled(false);
5558
event.getPresentation().setVisible(false);
5659

5760
final Project project = event.getProject();
5861

59-
if (project == null) {
62+
if (project == null || !Settings.isEnabled(project)) {
6063
return;
6164
}
6265
final DataContext context = event.getDataContext();
@@ -86,6 +89,12 @@ public void update(final @NotNull AnActionEvent event) {
8689
|| !isVisible(moduleData, targetDirectory, targetFile)) {
8790
return;
8891
}
92+
93+
if (moduleData.getType().equals(ComponentType.module)
94+
&& !GetMagentoModuleUtil.isEditableModule(moduleData)) {
95+
return;
96+
}
97+
8998
customDataContext = SimpleDataContext
9099
.builder()
91100
.add(

src/com/magento/idea/magento2plugin/actions/groups/NewModuleFileGroup.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import com.magento.idea.magento2plugin.actions.generation.util.IsClickedDirectoryInsideProject;
1717
import com.magento.idea.magento2plugin.indexes.ModuleIndex;
1818
import com.magento.idea.magento2plugin.project.Settings;
19+
import com.magento.idea.magento2plugin.util.magento.GetMagentoModuleUtil;
1920
import com.magento.idea.magento2plugin.util.magento.GetModuleNameByDirectoryUtil;
2021
import javax.swing.Icon;
2122
import org.jetbrains.annotations.NotNull;
@@ -62,7 +63,8 @@ public void update(final AnActionEvent event) {
6263
final PsiDirectory moduleDirectory = new ModuleIndex(project)
6364
.getModuleDirectoryByModuleName(moduleName);
6465

65-
if (moduleDirectory != null) {
66+
if (moduleDirectory != null
67+
&& GetMagentoModuleUtil.isDirectoryInEditableModule(moduleDirectory)) {
6668
event.getPresentation().setVisible(true);
6769
return;
6870
}

src/com/magento/idea/magento2plugin/inspections/xml/ObserverDeclarationInspection.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import com.intellij.codeInspection.ProblemHighlightType;
99
import com.intellij.codeInspection.ProblemsHolder;
1010
import com.intellij.ide.highlighter.XmlFileType;
11+
import com.intellij.openapi.externalSystem.service.execution.NotSupportedException;
1112
import com.intellij.openapi.vfs.VfsUtil;
1213
import com.intellij.openapi.vfs.VirtualFile;
1314
import com.intellij.psi.PsiElement;
@@ -71,6 +72,10 @@ public void visitFile(final @NotNull PsiFile file) {
7172
return;
7273
}
7374

75+
// This added to cover case if file exists only in memory.
76+
if (file.getContainingDirectory() == null) {
77+
return;
78+
}
7479
final EventIndex eventIndex = new EventIndex(file.getProject());
7580
final HashMap<String, XmlTag> targetObserversHash = new HashMap<>();
7681

@@ -108,7 +113,8 @@ public void visitFile(final @NotNull PsiFile file) {
108113
}
109114

110115
final String observerName = observerNameAttribute.getValue();
111-
if (observerName == null) {
116+
if (observerName == null
117+
|| observerNameAttribute.getValueElement() == null) {
112118
continue;
113119
}
114120

@@ -188,6 +194,11 @@ private List<HashMap<String, String>> fetchModuleNamesWhereSameObserverNameUsed(
188194
final EventIndex eventIndex,
189195
final PsiFile file
190196
) {
197+
if (file.getContainingDirectory() == null) {
198+
throw new NotSupportedException(
199+
"Operation is not supported for files in memory"
200+
);
201+
}
191202
final List<HashMap<String, String>> modulesName = new ArrayList<>();
192203
final String currentFileDirectory = file.getContainingDirectory().toString();
193204
final String currentFileFullPath = currentFileDirectory

src/com/magento/idea/magento2plugin/lang/psi/search/AllFilesExceptTestsScope.java

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -16,33 +16,14 @@
1616
public final class AllFilesExceptTestsScope extends GlobalSearchScope {
1717

1818
public static final String SCOPE_NAME = "All Files Except Tests";
19-
private static AllFilesExceptTestsScope instance;
2019
private final Project project;
2120

22-
/**
23-
* Get search scope instance.
24-
*
25-
* @param project Project
26-
*
27-
* @return AllFilesExceptTestsScope
28-
*/
29-
@SuppressWarnings("PMD.AvoidSynchronizedAtMethodLevel")
30-
public static synchronized AllFilesExceptTestsScope getInstance(
31-
final @Nullable Project project
32-
) {
33-
if (instance == null) {
34-
instance = new AllFilesExceptTestsScope(project);
35-
}
36-
37-
return instance;
38-
}
39-
4021
/**
4122
* Magento search scope constructor.
4223
*
4324
* @param project Project
4425
*/
45-
private AllFilesExceptTestsScope(final @Nullable Project project) {
26+
public AllFilesExceptTestsScope(final @Nullable Project project) {
4627
super(project);
4728
this.project = project;
4829
}

src/com/magento/idea/magento2plugin/lang/psi/search/MagentoSearchScopesProvider.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,6 @@ public class MagentoSearchScopesProvider implements SearchScopeProvider {
3232
return Collections.emptyList();
3333
}
3434

35-
return Collections.singletonList(AllFilesExceptTestsScope.getInstance(project));
35+
return Collections.singletonList(new AllFilesExceptTestsScope(project));
3636
}
3737
}

0 commit comments

Comments
 (0)