当前位置: 首页>>代码示例>>Java>>正文


Java PhpIndex.getClassesByName方法代码示例

本文整理汇总了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()));
                }
            }
        }
    }
 
开发者ID:Haehnchen,项目名称:idea-php-symfony2-plugin,代码行数:26,代码来源:PhpEntityClassCompletionProvider.java

示例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;
}
 
开发者ID:dkvashninbay,项目名称:magento2plugin,代码行数:28,代码来源:ClassCompletionProvider.java

示例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;
    }
 
开发者ID:Haehnchen,项目名称:idea-php-oxid-plugin,代码行数:16,代码来源:OxidUtil.java

示例4: getPhpClassesForLookup

import com.jetbrains.php.PhpIndex; //导入方法依赖的package包/类
@Override
protected Collection<PhpClass> getPhpClassesForLookup(@NotNull PhpIndex phpIndex, @NotNull String className) {
    return phpIndex.getClassesByName(className);
}
 
开发者ID:Haehnchen,项目名称:idea-php-toolbox,代码行数:5,代码来源:ClassProvider.java


注:本文中的com.jetbrains.php.PhpIndex.getClassesByName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。