本文整理汇总了Java中com.intellij.psi.PsiReference.EMPTY_ARRAY属性的典型用法代码示例。如果您正苦于以下问题:Java PsiReference.EMPTY_ARRAY属性的具体用法?Java PsiReference.EMPTY_ARRAY怎么用?Java PsiReference.EMPTY_ARRAY使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.intellij.psi.PsiReference
的用法示例。
在下文中一共展示了PsiReference.EMPTY_ARRAY属性的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getReferencesByElement
@NotNull
@Override
public PsiReference[] getReferencesByElement(@NotNull PsiElement element, @NotNull ProcessingContext context) {
if (!(element instanceof XmlElement)) {
return PsiReference.EMPTY_ARRAY;
}
List<PsiReference> psiReferences = new ArrayList<>();
String methodName = StringUtil.unquoteString(element.getText());
PhpClass phpClass = DiIndex.getPhpClassOfServiceMethod((XmlElement) element);
if (phpClass != null) {
Collection<Method> methods = phpClass.getMethods();
methods.removeIf(m -> !m.getName().equalsIgnoreCase(methodName));
psiReferences.add(new PolyVariantReferenceBase(element, methods));
}
return psiReferences.toArray(new PsiReference[psiReferences.size()]);
}
示例2: getReferencesByElement
@NotNull
@Override
public PsiReference[] getReferencesByElement(@NotNull PsiElement element, @NotNull ProcessingContext context) {
String value = StringUtil.unquoteString(element.getText());
DiIndex index = DiIndex.getInstance(element.getProject());
Collection<PsiElement> targets = index.getVirtualTypeElements(value, element.getResolveScope());
if (!(targets.size() > 0)) {
return PsiReference.EMPTY_ARRAY;
}
return new PsiReference[] {
new PolyVariantReferenceBase(element, targets)
};
}
示例3: getReferencesByElement
@NotNull
@Override
public PsiReference[] getReferencesByElement(@NotNull PsiElement element, @NotNull ProcessingContext context) {
String value = StringUtil.unquoteString(element.getText());
Collection<PsiElement> targets = EventIndex.getInstance(element.getProject())
.getEventElements(
value,
GlobalSearchScope.getScopeRestrictedByFileTypes(
GlobalSearchScope.allScope(element.getProject()),
XmlFileType.INSTANCE
)
);
if (targets.size() > 0) {
return new PsiReference[] {new PolyVariantReferenceBase(element, targets)};
}
return PsiReference.EMPTY_ARRAY;
}
示例4: getReferencesByElement
@NotNull
@Override
public PsiReference[] getReferencesByElement(@NotNull PsiElement element, @NotNull ProcessingContext context) {
String parameterName = StringUtil.unquoteString(element.getText());
if (parameterName.isEmpty() || !(element instanceof XmlElement)) {
return PsiReference.EMPTY_ARRAY;
}
DiIndex diIndex = DiIndex.getInstance(element.getProject());
PhpClass phpClass = diIndex.getPhpClassOfArgument((XmlElement) element);
if (phpClass != null) {
Method constructor = phpClass.getConstructor();
if (constructor != null) {
Collection<Parameter> parameterList = new THashSet<>(Arrays.asList(constructor.getParameters()));
parameterList.removeIf(p -> !p.getName().contains(parameterName));
if (parameterList.size() > 0) {
return new PsiReference[] {new PolyVariantReferenceBase(element, parameterList)};
}
}
}
return PsiReference.EMPTY_ARRAY;
}
开发者ID:magento,项目名称:magento2-phpstorm-plugin,代码行数:25,代码来源:PhpConstructorArgumentReferenceProvider.java
示例5: getReferencesByElement
@NotNull
@Override
public PsiReference[] getReferencesByElement(@NotNull PsiElement element, @NotNull ProcessingContext context) {
String value = StringUtil.unquoteString(element.getText());
Collection<VirtualFile> containingFiles = FileBasedIndex.getInstance()
.getContainingFiles(EventNameIndex.KEY, value,
GlobalSearchScope.getScopeRestrictedByFileTypes(
GlobalSearchScope.allScope(element.getProject()),
PhpFileType.INSTANCE
)
);
PsiManager psiManager = PsiManager.getInstance(element.getProject());
for (VirtualFile virtualFile: containingFiles) {
PhpFile phpFile = (PhpFile) psiManager.findFile(virtualFile);
if (phpFile != null) {
List<PsiElement> psiElements = new ArrayList<>();
recursiveFill(psiElements, phpFile, value);
if (psiElements.size() > 0) {
return new PsiReference[] {new PolyVariantReferenceBase(element, psiElements)};
}
}
}
return PsiReference.EMPTY_ARRAY;
}
示例6: getReferences
@NotNull
@Override
public final PsiReference[] getReferences() {
final IElementType leafType = Optional.ofNullable(getFirstChild())
.map(PsiElement::getNode)
.map(ASTNode::getElementType)
.orElse(null);
if (ImpexTypes.MACRO_USAGE.equals(leafType)) {
return new PsiReference[]{new ImpexMacrosReferenceBase(this)};
}
//optimisation: dont even try for macro's and documents
if (!ImpexTypes.HEADER_PARAMETER_NAME.equals(leafType)) {
return PsiReference.EMPTY_ARRAY;
}
if (myReference == null) {
myReference = new TypeSystemAttributeReference(this);
}
return new PsiReference[]{myReference};
}
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:21,代码来源:ImpexAnyHeaderParameterNameMixin.java
示例7: getReferencesByElement
@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()]);
}
示例8: getReferencesByElement
@NotNull
@Override
public PsiReference[] getReferencesByElement(@NotNull PsiElement element, @NotNull ProcessingContext context) {
String value = StringUtil.unquoteString(element.getText());
List<XmlTag> targets = LayoutIndex.getContainerDeclarations(value, element.getProject());
if (targets.size() > 0) {
return new PsiReference[] {new PolyVariantReferenceBase(element, targets)};
}
return PsiReference.EMPTY_ARRAY;
}
示例9: getReferencesByElement
@NotNull
@Override
public PsiReference[] getReferencesByElement(@NotNull PsiElement element, @NotNull ProcessingContext context) {
String value = StringUtil.unquoteString(element.getText());
List<XmlFile> targets = LayoutIndex.getLayoutFiles(element.getProject(), value);
if (targets.size() > 0) {
return new PsiReference[] {new PolyVariantReferenceBase(element, targets)};
}
return PsiReference.EMPTY_ARRAY;
}
示例10: getReferencesByElement
@NotNull
@Override
public PsiReference[] getReferencesByElement(@NotNull PsiElement element, @NotNull ProcessingContext context) {
String value = StringUtil.unquoteString(element.getText());
List<XmlTag> targets = LayoutIndex.getBlockDeclarations(value, element.getProject());
if (targets.size() > 0) {
return new PsiReference[] {new PolyVariantReferenceBase(element, targets)};
}
return PsiReference.EMPTY_ARRAY;
}