本文整理汇总了Java中com.intellij.psi.scope.PsiScopeProcessor类的典型用法代码示例。如果您正苦于以下问题:Java PsiScopeProcessor类的具体用法?Java PsiScopeProcessor怎么用?Java PsiScopeProcessor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PsiScopeProcessor类属于com.intellij.psi.scope包,在下文中一共展示了PsiScopeProcessor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processChildDeclarations
import com.intellij.psi.scope.PsiScopeProcessor; //导入依赖的package包/类
public static boolean processChildDeclarations(PsiElement element,
PsiScopeProcessor processor, ResolveState substitutor,
PsiElement lastParent, PsiElement place) {
PsiElement run = (lastParent == null) ? element.getLastChild()
: lastParent.getPrevSibling();
while (run != null) {
if (!run.processDeclarations(processor, substitutor, null, place)) {
return false;
}
run = run.getPrevSibling();
}
return true;
}
示例2: processDeclarations
import com.intellij.psi.scope.PsiScopeProcessor; //导入依赖的package包/类
public boolean processDeclarations(@NotNull
PsiScopeProcessor processor, @NotNull
ResolveState resolveState, PsiElement lastParent, @NotNull
PsiElement place) {
if ((lastParent != null) && (lastParent.getParent() == this)) {
final LuaParameter[] params = getParameters().getLuaParameters();
for (LuaParameter param : params) {
if (!processor.execute(param, resolveState)) {
return false;
}
}
}
return true;
}
示例3: processDeclarations
import com.intellij.psi.scope.PsiScopeProcessor; //导入依赖的package包/类
public boolean processDeclarations(@NotNull PsiScopeProcessor processor,
@NotNull ResolveState resolveState,
PsiElement lastParent,
@NotNull PsiElement place) {
PsiElement parent = place.getParent();
while(parent != null && !(parent instanceof LuaPsiFile)) {
if (parent == getBlock() ) {
LuaExpression[] names = getIndices();
for (LuaExpression name : names) {
if (!processor.execute(name, resolveState)) return false;
}
}
parent = parent.getParent();
}
return true;
}
示例4: processDeclarations
import com.intellij.psi.scope.PsiScopeProcessor; //导入依赖的package包/类
public boolean processDeclarations(@NotNull PsiScopeProcessor processor,
@NotNull ResolveState resolveState,
PsiElement lastParent,
@NotNull PsiElement place) {
PsiElement parent = place.getParent();
while (parent != null && !(parent instanceof LuaPsiFile)) {
if (parent == getBlock()) {
if (!processor.execute(getIndex(), resolveState)) return false;
}
parent = parent.getParent();
}
return true;
}
示例5: process
import com.intellij.psi.scope.PsiScopeProcessor; //导入依赖的package包/类
@Override
public void process(@NotNull List<String> methodCallInfo,
@NotNull PsiScopeProcessor processor,
@NotNull ResolveState state,
@NotNull PsiElement place) {
if (methodCallInfo.isEmpty() || methodCallInfo.size() < 3 ||
!"repositories".equals(methodCallInfo.get(2)) || !"maven".equals(methodCallInfo.get(1))) {
return;
}
GroovyPsiManager psiManager = GroovyPsiManager.getInstance(place.getProject());
GradleResolverUtil.processDeclarations(
psiManager, processor, state, place,
GradleCommonClassNames.GRADLE_API_ARTIFACTS_REPOSITORIES_MAVEN_ARTIFACT_REPOSITORY);
PsiClass contributorClass = psiManager.findClassWithCache(
GradleCommonClassNames.GRADLE_API_ARTIFACTS_REPOSITORIES_MAVEN_ARTIFACT_REPOSITORY, place.getResolveScope());
if (contributorClass == null) return;
GradleResolverUtil.processMethod(methodCallInfo.get(0), contributorClass, processor, state, place);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:GradleMavenArtifactRepositoryContributor.java
示例6: processDeclarations
import com.intellij.psi.scope.PsiScopeProcessor; //导入依赖的package包/类
@Override
public boolean processDeclarations(@NotNull PsiScopeProcessor processor,
@NotNull ResolveState state,
@Nullable PsiElement lastParent,
@NotNull PsiElement place) {
if (isAncestor(place)) {
return true;
}
if (isStatic() && lastParent instanceof GrImportStatement) return true;
if (isOnDemand()) {
if (!processDeclarationsForMultipleElements(processor, lastParent, place, state)) return false;
}
else {
if (!processDeclarationsForSingleElement(processor, lastParent, place, state)) return false;
}
return true;
}
示例7: categoryIteration
import com.intellij.psi.scope.PsiScopeProcessor; //导入依赖的package包/类
public static boolean categoryIteration(GrClosableBlock place, final PsiScopeProcessor processor, ResolveState state) {
final ClassHint classHint = processor.getHint(ClassHint.KEY);
if (classHint != null && !classHint.shouldProcess(ClassHint.ResolveKind.METHOD)) return true;
final GrMethodCall call = checkMethodCall(place, USE);
if (call == null) return true;
final GrClosableBlock[] closures = call.getClosureArguments();
GrExpression[] args = call.getExpressionArguments();
if (!(placeEqualsSingleClosureArg(place, closures) || placeEqualsLastArg(place, args))) return true;
if (!(call.resolveMethod() instanceof GrGdkMethod)) return true;
state = state.put(ClassHint.RESOLVE_CONTEXT, call);
if ((args.length == 1 || args.length == 2 && placeEqualsLastArg(place, args))) {
PsiType type = args[0].getType();
if (type instanceof GrTupleType) {
return processTypesFromTuple((GrTupleType)type, processor, state, place);
}
}
return processTypesFomArgs(args, processor, state, place);
}
示例8: walkChildrenScopes
import com.intellij.psi.scope.PsiScopeProcessor; //导入依赖的package包/类
public static boolean walkChildrenScopes(@NotNull PsiElement thisElement,
@NotNull PsiScopeProcessor processor,
@NotNull ResolveState state,
PsiElement lastParent,
PsiElement place) {
PsiElement child = null;
if (lastParent != null && lastParent.getParent() == thisElement) {
child = lastParent.getPrevSibling();
if (child == null) return true; // first element
}
if (child == null) {
child = thisElement.getLastChild();
}
while (child != null) {
if (!child.processDeclarations(processor, state, null, place)) return false;
child = child.getPrevSibling();
}
return true;
}
示例9: getVisibleImports
import com.intellij.psi.scope.PsiScopeProcessor; //导入依赖的package包/类
@NotNull
public static List<PyImportElement> getVisibleImports(@NotNull ScopeOwner owner) {
final List<PyImportElement> visibleImports = new ArrayList<PyImportElement>();
PyResolveUtil.scopeCrawlUp(new PsiScopeProcessor() {
@Override
public boolean execute(@NotNull PsiElement element, @NotNull ResolveState state) {
if (element instanceof PyImportElement) {
visibleImports.add((PyImportElement)element);
}
return true;
}
@Nullable
@Override
public <T> T getHint(@NotNull Key<T> hintKey) {
return null;
}
@Override
public void handleEvent(@NotNull Event event, @Nullable Object associated) {
}
}, owner, null, null);
return visibleImports;
}
示例10: processClassLevelDeclarations
import com.intellij.psi.scope.PsiScopeProcessor; //导入依赖的package包/类
@Override
public boolean processClassLevelDeclarations(@NotNull PsiScopeProcessor processor) {
final PyClassStub stub = getStub();
if (stub != null) {
final List<StubElement> children = stub.getChildrenStubs();
for (StubElement child : children) {
if (!processor.execute(child.getPsi(), ResolveState.initial())) {
return false;
}
}
}
else {
PyResolveUtil.scopeCrawlUp(processor, this, null, this);
}
return true;
}
示例11: processDeclarations
import com.intellij.psi.scope.PsiScopeProcessor; //导入依赖的package包/类
@Override
public boolean processDeclarations(@NotNull PsiScopeProcessor processor, @NotNull ResolveState state, PsiElement lastParent, @NotNull PsiElement place) {
processor.handleEvent(PsiScopeProcessor.Event.SET_DECLARATION_HOLDER, this);
PsiElement[] decls = getDeclaredElements();
for (PsiElement decl : decls) {
if (decl != lastParent) {
if (!processor.execute(decl, state)) return false;
}
else {
final ElementClassHint hint = processor.getHint(ElementClassHint.KEY);
if (lastParent instanceof PsiClass) {
if (hint == null || hint.shouldProcess(ElementClassHint.DeclarationKind.CLASS)) {
if (!processor.execute(lastParent, state)) return false;
}
}
}
}
return true;
}
示例12: processStaticImports
import com.intellij.psi.scope.PsiScopeProcessor; //导入依赖的package包/类
public static boolean processStaticImports(@NotNull PsiScopeProcessor resolver,
@NotNull PsiFile file,
@NotNull ResolveState state,
@NotNull PsiElement place) {
if (!shouldProcessMethods(resolver.getHint(ClassHint.KEY))) return true;
return file.processDeclarations(new GrDelegatingScopeProcessorWithHints(resolver, null, ClassHint.RESOLVE_KINDS_METHOD) {
@Override
public boolean execute(@NotNull PsiElement element, @NotNull ResolveState _state) {
if (_state.get(RESOLVE_CONTEXT) instanceof GrImportStatement) {
super.execute(element, _state);
}
return true;
}
}, state, null, place);
}
示例13: processDeclarations
import com.intellij.psi.scope.PsiScopeProcessor; //导入依赖的package包/类
@Override
public boolean processDeclarations(@NotNull PsiScopeProcessor processor,
@NotNull ResolveState state,
@Nullable PsiElement lastParent,
@NotNull PsiElement place) {
if (!ResolveUtil.shouldProcessProperties(processor.getHint(ClassHint.KEY))) return true;
if (lastParent != null && !(getParent() instanceof GrTypeDefinitionBody) && lastParent == getTupleInitializer()) {
return true;
}
for (final GrVariable variable : getVariables()) {
if (lastParent == variable) break;
if (lastParent instanceof GrMethod && !(variable instanceof GrField)) break;
if (!ResolveUtil.processElement(processor, variable, state)) return false;
}
return true;
}
示例14: resolveToMethodWithClosure
import com.intellij.psi.scope.PsiScopeProcessor; //导入依赖的package包/类
private static void resolveToMethodWithClosure(PsiElement place,
PsiElement resolveToElement,
String closureTypeFqcn,
PsiScopeProcessor processor,
ResolveState state,
GroovyPsiManager psiManager) {
if (place.getParent() instanceof GrMethodCallExpression) {
GrLightMethodBuilder methodWithClosure =
GradleResolverUtil.createMethodWithClosure(place.getText(), closureTypeFqcn, null, place, psiManager);
if (methodWithClosure != null) {
processor.execute(methodWithClosure, state);
methodWithClosure.setNavigationElement(resolveToElement);
}
} else if (place.getParent() instanceof GrReferenceExpression) {
GrLightVariable variable = new GrLightVariable(place.getManager(), place.getText(), closureTypeFqcn, place);
processor.execute(variable, state);
}
}
示例15: processDeclarations
import com.intellij.psi.scope.PsiScopeProcessor; //导入依赖的package包/类
@Override
public boolean processDeclarations(@NotNull final PsiScopeProcessor processor,
@NotNull final ResolveState state,
PsiElement lastParent,
@NotNull PsiElement place) {
assert isValid();
if (processor instanceof ClassResolverProcessor &&
isPhysical() &&
(getUserData(PsiFileEx.BATCH_REFERENCE_PROCESSING) == Boolean.TRUE || myResolveCache.hasUpToDateValue())) {
final ClassResolverProcessor hint = (ClassResolverProcessor)processor;
String name = hint.getName(state);
MostlySingularMultiMap<String, SymbolCollectingProcessor.ResultWithContext> cache = myResolveCache.getValue();
MyResolveCacheProcessor cacheProcessor = new MyResolveCacheProcessor(processor, state);
return name != null ? cache.processForKey(name, cacheProcessor) : cache.processAllValues(cacheProcessor);
}
return processDeclarationsNoGuess(processor, state, lastParent, place);
}