本文整理匯總了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;
}