本文整理汇总了Java中com.jetbrains.php.PhpIndex.getClassesByName方法的典型用法代码示例。如果您正苦于以下问题:Java PhpIndex.getClassesByName方法的具体用法?Java PhpIndex.getClassesByName怎么用?Java PhpIndex.getClassesByName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jetbrains.php.PhpIndex
的用法示例。
在下文中一共展示了PhpIndex.getClassesByName方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addCompletions
import com.jetbrains.php.PhpIndex; //导入方法依赖的package包/类
public void addCompletions(@NotNull CompletionParameters parameters, ProcessingContext context, @NotNull CompletionResultSet resultSet) {
if(!Symfony2ProjectComponent.isEnabled(parameters.getPosition())) {
return;
}
PhpIndex phpIndex = PhpIndex.getInstance(parameters.getOriginalFile().getProject());
Map<String, String> entityNamespaces = ServiceXmlParserFactory.getInstance(parameters.getOriginalFile().getProject(), EntityNamesServiceParser.class).getEntityNameMap();
// copied from PhpCompletionUtil::addClassesInNamespace looks the official way to find classes in namespaces
// its a really performance nightmare
Collection<String> names = phpIndex.getAllClassNames(new CamelHumpMatcher(resultSet.getPrefixMatcher().getPrefix()));
for (String name : names) {
Collection<PhpClass> classes = phpIndex.getClassesByName(name);
for(Map.Entry<String, String> entry: entityNamespaces.entrySet()) {
String namespaceFqn = PhpLangUtil.toFQN(entry.getValue());
Collection<PhpClass> filtered = PhpCompletionUtil.filterByNamespace(classes, namespaceFqn);
for (PhpClass phpClass : filtered) {
resultSet.addElement(new PhpClassLookupElement(phpClass, true, PhpClassReferenceInsertHandler.getInstance()));
}
}
}
}
示例2: collectCompletionResult
import com.jetbrains.php.PhpIndex; //导入方法依赖的package包/类
@Override
public List<LookupElement> collectCompletionResult(PsiElement psiElement, @Nullable PsiContextMatcherI<PsiElement> context) {
List<LookupElement> result = new ArrayList<>();
PhpIndex phpIndex = PhpIndex.getInstance(psiElement.getProject());
String prefix = StringUtil.unquoteString(psiElement.getText());
Collection<String> classNames = phpIndex.getAllClassNames(new CamelHumpMatcher(prefix));
for (String className: classNames) {
Collection<PhpClass> classesByName = phpIndex.getClassesByName(className);
for (PhpClass phpClass: classesByName) {
if (context != null && !context.match(phpClass)) {
continue;
}
String classFqn = phpClass.getPresentableFQN();
result.add(
LookupElementBuilder
.create(classFqn)
.withIcon(PhpIcons.CLASS_ICON)
);
}
}
return result;
}
示例3: getOverloadAbleClasses
import com.jetbrains.php.PhpIndex; //导入方法依赖的package包/类
public static Collection<LookupElement> getOverloadAbleClasses(@NotNull Project project, @NotNull String contents) {
Collection<LookupElement> elements = new ArrayList<LookupElement>();
// @TODO: is there a class filter on oxid, so we provide completion only for
// "extends" classes
PhpIndex phpIndex = PhpIndex.getInstance(project);
for (String name : phpIndex.getAllClassNames(new CamelHumpMatcher(contents))) {
for (PhpClass phpClass : phpIndex.getClassesByName(name)) {
elements.add(new PhpClassLookupElement(phpClass, true, PhpClassReferenceInsertHandler.getInstance()));
}
}
return elements;
}
示例4: getPhpClassesForLookup
import com.jetbrains.php.PhpIndex; //导入方法依赖的package包/类
@Override
protected Collection<PhpClass> getPhpClassesForLookup(@NotNull PhpIndex phpIndex, @NotNull String className) {
return phpIndex.getClassesByName(className);
}