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


Java PhpIndex.getAnyByFQN方法代码示例

本文整理汇总了Java中com.jetbrains.php.PhpIndex.getAnyByFQN方法的典型用法代码示例。如果您正苦于以下问题:Java PhpIndex.getAnyByFQN方法的具体用法?Java PhpIndex.getAnyByFQN怎么用?Java PhpIndex.getAnyByFQN使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.jetbrains.php.PhpIndex的用法示例。


在下文中一共展示了PhpIndex.getAnyByFQN方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getPhpClassOfArgument

import com.jetbrains.php.PhpIndex; //导入方法依赖的package包/类
@Nullable
public PhpClass getPhpClassOfArgument(XmlElement psiArgumentValueElement) {

    XmlTag typeTag = XmlPsiTreeUtil.getTypeTagOfArgument(psiArgumentValueElement);
    if (null == typeTag) {
        return null;
    }

    String className = typeTag.getAttributeValue("name");
    if (null == className) {
        return null;
    }
    className = getTopTypeOfVirtualType(className);

    PhpIndex phpIndex = PhpIndex.getInstance(psiArgumentValueElement.getProject());
    Collection<PhpClass> phpClasses = phpIndex.getAnyByFQN(className);

    if (phpClasses.size() > 0) {
        return phpClasses.iterator().next();
    }

    return null;
}
 
开发者ID:magento,项目名称:magento2-phpstorm-plugin,代码行数:24,代码来源:DiIndex.java

示例2: getReferencesByElement

import com.jetbrains.php.PhpIndex; //导入方法依赖的package包/类
@NotNull
@Override
public PsiReference[] getReferencesByElement(@NotNull PsiElement element, @NotNull ProcessingContext context) {
    List<PsiReference> psiReferences = new ArrayList<>();
    final Collection<PhpClassMember> members = new THashSet<>();

    String origValue = element.getText();
    String value = StringUtil.unquoteString(element.getText());

    Matcher matcher = Pattern.compile(PhpRegex.Xml.CLASS_MEMBER_NAME).matcher(value);
    if (!matcher.find()) {
        return PsiReference.EMPTY_ARRAY;
    }

    String elementName = matcher.group(1);
    String classFQN = value.substring(0, value.lastIndexOf("::"));

    PhpIndex phpIndex = PhpIndex.getInstance(element.getProject());
    for (final PhpClass phpClass : phpIndex.getAnyByFQN(classFQN)) {
        members.addAll(phpClass.getFields());
        members.addAll(phpClass.getMethods());
        members.removeIf(c -> !c.getName().equals(elementName));
    }

    if (members.size() > 0) {
        TextRange range = new TextRange(
                origValue.indexOf(elementName),
                origValue.indexOf(elementName) + elementName.length()
        );
        psiReferences.add(new PolyVariantReferenceBase(element, range, members));
    }
    return psiReferences.toArray(new PsiReference[psiReferences.size()]);
}
 
开发者ID:magento,项目名称:magento2-phpstorm-plugin,代码行数:34,代码来源:PhpClassMemberReferenceProvider.java

示例3: getPhpClassCollection

import com.jetbrains.php.PhpIndex; //导入方法依赖的package包/类
@NotNull
private Collection<PhpClass> getPhpClassCollection(String fullQualifiedName) {
    try {
        PhpIndex phpIndex = PhpIndex.getInstance(this.project);
        return phpIndex.getAnyByFQN(fullQualifiedName);
    } catch (IllegalStateException exception) {
        return new ArrayList<>();
    }
}
 
开发者ID:project-a,项目名称:idea-php-spryker-plugin,代码行数:10,代码来源:ClassFinder.java

示例4: is

import com.jetbrains.php.PhpIndex; //导入方法依赖的package包/类
public boolean is(PhpClass cls, PhpIndex index)
{
	Collection<PhpClass> classes = index.getAnyByFQN(name);
	PhpClass instanceOf = classes.isEmpty() ? null : classes.iterator().next();
	if (instanceOf == null) {
		return false;
	}
	return instanceOf.getType().isConvertibleFrom(cls.getType(), index);
}
 
开发者ID:nextras,项目名称:orm-intellij,代码行数:10,代码来源:OrmUtils.java

示例5: getClass

import com.jetbrains.php.PhpIndex; //导入方法依赖的package包/类
@Nullable
public static PhpClass getClass(PhpIndex phpIndex, String className) {
    Collection<PhpClass> classes = phpIndex.getAnyByFQN(className);
    return classes.isEmpty() ? null : classes.iterator().next();
}
 
开发者ID:nvlad,项目名称:yii2support,代码行数:6,代码来源:ClassUtils.java

示例6: addCompletions

import com.jetbrains.php.PhpIndex; //导入方法依赖的package包/类
@Override
protected void addCompletions(@NotNull CompletionParameters parameters,
                              ProcessingContext context,
                              @NotNull CompletionResultSet result) {
    PsiElement position = parameters.getPosition().getOriginalElement();
    if (position == null) {
        return;
    }

    final Collection<PhpClassMember> members = new THashSet<>();
    String prefix = result.getPrefixMatcher().getPrefix();

    if (!(prefix.lastIndexOf("::") > 0 && prefix.lastIndexOf("\\") > 0
            && prefix.lastIndexOf("::") > prefix.lastIndexOf("\\"))) {
        return;
    }

    String className = prefix.substring(0, prefix.lastIndexOf("::"));

    PhpIndex phpIndex = PhpIndex.getInstance(parameters.getPosition().getProject());
    for (PhpClass phpClass : phpIndex.getAnyByFQN(className)) {
        members.addAll(phpClass.getFields());
        members.addAll(phpClass.getMethods());
    }

    for (PhpClassMember member : members) {
        if (Field.class.isInstance(member)) {
            result.addElement(
                    LookupElementBuilder
                            .create(className + (((Field) member).isConstant() ? "::" : "::$") + member.getName())
                            .withIcon(member.getIcon())
            );
        } else {
            result.addElement(
                    LookupElementBuilder
                            .create(className + "::" + member.getName() + "()")
                            .withIcon(member.getIcon())
            );
        }
    }
}
 
开发者ID:magento,项目名称:magento2-phpstorm-plugin,代码行数:42,代码来源:PhpClassMemberCompletionProvider.java

示例7: resolveParameter

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


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