本文整理匯總了Java中com.intellij.psi.ResolveResult.EMPTY_ARRAY屬性的典型用法代碼示例。如果您正苦於以下問題:Java ResolveResult.EMPTY_ARRAY屬性的具體用法?Java ResolveResult.EMPTY_ARRAY怎麽用?Java ResolveResult.EMPTY_ARRAY使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類com.intellij.psi.ResolveResult
的用法示例。
在下文中一共展示了ResolveResult.EMPTY_ARRAY屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: multiResolve
@NotNull
@Override
public ResolveResult[] multiResolve(final boolean incompleteCode) {
final PsiFile originalFile = getElement().getContainingFile();
final Collection<ImpexMacroDeclaration> macroDeclarations =
PsiTreeUtil.findChildrenOfType(
originalFile,
ImpexMacroDeclaration.class
);
if (!macroDeclarations.isEmpty()) {
final ArrayList<PsiElement> references = ContainerUtil.newArrayList();
for (final ImpexMacroDeclaration declaration : macroDeclarations) {
if (getElement().textMatches(declaration.getFirstChild())) {
references.add(declaration.getFirstChild());
}
}
return PsiElementResolveResult.createResults(references);
}
return ResolveResult.EMPTY_ARRAY;
}
開發者ID:AlexanderBartash,項目名稱:hybris-integration-intellij-idea-plugin,代碼行數:22,代碼來源:ImpexMacrosReferenceBase.java
示例2: multiResolve
@NotNull
public ResolveResult[] multiResolve(boolean incompleteCode) {
final String name = getName();
if (name == null) return ResolveResult.EMPTY_ARRAY;
ArrayList<LuaResolveResult> candidates = new ArrayList<LuaResolveResult>();
final PsiElement owner = LuaDocCommentUtil.findDocOwner(this);
if (owner instanceof LuaFunctionDefinition) {
final LuaFunctionDefinition method = (LuaFunctionDefinition)owner;
final LuaParameter[] parameters = method.getParameters().getLuaParameters();
for (LuaParameter parameter : parameters) {
if (name.equals(parameter.getName())) {
candidates.add(new LuaResolveResultImpl(parameter, true));
}
}
return candidates.toArray(new ResolveResult[candidates.size()]);
}
return ResolveResult.EMPTY_ARRAY;
}
示例3: doResolve
@Override
public ResolveResult[] doResolve() {
if (myReferencedName == null) return ResolveResult.EMPTY_ARRAY;
if (EmberJSAsExpression.isAsControllerRef(myRef, myRef.getParent())) {
final JSNamedElementProxy resolve = EmberIndexUtil.resolve(myParent.getProject(), EmberControllerIndex.INDEX_ID, myReferencedName);
if (resolve != null) {
return new JSResolveResult[]{new JSResolveResult(resolve)};
}
} else {
final Collection<JSNamedElement> localVariables = getItemsByName(myReferencedName, myRef);
if (!localVariables.isEmpty()) {
return ContainerUtil.map2Array(localVariables, JSResolveResult.class, new Function<JSNamedElement, JSResolveResult>() {
@Override
public JSResolveResult fun(JSNamedElement item) {
return new JSResolveResult(item);
}
});
}
}
return super.doResolve();
}
示例4: toCandidateInfoArray
@NotNull
public static ResolveResult[] toCandidateInfoArray(@Nullable List<? extends PsiElement> elements) {
if (elements == null) {
return ResolveResult.EMPTY_ARRAY;
}
elements = ContainerUtil.filter(elements, (Condition<PsiElement>) Objects::nonNull);
final ResolveResult[] result = new ResolveResult[elements.size()];
for (int i = 0, size = elements.size(); i < size; i++) {
result[i] = new PsiElementResolveResult(elements.get(i));
}
return result;
}
示例5: multiResolve
@NotNull
@Override
public ResolveResult[] multiResolve(final boolean incompleteCode) {
final TSMetaModel meta = getTypeSystemMeta();
final String featureName = getElement().getText();
final Optional<TSMetaClass> metaClass = findItemTypeReference()
.map(PsiElement::getText)
.map(meta::findMetaClassByName);
if (!metaClass.isPresent()) {
return ResolveResult.EMPTY_ARRAY;
}
final List<ResolveResult> result = metaClass.get()
.findPropertiesByName(featureName, true)
.stream()
.map(TSMetaProperty::retrieveDom)
.filter(Objects::nonNull)
.map(AttributeResolveResult::new)
.collect(Collectors.toCollection(LinkedList::new));
metaClass.get().findReferenceEndsByRole(featureName, true)
.stream()
.map(TSMetaReference.ReferenceEnd::retrieveDom)
.filter(Objects::nonNull)
.map(RelationElementResolveResult::new)
.collect(Collectors.toCollection(() -> result));
return result.toArray(new ResolveResult[result.size()]);
}
開發者ID:AlexanderBartash,項目名稱:hybris-integration-intellij-idea-plugin,代碼行數:30,代碼來源:TypeSystemAttributeReference.java
示例6: multiResolve
@NotNull
public ResolveResult[] multiResolve(boolean incompleteCode) {
final String name = getName();
if (name == null) return ResolveResult.EMPTY_ARRAY;
ArrayList<LuaResolveResult> candidates = new ArrayList<LuaResolveResult>();
final PsiElement owner = LuaDocCommentUtil.findDocOwner(this);
if (owner instanceof LuaTableConstructor) {
LuaExpression[] inits = ((LuaTableConstructor) owner).getInitializers();
for (LuaExpression expr : inits) {
if (expr instanceof LuaKeyValueInitializer) {
final LuaExpression key = ((LuaKeyValueInitializer) expr).getFieldKey();
if (key instanceof LuaFieldIdentifier) {
final LuaFieldIdentifier fieldKey = (LuaFieldIdentifier) key;
if (fieldKey.getName().equals(getName())) candidates.add(new LuaResolveResultImpl(fieldKey,
true));
}
}
}
return candidates.toArray(new ResolveResult[candidates.size()]);
}
return ResolveResult.EMPTY_ARRAY;
}
示例7: multiResolve
@NotNull
@Override
public ResolveResult[] multiResolve(boolean incompleteCode) {
ResolveResult[] results = super.multiResolve(incompleteCode);
if (results.length == 0) {
PsiFile file = myElement.getContainingFile();
if (file instanceof IpnbPyFragment) {
final IpnbFilePanel panel = ((IpnbPyFragment)file).getFilePanel();
final List<IpnbEditablePanel> panels = panel.getIpnbPanels();
final String referencedName = myElement.getReferencedName();
if (referencedName == null) return ResolveResult.EMPTY_ARRAY;
for (IpnbEditablePanel editablePanel : panels) {
if (!(editablePanel instanceof IpnbCodePanel)) continue;
final Editor editor = ((IpnbCodePanel)editablePanel).getEditor();
final IpnbPyFragment psiFile = (IpnbPyFragment)PsiDocumentManager.getInstance(myElement.getProject()).getPsiFile(editor.getDocument());
if (psiFile == null) continue;
ResolveProcessor processor = new ResolveProcessor(referencedName);
PyResolveUtil.scopeCrawlUp(processor, psiFile, referencedName, psiFile);
final List<RatedResolveResult> resultList = getResultsFromProcessor(referencedName, processor, psiFile, psiFile);
if (resultList.size() > 0) {
List<RatedResolveResult> ret = RatedResolveResult.sorted(resultList);
return ret.toArray(new RatedResolveResult[ret.size()]);
}
}
}
}
return results;
}
示例8: multiResolve
@Override
@NotNull
public ResolveResult[] multiResolve(boolean incompleteCode) {
final RngGrammar scope = getScope();
if (scope == null) {
return ResolveResult.EMPTY_ARRAY;
}
final Set<Define> set = DefinitionResolver.resolve(scope, myValue.getValue());
if (set == null || set.size() == 0) return ResolveResult.EMPTY_ARRAY;
return ContainerUtil.map2Array(set, ResolveResult.class, this);
}
示例9: getVariants
@Override
@NotNull
public Object[] getVariants() {
final RngGrammar scope = getScope();
if (scope == null) {
return ResolveResult.EMPTY_ARRAY;
}
final Map<String, Set<Define>> map = DefinitionResolver.getAllVariants(scope);
if (map == null || map.size() == 0) return ArrayUtil.EMPTY_OBJECT_ARRAY;
return ContainerUtil.mapNotNull(map.values(), new Function<Set<Define>, Object>() {
@Override
public Object fun(Set<Define> defines) {
final Define define = defines.iterator().next();
if (defines.size() == 0) {
return null;
} else {
final PsiElement element = define.getPsiElement();
if (element != null) {
final PsiPresentableMetaData data = (PsiPresentableMetaData)((PsiMetaOwner)element).getMetaData();
if (data != null) {
return LookupValueFactory.createLookupValue(data.getName(), data.getIcon());
} else {
return define.getName();
}
} else {
return define.getName();
}
}
}
}).toArray();
}
示例10: resolveInner
@Override
protected ResolveResult[] resolveInner(boolean incompleteCode, PsiFile containingFile) {
File containingDirectory = ((BuildFile) containingFile).getFile().getParentFile();
if (containingDirectory == null) {
return ResolveResult.EMPTY_ARRAY;
}
List<String> includes = resolveListContents(element.getIncludes());
List<String> excludes = resolveListContents(element.getExcludes());
boolean directoriesExcluded = element.areDirectoriesExcluded();
if (includes.isEmpty()) {
return ResolveResult.EMPTY_ARRAY;
}
Project project = element.getProject();
try {
List<File> files =
UnixGlob.forPath(containingDirectory)
.addPatterns(includes)
.addExcludes(excludes)
.setExcludeDirectories(directoriesExcluded)
.setDirectoryFilter(directoryFilter(project, containingDirectory.getPath()))
.glob();
List<ResolveResult> results = Lists.newArrayListWithCapacity(files.size());
for (File file : files) {
PsiFileSystemItem psiFile = BuildReferenceManager.getInstance(project).resolveFile(file);
if (psiFile != null) {
results.add(new PsiElementResolveResult(psiFile));
}
}
return results.toArray(ResolveResult.EMPTY_ARRAY);
} catch (Exception e) {
return ResolveResult.EMPTY_ARRAY;
}
}
示例11: multiResolve
@NotNull
@Override
public ResolveResult[] multiResolve(boolean incompleteCode) {
final PsiElement resolve = resolve();
if(resolve != null) {
return new ResolveResult[] { new PsiElementResolveResult(resolve) };
}
return ResolveResult.EMPTY_ARRAY;
}
開發者ID:jimkyndemeyer,項目名稱:js-graphql-intellij-plugin,代碼行數:9,代碼來源:JSGraphQLEndpointImportFileReferencePsiElement.java
示例12: multiResolve
@NotNull
public ResolveResult[] multiResolve(boolean incompleteCode) {
final RngGrammar scope = getScope();
if (scope == null) {
return ResolveResult.EMPTY_ARRAY;
}
final Set<Define> set = DefinitionResolver.resolve(scope, myValue.getValue());
if (set == null || set.size() == 0) return ResolveResult.EMPTY_ARRAY;
return ContainerUtil.map2Array(set, ResolveResult.class, this);
}
示例13: getVariants
@NotNull
public Object[] getVariants() {
final RngGrammar scope = getScope();
if (scope == null) {
return ResolveResult.EMPTY_ARRAY;
}
final Map<String, Set<Define>> map = DefinitionResolver.getAllVariants(scope);
if (map == null || map.size() == 0) return ArrayUtil.EMPTY_OBJECT_ARRAY;
return ContainerUtil.mapNotNull(map.values(), new Function<Set<Define>, Object>() {
public Object fun(Set<Define> defines) {
final Define define = defines.iterator().next();
if (defines.size() == 0) {
return null;
} else {
final PsiElement element = define.getPsiElement();
if (element != null) {
final PsiPresentableMetaData data = (PsiPresentableMetaData)((PsiMetaOwner)element).getMetaData();
if (data != null) {
return LookupValueFactory.createLookupValue(data.getName(), data.getIcon());
} else {
return define.getName();
}
} else {
return define.getName();
}
}
}
}).toArray();
}
示例14: multiResolve
@NotNull
public ResolveResult[] multiResolve(boolean incompleteCode) {
final PsiElement parent = getParent();
if (parent instanceof GrConstructorInvocation) {
return ((GrConstructorInvocation)parent).multiResolve(incompleteCode);
}
return ResolveResult.EMPTY_ARRAY;
}
示例15: resolve
@NotNull
@Override
public ResolveResult[] resolve(@NotNull GrThisSuperReferenceExpressionBase ref, boolean incompleteCode) {
final PsiElement resolved = ref.resolveInner();
if (resolved == null) return ResolveResult.EMPTY_ARRAY;
return new GroovyResolveResult[]{new GroovyResolveResultImpl(resolved, true)};
}