Java Code Examples for com.intellij.psi.PsiElement#getResolveScope()
The following examples show how to use
com.intellij.psi.PsiElement#getResolveScope() .
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: LogDTemplate.java From android-postfix-plugin with Apache License 2.0 | 6 votes |
@Override public String getTemplateString(@NotNull PsiElement element) { Project project = element.getProject(); final GlobalSearchScope resolveScope = element.getResolveScope(); PsiClass[] buildConfigClasses = PsiShortNamesCache.getInstance(project).getClassesByName("BuildConfig", resolveScope); String buildConfigDebug = "BuildConfig.DEBUG"; if (buildConfigClasses.length != 0) { // Get BuildConfig QualifiedName PsiClass buildConfig = buildConfigClasses[0]; String qualifiedName = buildConfig.getQualifiedName(); buildConfigDebug = qualifiedName + ".DEBUG"; } return "if (" + buildConfigDebug + ") " + getStaticPrefix(LOG, "d", element) + "($TAG$, $expr$)$END$"; }
Example 2
Source File: MemberResolveScopeProcessor.java From consulo-csharp with Apache License 2.0 | 5 votes |
public MemberResolveScopeProcessor(@Nonnull PsiElement scopeElement, @Nonnull Processor<ResolveResult> resultProcessor, @Nullable ExecuteTarget[] targets, @Nullable OverrideProcessor overrideProcessor) { myScopeElement = scopeElement; myResultProcessor = resultProcessor; myResolveScope = scopeElement.getResolveScope(); putUserData(ExecuteTargetUtil.EXECUTE_TARGETS, ExecuteTargetUtil.of(targets)); myOverrideProcessor = overrideProcessor; }
Example 3
Source File: CSharpResolveUtil.java From consulo-csharp with Apache License 2.0 | 4 votes |
@RequiredReadAction public static boolean walkChildren(@Nonnull final PsiScopeProcessor processor, @Nonnull final PsiElement entrance, boolean walkParent, boolean walkDeep, @Nonnull ResolveState state) { if(walkDeep) { state = state.put(WALK_DEEP, Boolean.TRUE); } ProgressIndicatorProvider.checkCanceled(); GlobalSearchScope resolveScope = entrance.getResolveScope(); if(entrance instanceof CSharpTypeDeclaration) { if(!processor.execute(entrance, state)) { return false; } if(walkParent) { PsiElement parent = entrance.getContext(); if(parent == null) { return true; } if(!walkChildren(processor, parent, walkParent, walkDeep, state)) { return false; } } } else if(entrance instanceof CSharpTypeDefStatement) { DotNetTypeRef dotNetTypeRef = ((CSharpTypeDefStatement) entrance).toTypeRef(); DotNetTypeResolveResult typeResolveResult = dotNetTypeRef.resolve(); PsiElement element = typeResolveResult.getElement(); if(element == null) { return true; } CSharpResolveSelector selector = state.get(SELECTOR); ResolveState newState = ResolveState.initial().put(SELECTOR, selector).put(EXTRACTOR, typeResolveResult.getGenericExtractor()); return walkChildren(processor, element, walkParent, walkDeep, newState); } else if(entrance instanceof DotNetGenericParameter) { if(!processor.execute(entrance, state)) { return false; } } else if(entrance instanceof DotNetNamespaceAsElement) { state = state.put(BaseDotNetNamespaceAsElement.RESOLVE_SCOPE, resolveScope); state = state.put(BaseDotNetNamespaceAsElement.FILTER, DotNetNamespaceAsElement.ChildrenFilter.NONE); if(!processor.execute(entrance, state)) { return false; } String parentQName = ((DotNetNamespaceAsElement) entrance).getPresentableParentQName(); // dont go to root namespace if(StringUtil.isEmpty(parentQName)) { return true; } if(walkParent) { DotNetNamespaceAsElement parentNamespace = DotNetPsiSearcher.getInstance(entrance.getProject()).findNamespace(parentQName, resolveScope); if(parentNamespace != null && !walkChildren(processor, parentNamespace, walkParent, walkDeep, state)) { return false; } } } else if(entrance instanceof DotNetNamespaceDeclaration) { String presentableQName = ((DotNetNamespaceDeclaration) entrance).getPresentableQName(); if(presentableQName == null) { return true; } state = state.put(BaseDotNetNamespaceAsElement.RESOLVE_SCOPE, resolveScope); state = state.put(BaseDotNetNamespaceAsElement.FILTER, DotNetNamespaceAsElement.ChildrenFilter.NONE); DotNetNamespaceAsElement namespace = DotNetPsiSearcher.getInstance(entrance.getProject()).findNamespace(presentableQName, resolveScope); if(namespace != null && !walkChildren(processor, namespace, walkParent, walkDeep, state)) { return false; } } return true; }
Example 4
Source File: CSharpTypeRefByQName.java From consulo-csharp with Apache License 2.0 | 4 votes |
@RequiredReadAction public CSharpTypeRefByQName(@Nonnull PsiElement scope, @Nonnull String qualifiedName) { this(scope.getProject(), scope.getResolveScope(), qualifiedName); }
Example 5
Source File: CSharpNullTypeRef.java From consulo-csharp with Apache License 2.0 | 4 votes |
@RequiredReadAction public CSharpNullTypeRef(@Nonnull PsiElement element) { this(element.getProject(), element.getResolveScope()); }