b6831d91c973ddd16d9074b0f5cedddc4ead97c5
[idea/community.git] / python / src / com / jetbrains / python / psi / stubs / PyClassAttributesIndex.java
1 package com.jetbrains.python.psi.stubs;
2
3 import com.intellij.openapi.project.Project;
4 import com.intellij.psi.search.GlobalSearchScope;
5 import com.intellij.psi.stubs.StringStubIndexExtension;
6 import com.intellij.psi.stubs.StubIndex;
7 import com.intellij.psi.stubs.StubIndexKey;
8 import com.jetbrains.python.psi.PyClass;
9 import org.jetbrains.annotations.NotNull;
10
11 import java.util.Collection;
12
13 /**
14  * @author Mikhail Golubev
15  */
16 public class PyClassAttributesIndex extends StringStubIndexExtension<PyClass> {
17   public static final StubIndexKey<String, PyClass> KEY = StubIndexKey.createIndexKey("Py.class.attributes");
18
19   @NotNull
20   @Override
21   public StubIndexKey<String, PyClass> getKey() {
22     return KEY;
23   }
24
25   public static Collection<PyClass> find(@NotNull String name, @NotNull Project project) {
26     return StubIndex.getElements(KEY, name, project, GlobalSearchScope.allScope(project), PyClass.class);
27   }
28 }