forked from magento/magento2-phpstorm-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCronGroupIndex.java
48 lines (35 loc) · 1.19 KB
/
CronGroupIndex.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/*
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
package com.magento.idea.magento2plugin.indexes;
import com.intellij.openapi.project.Project;
import com.intellij.util.indexing.FileBasedIndex;
import com.magento.idea.magento2plugin.stubs.indexes.CronGroupIndexer;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class CronGroupIndex {
private static CronGroupIndex INSTANCE;
private Project project;
private CronGroupIndex() {}
public static CronGroupIndex getInstance(Project project) {
if (null == INSTANCE) {
INSTANCE = new CronGroupIndex();
}
INSTANCE.project = project;
return INSTANCE;
}
/**
* Retrieve list of cron groups
*
* @return List<String>
*/
public List<String> getGroups() {
FileBasedIndex index = FileBasedIndex.getInstance();
List<String> cronGroups = new ArrayList<>(index.getAllKeys(CronGroupIndexer.KEY, project));
// todo: needs to show custom cron groups first and only than groups from bundled core modules
Collections.sort(cronGroups);
return cronGroups;
}
}