Skip to content

Commit ae64e57

Browse files
author
Vitaliy Boyko
committed
Merge remote-tracking branch 'origin/pre-release-4.4.0' into pre-release-4.4.0
2 parents 2123c89 + f6a868e commit ae64e57

23 files changed

+603
-189
lines changed

CHANGELOG.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0).
1515
- Code generation of GraphQl schema file [#1123](https://github.com/magento/magento2-phpstorm-plugin/pull/1123)
1616
- Optional generation of Readme file during the creation of a new module [#1110](https://github.com/magento/magento2-phpstorm-plugin/pull/1110)
1717
- Code completion for `system.xml` and `config.xml` [#1077](https://github.com/magento/magento2-phpstorm-plugin/pull/1077)
18+
- Added easier navigation through plugins [#1121](https://github.com/magento/magento2-phpstorm-plugin/pull/1121)
1819

1920
### Fixed
2021

22+
- Fixed IOException: Invalid file name at ReportBuilder [#1154](https://github.com/magento/magento2-phpstorm-plugin/pull/1154)
23+
- Fixed IllegalArgumentException in NewModuleAction class [#1150](https://github.com/magento/magento2-phpstorm-plugin/pull/1150)
2124
- Fixed null data in ModuleIndex class [#1132](https://github.com/magento/magento2-phpstorm-plugin/pull/1132)
2225
- Fixed StringIndexOutOfBoundsException: GitHubNewIssueBodyBuilderUtil [#1130](https://github.com/magento/magento2-phpstorm-plugin/pull/1130)
2326
- Fixed ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 0 in OverrideClassByAPreferenceDialog [#1129](https://github.com/magento/magento2-phpstorm-plugin/pull/1129)
@@ -27,6 +30,20 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0).
2730
- Fixed argument for @NotNull parameter 'project' must not be null in the OverrideClassByAPreferenceAction [#1116](https://github.com/magento/magento2-phpstorm-plugin/pull/1116)
2831
- Fixed New layout action doesn't accept valid layout names [#1114](https://github.com/magento/magento2-phpstorm-plugin/pull/1114)
2932

33+
## 4.3.1
34+
35+
### Changed
36+
37+
- Added raw plugin verifier configuration in [#1065](https://github.com/magento/magento2-phpstorm-plugin/pull/1065)
38+
39+
### Fixed
40+
41+
- Fixed bug with the file separator on Windows OS (while saving plugin settings) in [#1062](https://github.com/magento/magento2-phpstorm-plugin/pull/1062)
42+
- Fixed bug with wrong text range for FilePathReferenceProvider.getReferencesByElement in [#1063](https://github.com/magento/magento2-phpstorm-plugin/pull/1063)
43+
- Fixed module files action group is accessible from the theme context in [#1064](https://github.com/magento/magento2-phpstorm-plugin/pull/1064)
44+
- Fixed bug with directory index is already disposed for Project in AllFilesExceptTestsScope.contains in [#1080](https://github.com/magento/magento2-phpstorm-plugin/pull/1080)
45+
- 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)
46+
3047
## 4.3.0
3148

3249
### Added

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/generation/NewModuleAction.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@
2323
import org.jetbrains.annotations.NotNull;
2424

2525
public class NewModuleAction extends com.intellij.openapi.actionSystem.AnAction {
26-
public static String actionName = "Magento 2 Module";
27-
public static String actionDescription = "Create a new Magento 2 Module";
26+
public static final String ACTION_NAME = "Magento 2 Module";
27+
public static final String ACTION_DESCRIPTION = "Create a new Magento 2 Module";
2828

2929
/**
3030
* Constructor.
3131
*/
3232
public NewModuleAction() {
33-
super(actionName, actionDescription, MagentoIcons.MODULE);
33+
super(ACTION_NAME, ACTION_DESCRIPTION, MagentoIcons.MODULE);
3434
}
3535

3636
@Override
@@ -67,6 +67,10 @@ public boolean isDumbAware() {
6767
public void update(final AnActionEvent event) {
6868
final Project project = event.getData(PlatformDataKeys.PROJECT);
6969

70+
if (project == null) {
71+
return;
72+
}
73+
7074
if (Settings.isEnabled(project)) {
7175
final String magentoPath = Settings.getMagentoPath(project);
7276
if (magentoPath == null) {

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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
import com.magento.idea.magento2plugin.util.magento.plugin.GetTargetClassNamesByPluginClassName;
4343
import com.magento.idea.magento2plugin.util.magento.plugin.IsPluginAllowedForMethodUtil;
4444
import gnu.trove.THashSet;
45-
import java.util.ArrayList;
4645
import java.util.Collection;
4746
import java.util.Iterator;
4847
import java.util.List;
@@ -88,9 +87,9 @@ public boolean isValidFor(final Editor editor, final PsiFile file) {
8887
return false;
8988
}
9089
final GetTargetClassNamesByPluginClassName targetClassesService
91-
= GetTargetClassNamesByPluginClassName.getInstance(editor.getProject());
90+
= new GetTargetClassNamesByPluginClassName(editor.getProject());
9291
final String currentClass = phpClass.getFQN().substring(1);
93-
final ArrayList<String> targetClassNames = targetClassesService.execute(currentClass);
92+
final List<String> targetClassNames = targetClassesService.execute(currentClass);
9493
return !targetClassNames.isEmpty();
9594
}
9695

@@ -241,9 +240,9 @@ protected PhpNamedElementNode[] targetMethods(
241240
final TreeMap<String, PhpNamedElementNode> nodes = new TreeMap();
242241

243242
final GetTargetClassNamesByPluginClassName targetClassesService =
244-
GetTargetClassNamesByPluginClassName.getInstance(phpClass.getProject());
243+
new GetTargetClassNamesByPluginClassName(phpClass.getProject());
245244
final String currentClass = phpClass.getFQN().substring(1);
246-
final ArrayList<String> targetClassNames = targetClassesService.execute(currentClass);
245+
final List<String> targetClassNames = targetClassesService.execute(currentClass);
247246
for (final String targetClassName : targetClassNames) {
248247
final PhpClass targetClass = GetPhpClassByFQN.getInstance(
249248
phpClass.getProject()

src/com/magento/idea/magento2plugin/actions/generation/dialog/NewModuleDialog.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ public NewModuleDialog(
133133
detectPackageName(initialBaseDir);
134134
setContentPane(contentPane);
135135
setModal(true);
136-
setTitle(NewModuleAction.actionDescription);
136+
setTitle(NewModuleAction.ACTION_DESCRIPTION);
137137
getRootPane().setDefaultButton(buttonOK);
138138
setLicenses();
139139
setModuleDependencies();
@@ -214,7 +214,7 @@ private PsiFile generateComposerJson() {
214214
getModuleLicense(),
215215
getModuleDependencies(),
216216
true
217-
), project).generate(NewModuleAction.actionName);
217+
), project).generate(NewModuleAction.ACTION_NAME);
218218
}
219219

220220
private PsiFile generateRegistrationPhp() {
@@ -223,7 +223,7 @@ private PsiFile generateRegistrationPhp() {
223223
getModuleName(),
224224
getBaseDir(),
225225
true
226-
), project).generate(NewModuleAction.actionName);
226+
), project).generate(NewModuleAction.ACTION_NAME);
227227
}
228228

229229
private void generateModuleXml() {
@@ -234,15 +234,15 @@ private void generateModuleXml() {
234234
getBaseDir(),
235235
getModuleDependencies(),
236236
true
237-
), project).generate(NewModuleAction.actionName, true);
237+
), project).generate(NewModuleAction.ACTION_NAME, true);
238238
}
239239

240240
private void generateReadmeMd() {
241241
new ModuleReadmeMdGenerator(new ModuleReadmeMdData(
242242
getPackageName(),
243243
getModuleName(),
244244
getBaseDir()
245-
), project).generate(NewModuleAction.actionName);
245+
), project).generate(NewModuleAction.ACTION_NAME);
246246
}
247247

248248
private PsiDirectory getBaseDir() {

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/php/PluginInspection.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
import com.magento.idea.magento2plugin.magento.packages.Package;
2828
import com.magento.idea.magento2plugin.util.GetPhpClassByFQN;
2929
import com.magento.idea.magento2plugin.util.magento.plugin.GetTargetClassNamesByPluginClassName;
30-
import java.util.ArrayList;
30+
import java.util.List;
3131
import org.jetbrains.annotations.NotNull;
3232

3333
@SuppressWarnings({"PMD.ExcessiveMethodLength", "PMD.NPathComplexity", "PMD.CognitiveComplexity"})
@@ -75,10 +75,8 @@ public void visitPhpMethod(final Method pluginMethod) {
7575
((PhpClass) parentClass).getNameIdentifier();
7676
final String currentClass = ((PhpClass) parentClass).getFQN().substring(1);
7777
final GetTargetClassNamesByPluginClassName targetClassesService =
78-
GetTargetClassNamesByPluginClassName.getInstance(
79-
problemsHolder.getProject()
80-
);
81-
final ArrayList<String> targetClassNames =
78+
new GetTargetClassNamesByPluginClassName(problemsHolder.getProject());
79+
final List<String> targetClassNames =
8280
targetClassesService.execute(currentClass);
8381

8482
for (final String targetClassName : targetClassNames) {

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)