Skip to content

Commit 150b972

Browse files
committed
Add Fetching Themes From Module Index
The data was already included in the index with no way the retrieve.
1 parent 03d84d2 commit 150b972

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

src/com/magento/idea/magento2plugin/indexes/ModuleIndex.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,18 +45,30 @@ public List<String> getEditableModuleNames() {
4545
return getModuleNames(Package.VENDOR, true);
4646
}
4747

48+
public List<String> getEditableThemeNames() {
49+
return getThemeNames("/" + Package.VENDOR + "/|/tests/|/test/", true);
50+
}
51+
4852
public List<String> getModuleNames() {
4953
return getModuleNames("/tests/|/test/", false);
5054
}
5155

5256
public List<String> getModuleNames(String filterPattern, boolean withinProject) {
57+
return getNames(filterPattern, withinProject, RegExUtil.Magento.MODULE_NAME);
58+
}
59+
60+
public List<String> getThemeNames(String filterPattern, boolean withinProject) {
61+
return getNames(filterPattern, withinProject, RegExUtil.Magento.THEME_NAME);
62+
}
63+
64+
public List<String> getNames(String filterPattern, boolean withinProject, String pattern) {
5365
FileBasedIndex index = FileBasedIndex
5466
.getInstance();
5567
List<String> allModulesList = new ArrayList<>();
5668
Collection<String> allModules = index.getAllKeys(ModuleNameIndex.KEY, project);
5769
Pattern p = Pattern.compile(filterPattern);
5870
for (String moduleName : allModules) {
59-
if (!moduleName.matches(RegExUtil.Magento.MODULE_NAME)) {
71+
if (!moduleName.matches(pattern)) {
6072
continue;
6173
}
6274
Collection<VirtualFile> files = index.getContainingFiles(ModuleNameIndex.KEY, moduleName, GlobalSearchScope.getScopeRestrictedByFileTypes(

src/com/magento/idea/magento2plugin/util/RegExUtil.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ public static class Magento {
2727
public static final String MODULE_NAME
2828
= "[A-Z][a-zA-Z0-9]+_[A-Z][a-zA-Z0-9]+";
2929

30+
public static final String THEME_NAME
31+
= "[a-z]+/[A-Z][a-zA-Z0-9_]+/[a-z][a-zA-Z0-9_]+";
32+
3033
public static final String MFTF_CURLY_BRACES
3134
= ".*\\{\\{[^\\}]+\\}\\}.*";
3235

0 commit comments

Comments
 (0)