use of com.intellij.psi.scope.NameHint in project intellij-community by JetBrains.
the class GdkMethodHolder method processMethods.
public boolean processMethods(PsiScopeProcessor processor, @NotNull ResolveState state, PsiType qualifierType, Project project) {
if (qualifierType == null)
return true;
NameHint nameHint = processor.getHint(NameHint.KEY);
String name = nameHint == null ? null : nameHint.getName(state);
final MultiMap<String, PsiMethod> map = name != null ? myOriginalMethodsByNameAndType.get(name) : myOriginalMethodByType.getValue();
if (map.isEmpty()) {
return true;
}
for (String superType : ResolveUtil.getAllSuperTypes(qualifierType, project)) {
for (PsiMethod method : map.get(superType)) {
String info = GdkMethodUtil.generateOriginInfo(method);
GrGdkMethod gdk = GrGdkMethodImpl.createGdkMethod(method, myStatic, info);
if (!processor.execute(gdk, state)) {
return false;
}
}
}
return true;
}
use of com.intellij.psi.scope.NameHint in project intellij-community by JetBrains.
the class GroovyFileImpl method processDeclarationsNoGuess.
private boolean processDeclarationsNoGuess(@NotNull PsiScopeProcessor processor, @NotNull ResolveState state, @Nullable PsiElement lastParent, @NotNull PsiElement place) {
ElementClassHint classHint = processor.getHint(ElementClassHint.KEY);
if (myContext != null) {
if (ResolveUtil.shouldProcessProperties(classHint)) {
if (!processChildrenScopes(processor, state, lastParent, place))
return false;
}
return true;
}
boolean processClasses = ResolveUtil.shouldProcessClasses(classHint);
GrImportStatement[] importStatements = getImportStatements();
if (!processImports(processor, state, lastParent, place, importStatements, ImportKind.ALIAS, false))
return false;
GroovyScriptClass scriptClass = getScriptClass();
if (scriptClass != null && StringUtil.isJavaIdentifier(scriptClass.getName())) {
if (!(lastParent instanceof GrTypeDefinition)) {
if (!ResolveUtil.processClassDeclarations(scriptClass, processor, state, lastParent, place))
return false;
}
if (processClasses) {
if (!ResolveUtil.processElement(processor, scriptClass, state))
return false;
}
}
if (processClasses) {
for (GrTypeDefinition definition : getTypeDefinitions()) {
if (!ResolveUtil.processElement(processor, definition, state))
return false;
}
}
if (ResolveUtil.shouldProcessProperties(classHint)) {
if (!processChildrenScopes(processor, state, lastParent, place))
return false;
}
if (!processImports(processor, state, lastParent, place, importStatements, ImportKind.ALIAS, true))
return false;
if (!processImports(processor, state, lastParent, place, importStatements, ImportKind.SIMPLE, null))
return false;
if (!processDeclarationsInPackage(processor, state, lastParent, place))
return false;
if (!processImports(processor, state, lastParent, place, importStatements, ImportKind.ON_DEMAND, null))
return false;
if (!ImplicitImportsKt.processImplicitImports(processor, state, lastParent, place, this))
return false;
if (ResolveUtil.shouldProcessPackages(classHint)) {
NameHint nameHint = processor.getHint(NameHint.KEY);
String expectedName = nameHint != null ? nameHint.getName(state) : null;
final JavaPsiFacade facade = JavaPsiFacade.getInstance(getProject());
if (expectedName != null) {
final PsiPackage pkg = facade.findPackage(expectedName);
if (pkg != null && !processor.execute(pkg, state)) {
return false;
}
} else {
PsiPackage defaultPackage = facade.findPackage("");
if (defaultPackage != null) {
for (PsiPackage subPackage : defaultPackage.getSubPackages(getResolveScope())) {
if (!ResolveUtil.processElement(processor, subPackage, state))
return false;
}
}
}
}
if (ResolveUtil.shouldProcessProperties(classHint)) {
if (lastParent != null && !(lastParent instanceof GrTypeDefinition) && scriptClass != null) {
if (!ResolveUtil.processElement(processor, getSyntheticArgsParameter(), state))
return false;
}
}
return true;
}
use of com.intellij.psi.scope.NameHint in project intellij-community by JetBrains.
the class GrEnumTypeDefinitionImpl method processDeclarations.
@Override
public boolean processDeclarations(@NotNull PsiScopeProcessor processor, @NotNull ResolveState state, @Nullable PsiElement lastParent, @NotNull PsiElement place) {
if (ResolveUtil.shouldProcessMethods(processor.getHint(ElementClassHint.KEY))) {
final NameHint nameHint = processor.getHint(NameHint.KEY);
final String name = nameHint == null ? null : nameHint.getName(state);
for (PsiMethod method : getDefEnumMethods()) {
if (name == null || name.equals(method.getName())) {
if (!processor.execute(method, state))
return false;
}
}
}
return super.processDeclarations(processor, state, lastParent, place);
}
use of com.intellij.psi.scope.NameHint in project intellij-community by JetBrains.
the class GrImportStatementImpl method processDeclarationsForSingleElement.
private boolean processDeclarationsForSingleElement(@NotNull PsiScopeProcessor processor, @Nullable PsiElement lastParent, @NotNull PsiElement place, @NotNull ResolveState state) {
String name = getImportedName();
if (name == null)
return true;
if (isStatic()) {
return processSingleStaticImport(processor, state, name, lastParent, place);
}
NameHint nameHint = processor.getHint(NameHint.KEY);
if (nameHint == null || name.equals(nameHint.getName(state))) {
return processSingleClassImport(processor, state);
}
return true;
}
use of com.intellij.psi.scope.NameHint in project intellij-community by JetBrains.
the class ResolveUtil method processElement.
public static boolean processElement(@NotNull PsiScopeProcessor processor, @NotNull PsiNamedElement namedElement, @NotNull ResolveState state) {
NameHint nameHint = processor.getHint(NameHint.KEY);
String name = nameHint == null ? null : nameHint.getName(state);
if (name == null || name.equals(namedElement.getName())) {
return processor.execute(namedElement, state);
}
return true;
}
Aggregations