本文整理汇总了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;
}
示例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()]);
}
示例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<>();
}
}
示例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);
}
示例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();
}
示例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())
);
}
}
}
示例7: resolveParameter
import com.jetbrains.php.PhpIndex; //导入方法依赖的package包/类
@NotNull
protected Collection<PhpClass> resolveParameter(@NotNull PhpIndex phpIndex, @NotNull String parameter) {
return phpIndex.getAnyByFQN(parameter);
}