Java Code Examples for com.intellij.psi.ResolveResult#EMPTY_ARRAY
The following examples show how to use
com.intellij.psi.ResolveResult#EMPTY_ARRAY .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SignalSlotMethodReference.java From idea-php-typo3-plugin with MIT License | 6 votes |
@NotNull @Override public ResolveResult[] multiResolve(boolean incompleteCode) { if (classFqn.isEmpty()) { return ResolveResult.EMPTY_ARRAY; } List<ResolveResult> results = new ArrayList<>(); PsiElement[] psiElements = SignalSlotDispatcherUtil.getSignalPsiElements(myElement.getProject(), classFqn, methodName); for (PsiElement psiElement : psiElements) { results.add(new PsiElementResolveResult(psiElement)); } return results.toArray(new ResolveResult[0]); }
Example 2
Source File: UserFuncReference.java From idea-php-typo3-plugin with MIT License | 6 votes |
@NotNull @Override public ResolveResult[] multiResolve(boolean incompleteCode) { if (this.methodName == null) { return ResolveResult.EMPTY_ARRAY; } if (this.className == null) { Collection<Function> functionsByName = PhpIndex.getInstance(myElement.getProject()).getFunctionsByName(methodName); return PsiElementResolveResult.createResults(functionsByName); } String s = "#M#C\\" + this.className.replace("\\\\", "\\") + "." + this.methodName; Collection<? extends PhpNamedElement> bySignature = PhpIndex.getInstance(myElement.getProject()).getBySignature(s); return PsiElementResolveResult.createResults(bySignature); }
Example 3
Source File: ViewHelperReference.java From idea-php-typo3-plugin with MIT License | 6 votes |
@NotNull @Override public ResolveResult[] multiResolve(boolean incompleteCode) { if (myElement instanceof FluidViewHelperReference) { FluidViewHelperExpr viewHelperExpr = (FluidViewHelperExpr) PsiTreeUtil.findFirstParent(myElement, e -> e instanceof FluidViewHelperExpr); String presentableName = viewHelperExpr.getPresentableName(); ViewHelper viewHelperByName = ViewHelperUtil.getViewHelperByName(myElement, presentableName); if (viewHelperByName == null) { return ResolveResult.EMPTY_ARRAY; } return PsiElementResolveResult.createResults(PhpIndex.getInstance(myElement.getProject()).getClassesByFQN(viewHelperByName.fqn)); } return ResolveResult.EMPTY_ARRAY; }
Example 4
Source File: CSharpReferenceExpressionImplUtil.java From consulo-csharp with Apache License 2.0 | 5 votes |
@Nonnull @RequiredReadAction public static ResolveResult[] tryResolveFromQualifier(@Nonnull CSharpReferenceExpressionEx expression, @Nonnull PsiElement qualifierElement) { if(!expression.isValid()) { return ResolveResult.EMPTY_ARRAY; } ParamatizeValue paramatizeValue = CachedValuesManager.getCachedValue(expression, () -> CachedValueProvider.Result.create(new ParamatizeValue(), PsiModificationTracker.MODIFICATION_COUNT)); return paramatizeValue.get(qualifierElement, element -> tryResolveFromQualifierImpl(expression, element)); }
Example 5
Source File: CSharpDictionaryInitializerImpl.java From consulo-csharp with Apache License 2.0 | 5 votes |
@Nonnull @Override @RequiredReadAction public ResolveResult[] multiResolve(boolean b) { CSharpArrayInitializerOwner arrayInitializerOwner = PsiTreeUtil.getParentOfType(this, CSharpArrayInitializerOwner.class); if(arrayInitializerOwner instanceof CSharpNewExpressionImpl) { DotNetTypeRef typeRef = ((CSharpNewExpressionImpl) arrayInitializerOwner).toTypeRef(false); if(typeRef == DotNetTypeRef.ERROR_TYPE) { return ResolveResult.EMPTY_ARRAY; } DotNetTypeResolveResult typeResolveResult = typeRef.resolve(); PsiElement resolvedElement = typeResolveResult.getElement(); if(resolvedElement == null) { return ResolveResult.EMPTY_ARRAY; } CSharpResolveOptions options = new CSharpResolveOptions(CSharpReferenceExpression.ResolveToKind.METHOD, new MemberByNameSelector("Add"), this, this, false, true); CommonProcessors.CollectProcessor<ResolveResult> processor = new CommonProcessors.CollectProcessor<ResolveResult>(); CSharpReferenceExpressionImplUtil.collectResults(options, typeResolveResult.getGenericExtractor(), resolvedElement, processor); return processor.toArray(ResolveResult.ARRAY_FACTORY); } return ResolveResult.EMPTY_ARRAY; }
Example 6
Source File: CSharpArrayInitializerSingleValueImpl.java From consulo-csharp with Apache License 2.0 | 5 votes |
@Nonnull @Override @RequiredReadAction public ResolveResult[] multiResolve(boolean b) { CSharpArrayInitializerOwner arrayInitializerOwner = PsiTreeUtil.getParentOfType(this, CSharpArrayInitializerOwner.class); if(arrayInitializerOwner instanceof CSharpNewExpressionImpl) { DotNetTypeRef typeRef = ((CSharpNewExpressionImpl) arrayInitializerOwner).toTypeRef(false); if(typeRef == DotNetTypeRef.ERROR_TYPE) { return ResolveResult.EMPTY_ARRAY; } DotNetTypeResolveResult typeResolveResult = typeRef.resolve(); PsiElement resolvedElement = typeResolveResult.getElement(); if(resolvedElement == null) { return ResolveResult.EMPTY_ARRAY; } CSharpResolveOptions options = new CSharpResolveOptions(CSharpReferenceExpression.ResolveToKind.METHOD, new MemberByNameSelector("Add"), this, this, false, true); CommonProcessors.CollectProcessor<ResolveResult> processor = new CommonProcessors.CollectProcessor<ResolveResult>(); CSharpReferenceExpressionImplUtil.collectResults(options, typeResolveResult.getGenericExtractor(), resolvedElement, processor); return processor.toArray(ResolveResult.ARRAY_FACTORY); } return ResolveResult.EMPTY_ARRAY; }
Example 7
Source File: CSharpArrayInitializerCompositeValueImpl.java From consulo-csharp with Apache License 2.0 | 5 votes |
@Nonnull @Override @RequiredReadAction public ResolveResult[] multiResolve(boolean incompleteCode) { CSharpArrayInitializerOwner arrayInitializerOwner = PsiTreeUtil.getParentOfType(this, CSharpArrayInitializerOwner.class); if(arrayInitializerOwner instanceof CSharpNewExpressionImpl) { DotNetTypeRef typeRef = ((CSharpNewExpressionImpl) arrayInitializerOwner).toTypeRef(false); if(typeRef == DotNetTypeRef.ERROR_TYPE) { return ResolveResult.EMPTY_ARRAY; } DotNetTypeResolveResult typeResolveResult = typeRef.resolve(); PsiElement resolvedElement = typeResolveResult.getElement(); if(resolvedElement == null) { return ResolveResult.EMPTY_ARRAY; } CSharpResolveOptions options = new CSharpResolveOptions(CSharpReferenceExpression.ResolveToKind.METHOD, new MemberByNameSelector("Add"), this, this, false, true); CommonProcessors.CollectProcessor<ResolveResult> processor = new CommonProcessors.CollectProcessor<ResolveResult>(); CSharpReferenceExpressionImplUtil.collectResults(options, typeResolveResult.getGenericExtractor(), resolvedElement, processor); return processor.toArray(ResolveResult.ARRAY_FACTORY); } return ResolveResult.EMPTY_ARRAY; }
Example 8
Source File: CSharpStubAttributeImpl.java From consulo-csharp with Apache License 2.0 | 5 votes |
@Nonnull @Override public ResolveResult[] multiResolve(boolean incompleteCode) { CSharpReferenceExpression ref = getReferenceExpression(); if(ref == null) { return ResolveResult.EMPTY_ARRAY; } return ref.multiResolve(incompleteCode); }
Example 9
Source File: CSharpMethodCallExpressionImpl.java From consulo-csharp with Apache License 2.0 | 5 votes |
@Nonnull @Override @RequiredReadAction public ResolveResult[] multiResolve(boolean incompleteCode) { DotNetExpression callExpression = getCallExpression(); if(callExpression instanceof CSharpReferenceExpression) { return ((CSharpReferenceExpression) callExpression).multiResolve(incompleteCode); } else { DotNetTypeRef typeRef = callExpression.toTypeRef(true); DotNetTypeResolveResult typeResolveResult = typeRef.resolve(); PsiElement element = typeResolveResult.getElement(); CSharpMethodDeclaration declaration = CSharpLambdaResolveResultUtil.getDelegateMethodTypeWrapper(element); if(declaration != null) { declaration = GenericUnwrapTool.extract(declaration, typeResolveResult.getGenericExtractor()); MethodResolvePriorityInfo calcResult = NCallArgumentBuilder.calc(this, declaration, this); return new ResolveResult[]{MethodResolveResult.createResult(calcResult, declaration, null)}; } return ResolveResult.EMPTY_ARRAY; } }
Example 10
Source File: CSharpAttributeImpl.java From consulo-csharp with Apache License 2.0 | 5 votes |
@Nonnull @Override public ResolveResult[] multiResolve(boolean incompleteCode) { CSharpReferenceExpression ref = getReferenceExpression(); if(ref == null) { return ResolveResult.EMPTY_ARRAY; } return ref.multiResolve(incompleteCode); }
Example 11
Source File: CSharpNewExpressionImpl.java From consulo-csharp with Apache License 2.0 | 5 votes |
@Nonnull @Override public ResolveResult[] multiResolve(boolean incompleteCode) { if(!canResolve()) { return ResolveResult.EMPTY_ARRAY; } DotNetReferenceExpression expressionForResolving = getExpressionForResolving(); return expressionForResolving != null ? expressionForResolving.multiResolve(incompleteCode) : ResolveResult.EMPTY_ARRAY; }
Example 12
Source File: ContextReference.java From idea-php-typo3-plugin with MIT License | 5 votes |
@NotNull @Override public ResolveResult[] multiResolve(boolean incompleteCode) { if (myElement instanceof StringLiteralExpression) { String aspectFQN = TYPO3Utility.getFQNByAspectName(((StringLiteralExpression) myElement).getContents()); if (aspectFQN == null) { return ResolveResult.EMPTY_ARRAY; } return PsiElementResolveResult.createResults(PhpIndex.getInstance(myElement.getProject()).getClassesByFQN(aspectFQN)); } return ResolveResult.EMPTY_ARRAY; }
Example 13
Source File: JSGraphQLEndpointImportFileReferencePsiElement.java From js-graphql-intellij-plugin with MIT License | 5 votes |
@NotNull @Override public ResolveResult[] multiResolve(boolean incompleteCode) { final PsiElement resolve = resolve(); if(resolve != null) { return new ResolveResult[] { new PsiElementResolveResult(resolve) }; } return ResolveResult.EMPTY_ARRAY; }
Example 14
Source File: GlobReference.java From intellij with Apache License 2.0 | 5 votes |
@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; } }
Example 15
Source File: ModuleProvider.java From idea-php-typo3-plugin with MIT License | 5 votes |
@NotNull @Override protected ResolveResult[] resolveElement(@NotNull PsiElement psiElement, @NotNull String s) { if (!s.startsWith(JavaScriptUtil.MODULE_PREFIX)) { return ResolveResult.EMPTY_ARRAY; } List<PsiFile> moduleFilesFor = JavaScriptUtil.findModuleFilesFor(psiElement.getProject(), s); if (moduleFilesFor.isEmpty()) { return ResolveResult.EMPTY_ARRAY; } return JSResolveResult.toResolveResults(moduleFilesFor); }
Example 16
Source File: CSharpReferenceExpressionImplUtil.java From consulo-csharp with Apache License 2.0 | 4 votes |
@RequiredReadAction @Nonnull public static ResolveResult[] multiResolve(CSharpReferenceExpressionEx expression, final boolean incompleteCode, final boolean resolveFromParent) { if(!expression.isValid()) { return ResolveResult.EMPTY_ARRAY; } ResolveResult[] resolveResults; CSharpReferenceExpressionImplUtil.OurResolver resolver = CSharpReferenceExpressionImplUtil.OurResolver.INSTANCE; if(isCacheDisabled(expression)) { resolveResults = resolver.resolve(expression, resolveFromParent); } else { resolveResults = ResolveCache.getInstance(expression.getProject()).resolveWithCaching(expression, resolver, false, resolveFromParent); } if(incompleteCode) { return resolveResults; } else { ResolveResult[] validResults = CSharpResolveUtil.filterValidResults(resolveResults); if(validResults.length > 0) { return validResults; } else if(resolveResults.length > 0) { ResolveToKind kind = expression.kind(); switch(kind) { case CONSTRUCTOR: case METHOD: return resolveResults; } } return ResolveResult.EMPTY_ARRAY; } }
Example 17
Source File: CSharpAbstractLightAttributeBuilder.java From consulo-csharp with Apache License 2.0 | 4 votes |
@Nonnull @Override public ResolveResult[] multiResolve(boolean incompleteCode) { return ResolveResult.EMPTY_ARRAY; }
Example 18
Source File: CSharpArglistExpressionImpl.java From consulo-csharp with Apache License 2.0 | 4 votes |
@Nonnull @Override public ResolveResult[] multiResolve(boolean b) { return ResolveResult.EMPTY_ARRAY; }