Skip to content

Commit eef69c5

Browse files
authored
Merge pull request #940 from bohdan-harniuk/update-4-3-0-from-4-2-2
Update 4.3.0-develop from 4.2.2-develop
2 parents 38f451d + 8ce7334 commit eef69c5

File tree

134 files changed

+3287
-1451
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

134 files changed

+3287
-1451
lines changed

CHANGELOG.md

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

77
## 4.3.0
88

9+
## 4.2.2
10+
11+
### Added
12+
13+
- Added custom search scope to exclude test files from search [#read-more](https://github.com/magento/magento2-phpstorm-plugin/wiki/4.2.2-Release)
14+
- Added the ability to open all plugins in the Find Tool Window [#read-more](https://github.com/magento/magento2-phpstorm-plugin/wiki/4.2.2-Release)
15+
- Added uiComponent registration syntax highlighting as JSON [#read-more](https://github.com/magento/magento2-phpstorm-plugin/wiki/4.2.2-Release)
16+
- Added new Magento version support (2.4.4-beta4) for the UCT feature in [#922](https://github.com/magento/magento2-phpstorm-plugin/pull/922)
17+
18+
### Changed
19+
20+
- Eliminated com.google.gson.JsonParser#parse usage in [#928](https://github.com/magento/magento2-phpstorm-plugin/pull/928)
21+
- Eliminated LineMarkerXmlTagDecorator#checkDelete usage in [#910](https://github.com/magento/magento2-phpstorm-plugin/pull/910)
22+
- Eliminated LineMarkerXmlTagDecorator#checkAdd usage in [#909](https://github.com/magento/magento2-phpstorm-plugin/pull/909)
23+
- Enhanced errors showing for the new Magento 2 UI Component Form dialog window in [#892](https://github.com/magento/magento2-phpstorm-plugin/pull/892)
24+
- Enhanced errors showing for the new Magento 2 UI Component Grid dialog window in [#891](https://github.com/magento/magento2-phpstorm-plugin/pull/891)
25+
- Enhanced errors showing for the new Magento 2 DB Schema XML dialog window in [#890](https://github.com/magento/magento2-phpstorm-plugin/pull/890)
26+
- Enhanced errors showing for the new Magento 2 Message Queue dialog window in [#889](https://github.com/magento/magento2-phpstorm-plugin/pull/889)
27+
- Enhanced errors showing for the new Magento 2 Data Model dialog window in [#888](https://github.com/magento/magento2-phpstorm-plugin/pull/888)
28+
- Enhanced errors showing for the new Magento 2 Models dialog window in [#887](https://github.com/magento/magento2-phpstorm-plugin/pull/887)
29+
- Enhanced errors showing for the new Magento 2 Email Template dialog window in [#886](https://github.com/magento/magento2-phpstorm-plugin/pull/886)
30+
- Enhanced errors showing for the new Magento 2 CLI Command dialog window in [#885](https://github.com/magento/magento2-phpstorm-plugin/pull/885)
31+
- Enhanced errors showing for the new Magento 2 GraphQl Resolver dialog window in [#884](https://github.com/magento/magento2-phpstorm-plugin/pull/884)
32+
- Enhanced errors showing for the new Magento 2 View Model dialog window in [#883](https://github.com/magento/magento2-phpstorm-plugin/pull/883)
33+
- Enhanced errors showing for the new Magento 2 Cron Group dialog window in [#882](https://github.com/magento/magento2-phpstorm-plugin/pull/882)
34+
- Enhanced errors showing for the new Magento 2 Cron Job dialog window in [#881](https://github.com/magento/magento2-phpstorm-plugin/pull/881)
35+
- Enhanced errors showing for the new Magento 2 Controller dialog window in [#880](https://github.com/magento/magento2-phpstorm-plugin/pull/880)
36+
- Enhanced errors showing for the new Magento 2 Block dialog window in [#865](https://github.com/magento/magento2-phpstorm-plugin/pull/865)
37+
38+
### Fixed
39+
40+
- Fixed overriding layouts and templates allows to select an incompatible theme in [#930](https://github.com/magento/magento2-phpstorm-plugin/pull/930)
41+
- Fixed observer action visibility in [#936](https://github.com/magento/magento2-phpstorm-plugin/pull/936)
42+
- Fixed general exception while accessing phpIndex.getAnyByFQN(classFQN) in [#934](https://github.com/magento/magento2-phpstorm-plugin/pull/934)
43+
- Fixed ClassCastException for the GraphQlResolverIndex.getGraphQLUsages in [#927](https://github.com/magento/magento2-phpstorm-plugin/pull/927)
44+
- Fixed plugin inspection does not work correctly in [#902](https://github.com/magento/magento2-phpstorm-plugin/pull/902)
45+
- Fixed module name declaration inspection flags valid code in [#898](https://github.com/magento/magento2-phpstorm-plugin/pull/898)
46+
- Fixed ClassCastException: PsiPlainTextFileImpl cannot be cast to class XmlFile in WebApiTypeIndex in [#897](https://github.com/magento/magento2-phpstorm-plugin/pull/897)
47+
- Fixed IndexNotReadyException while opening a context menu in [#896](https://github.com/magento/magento2-phpstorm-plugin/pull/896)
48+
- Fixed IllegalArgumentException: URLDecoder: Incomplete trailing escape (%) pattern in [#894](https://github.com/magento/magento2-phpstorm-plugin/pull/894)
49+
- Fixed Throwable: AWT events are not allowed inside write action (UI Form) in [#893](https://github.com/magento/magento2-phpstorm-plugin/pull/893)
50+
- Fixed Slow operations are prohibited on EDT when calling update method on the CreateAPluginAction in [#862](https://github.com/magento/magento2-phpstorm-plugin/pull/862)
51+
- Fixed Throwable: when an IOException is thrown during new plugin generation in [#860](https://github.com/magento/magento2-phpstorm-plugin/pull/860)
52+
- Fixed IndexOutOfBoundsException in case when entered no fields during ui form generation in [#859](https://github.com/magento/magento2-phpstorm-plugin/pull/859)
53+
- Fixed NullPointerException when opening new cron job dialog for an invalid Magento 2 module in [#856](https://github.com/magento/magento2-phpstorm-plugin/pull/856)
54+
- Fixed NoSuchElementException when creating new controller in [#844](https://github.com/magento/magento2-phpstorm-plugin/pull/844)
55+
- Fixed Message Queue Connection does not match Naming Conventions in [#854](https://github.com/magento/magento2-phpstorm-plugin/pull/854)
56+
- Fixed StringIndexOutOfBoundsException during UCT inspection via action execution in [852](https://github.com/magento/magento2-phpstorm-plugin/pull/852)
57+
- Fixed NullPointerException in the PluginDeclarationInspection.fetchModuleNamesWhereSamePluginNameUsed (calling toString on null) in [#849](https://github.com/magento/magento2-phpstorm-plugin/pull/849)
58+
59+
## 4.2.1
60+
61+
### Fixed
62+
63+
- Fixed ArrayIndexOutOfBoundsException when used Copy Path/Reference action on the requirejs-config.js file in [#808](https://github.com/magento/magento2-phpstorm-plugin/pull/808)
64+
- Fixed dialog disposition issue in [#811](https://github.com/magento/magento2-phpstorm-plugin/pull/811)
65+
- Fixed stack overflow error for line-marker providers in [#813](https://github.com/magento/magento2-phpstorm-plugin/pull/813)
66+
- Fixed stub ids not found for key in index in [#814](https://github.com/magento/magento2-phpstorm-plugin/pull/814)
67+
- Fixed failed to build require-js index in [815](https://github.com/magento/magento2-phpstorm-plugin/pull/815)
68+
- Fixed empty psi elements in the plugin inspections in [#816](https://github.com/magento/magento2-phpstorm-plugin/pull/816)
69+
- Fixed empty psi element in module xml inspection in [#817](https://github.com/magento/magento2-phpstorm-plugin/pull/817)
70+
- Fixed NullPointerException for the firstSortOrder.compareTo in [#818](https://github.com/magento/magento2-phpstorm-plugin/pull/818)
71+
- Fixed invalid column types provided exception during db_schema.xml file generation in [#819](https://github.com/magento/magento2-phpstorm-plugin/pull/819)
72+
- Fixed method designed for fully qualified names only in [#830](https://github.com/magento/magento2-phpstorm-plugin/pull/830)
73+
- Fixed NoClassDefFoundError for com.intellij.lang.jsgraphql.GraphQLIcons in [#850](https://github.com/magento/magento2-phpstorm-plugin/pull/850)
74+
975
## 4.2.0
1076

1177
### Added

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ intellij {
4141
'properties',
4242
'CSS',
4343
'JavaScriptLanguage',
44-
'com.intellij.lang.jsgraphql:3.0.0',
44+
'com.intellij.lang.jsgraphql:3.1.2',
4545
'platform-images',
4646
'copyright'
4747
]
@@ -69,7 +69,7 @@ sourceSets {
6969
publishPlugin {
7070
token = System.getenv("MAGENTO_PHPSTORM_intellijPublishToken")
7171
if (Boolean.valueOf(System.getenv("MAGENTO_PHPSTORM_isAlpha"))) {
72-
channels 'alpha'
72+
channels = ['alpha']
7373
version = version + "-alpha-" + getDate()
7474
}
7575
}

resources/META-INF/plugin.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -561,6 +561,11 @@
561561
<errorHandler implementation="com.magento.idea.magento2plugin.project.diagnostic.DefaultErrorReportSubmitter"/>
562562

563563
<configurationType implementation="com.magento.idea.magento2uct.execution.configurations.UctRunConfigurationType"/>
564+
565+
<testSourcesFilter implementation="com.magento.idea.magento2plugin.lang.roots.MagentoTestSourceFilter"/>
566+
<searchScopesProvider implementation="com.magento.idea.magento2plugin.lang.psi.search.MagentoSearchScopesProvider"/>
567+
568+
<multiHostInjector implementation="com.magento.idea.magento2plugin.lang.injection.UiComponentSyntaxInjector"/>
564569
</extensions>
565570

566571
<extensions defaultExtensionNs="com.jetbrains.php">

resources/magento2/validation.properties

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
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.properties.notEmpty=The properties must not be empty
45
validator.alphaNumericCharacters=The {0} field must contain letters and numbers only
56
validator.alphaNumericAndUnderscoreCharacters={0} must contain letters, numbers and underscores only
67
validator.alphaAndPeriodCharacters=The {0} field must contain alphabets and periods only
@@ -22,6 +23,7 @@ validator.command.isNotValid=The {0} field does not contain a valid Magento 2 CL
2223
validator.module.noSuchModule=No such module {0}
2324
validator.file.alreadyExists={0} already exists
2425
validator.file.cantBeCreated={0} can't be created
26+
validator.file.cantBeCreatedWithException=The ''{0}'' cannot be created. Original message was: ''{1}''
2527
validator.file.isNotWritable=%s file is binary or has no document associations
2628
validator.file.noDocumentAssociations={0} file is binary or has no document associations
2729
validator.class.alreadyDeclared={0} already declared in the target module
@@ -38,3 +40,4 @@ validator.db.invalidTableNameLength=Table name must contain up to 64 characters
3840
validator.lowerSnakeCase=The {0} field must be of the lower snake case format
3941
validator.menuIdentifierInvalid=The menu identifier is invalid
4042
validator.someFieldsHaveErrors=Please, check the dialog. Some fields have errors
43+
validator.dbSchema.invalidColumnType=Invalid ''{0}'' column type specified
72.6 KB
Binary file not shown.
Binary file not shown.
739 KB
Binary file not shown.

src/com/magento/idea/magento2plugin/actions/CopyMagentoPath.java

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import org.jetbrains.annotations.Nullable;
2222

2323
public class CopyMagentoPath extends CopyPathProvider {
24+
2425
public static final String PHTML_EXTENSION = "phtml";
2526
public static final String JS_EXTENSION = "js";
2627
public static final String CSS_EXTENSION = "css";
@@ -56,23 +57,23 @@ private boolean isNotValidFile(final VirtualFile virtualFile) {
5657
|| virtualFile != null && !acceptedTypes.contains(virtualFile.getExtension());
5758
}
5859

59-
@Nullable
6060
@Override
61-
public String getPathToElement(
62-
@NotNull final Project project,
63-
@Nullable final VirtualFile virtualFile,
64-
@Nullable final Editor editor
61+
public @Nullable String getPathToElement(
62+
final @NotNull Project project,
63+
final @Nullable VirtualFile virtualFile,
64+
final @Nullable Editor editor
6565
) {
6666
if (virtualFile == null) {
6767
return null;
6868
}
69-
final PsiFile file
70-
= PsiManager.getInstance(project).findFile(virtualFile);
69+
final PsiFile file = PsiManager.getInstance(project).findFile(virtualFile);
70+
7171
if (file == null) {
7272
return null;
7373
}
7474
final PsiDirectory directory = file.getContainingDirectory();
7575
final String moduleName = GetModuleNameByDirectoryUtil.execute(directory, project);
76+
7677
if (moduleName == null) {
7778
return null;
7879
}
@@ -89,15 +90,30 @@ public String getPathToElement(
8990
} else {
9091
return fullPath.toString();
9192
}
93+
int endIndex;
9294

93-
final int endIndex = getIndexOf(paths, fullPath, paths[++index]);
95+
try {
96+
endIndex = getIndexOf(paths, fullPath, paths[++index]);
97+
} catch (ArrayIndexOutOfBoundsException exception) {
98+
// endIndex could not be found.
99+
return "";
100+
}
94101
final int offset = paths[index].length();
95102

96103
fullPath.replace(0, endIndex + offset, "");
97104

98105
return moduleName + SEPARATOR + fullPath;
99106
}
100107

108+
/**
109+
* Get index where web|template path starts in the fullPath.
110+
*
111+
* @param paths String[]
112+
* @param fullPath StringBuilder
113+
* @param path String
114+
*
115+
* @return int
116+
*/
101117
private int getIndexOf(final String[] paths, final StringBuilder fullPath, final String path) {
102118
return fullPath.lastIndexOf(path) == -1
103119
? getIndexOf(paths, fullPath, paths[++index])

src/com/magento/idea/magento2plugin/actions/generation/CreateAPluginAction.java

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import org.jetbrains.annotations.NotNull;
2626

2727
public class CreateAPluginAction extends DumbAwareAction {
28+
2829
public static final String ACTION_NAME = "Create a new Plugin for this method";
2930
public static final String ACTION_DESCRIPTION = "Create a new Magento 2 Plugin";
3031
private final GetFirstClassOfFile getFirstClassOfFile;
@@ -47,10 +48,12 @@ public void update(final AnActionEvent event) {
4748
targetClass = null;// NOPMD
4849
targetMethod = null;// NOPMD
4950
final Project project = event.getData(PlatformDataKeys.PROJECT);
50-
if (Settings.isEnabled(project)) {
51+
52+
if (project != null && Settings.isEnabled(project)) {
5153
final Pair<PsiFile, PhpClass> pair = this.findPhpClass(event);
5254
final PsiFile psiFile = pair.getFirst();
5355
final PhpClass phpClass = pair.getSecond();
56+
5457
if (phpClass == null
5558
|| !(psiFile instanceof PhpFile)
5659
|| phpClass.isFinal()
@@ -74,16 +77,21 @@ private void setStatus(final AnActionEvent event, final boolean status) {
7477
}
7578

7679
@Override
77-
public void actionPerformed(@NotNull final AnActionEvent event) {
78-
CreateAPluginDialog.open(event.getProject(), this.targetMethod, this.targetClass);
80+
public void actionPerformed(final @NotNull AnActionEvent event) {
81+
final Project project = event.getProject();
82+
83+
if (project == null) {
84+
return;
85+
}
86+
CreateAPluginDialog.open(project, this.targetMethod, this.targetClass);
7987
}
8088

8189
@Override
8290
public boolean isDumbAware() {
8391
return false;
8492
}
8593

86-
private Pair<PsiFile, PhpClass> findPhpClass(@NotNull final AnActionEvent event) {
94+
private Pair<PsiFile, PhpClass> findPhpClass(final @NotNull AnActionEvent event) {
8795
final PsiFile psiFile = event.getData(PlatformDataKeys.PSI_FILE);
8896

8997
PhpClass phpClass = null;
@@ -96,27 +104,31 @@ private Pair<PsiFile, PhpClass> findPhpClass(@NotNull final AnActionEvent event)
96104
}
97105

98106
private void fetchTargetMethod(
99-
@NotNull final AnActionEvent event,
107+
final @NotNull AnActionEvent event,
100108
final PsiFile psiFile,
101109
final PhpClass phpClass
102110
) {
103111
final Caret caret = event.getData(PlatformDataKeys.CARET);
112+
104113
if (caret == null) {
105114
return;
106115
}
107116
final int offset = caret.getOffset();
108117
final PsiElement element = psiFile.findElementAt(offset);
118+
109119
if (element == null) {
110120
return;
111121
}
112-
if (element instanceof Method && element.getParent()
113-
== phpClass && IsPluginAllowedForMethodUtil.check((Method) element)) {
122+
123+
if (element instanceof Method && element.getParent().equals(phpClass)
124+
&& IsPluginAllowedForMethodUtil.check((Method) element)) {
114125
this.targetMethod = (Method) element;
115126
return;
116127
}
117128
final PsiElement parent = element.getParent();
118-
if (parent instanceof Method && parent.getParent()
119-
== phpClass && IsPluginAllowedForMethodUtil.check((Method) parent)) {
129+
130+
if (parent instanceof Method && parent.getParent().equals(phpClass)
131+
&& IsPluginAllowedForMethodUtil.check((Method) parent)) {
120132
this.targetMethod = (Method) parent;
121133
}
122134
}

0 commit comments

Comments
 (0)