本文整理汇总了Java中com.intellij.psi.scope.NameHint类的典型用法代码示例。如果您正苦于以下问题:Java NameHint类的具体用法?Java NameHint怎么用?Java NameHint使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NameHint类属于com.intellij.psi.scope包,在下文中一共展示了NameHint类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processDeclarationsInClass
import com.intellij.psi.scope.NameHint; //导入依赖的package包/类
private static boolean processDeclarationsInClass(@NotNull PsiClass aClass,
@NotNull final PsiScopeProcessor processor,
@NotNull ResolveState state,
@Nullable Set<PsiClass> visited,
PsiElement last,
@NotNull PsiElement place,
@NotNull LanguageLevel languageLevel,
boolean isRaw,
@NotNull GlobalSearchScope resolveScope) {
if (last instanceof PsiTypeParameterList || last instanceof PsiModifierList) {
return true; //TypeParameterList and ModifierList do not see our declarations
}
if (visited != null && visited.contains(aClass)) return true;
PsiSubstitutor substitutor = state.get(PsiSubstitutor.KEY);
isRaw = isRaw || PsiUtil.isRawSubstitutor(aClass, substitutor);
final NameHint nameHint = processor.getHint(NameHint.KEY);
if (nameHint != null) {
String name = nameHint.getName(state);
return processCachedMembersByName(aClass, processor, state, visited, last, place, isRaw, substitutor,
getValues(aClass).getValue(aClass).get(resolveScope), name,languageLevel);
}
return processDeclarationsInClassNotCached(aClass, processor, state, visited, last, place, isRaw, languageLevel, resolveScope);
}
示例2: processDeclarations
import com.intellij.psi.scope.NameHint; //导入依赖的package包/类
@Override
public boolean processDeclarations(@NotNull PsiScopeProcessor processor, @NotNull ResolveState state, PsiElement lastParent, @NotNull PsiElement place) {
ElementClassHint classHint = processor.getHint(ElementClassHint.KEY);
if (classHint == null || classHint.shouldProcess(ElementClassHint.DeclarationKind.CLASS)) {
final NameHint nameHint = processor.getHint(NameHint.KEY);
final String name = nameHint != null ? nameHint.getName(state) : null;
//"pseudo-imports"
if (name != null) {
PsiClass imported = myPseudoImports.get(name);
if (imported != null) {
if (!processor.execute(imported, state)) return false;
}
} else {
for (PsiClass aClass : myPseudoImports.values()) {
if (!processor.execute(aClass, state)) return false;
}
}
if (myContext == null) {
if (!JavaResolveUtil.processImplicitlyImportedPackages(processor, state, place, getManager())) return false;
}
}
return true;
}
示例3: processMethods
import com.intellij.psi.scope.NameHint; //导入依赖的package包/类
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;
}
示例4: processDeclarationsForSingleElement
import com.intellij.psi.scope.NameHint; //导入依赖的package包/类
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;
}
示例5: processDeclarations
import com.intellij.psi.scope.NameHint; //导入依赖的package包/类
@Override
public boolean processDeclarations(@NotNull PsiScopeProcessor processor,
@NotNull ResolveState state,
@Nullable PsiElement lastParent,
@NotNull PsiElement place) {
if (ResolveUtil.shouldProcessMethods(processor.getHint(ClassHint.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);
}
示例6: processMethods
import com.intellij.psi.scope.NameHint; //导入依赖的package包/类
public boolean processMethods(PsiScopeProcessor processor, 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).keySet()) {
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;
}
示例7: processDeclarationsForSingleElement
import com.intellij.psi.scope.NameHint; //导入依赖的package包/类
private boolean processDeclarationsForSingleElement(PsiScopeProcessor processor, ResolveState state) {
String name = getImportedName();
if (name == null) return true;
NameHint nameHint = processor.getHint(NameHint.KEY);
GrCodeReferenceElement ref = getImportReference();
if (ref == null) return true;
if (isStatic()) {
return processSingleStaticImport(processor, state, name, nameHint, ref);
}
if (nameHint == null || name.equals(nameHint.getName(state))) {
return processSingleClassImport(processor, state, ref);
}
return true;
}
示例8: processDeclarations
import com.intellij.psi.scope.NameHint; //导入依赖的package包/类
@Override
public boolean processDeclarations(@NotNull PsiScopeProcessor processor,
@NotNull ResolveState state,
@Nullable PsiElement lastParent,
@NotNull PsiElement place) {
ClassHint classHint = processor.getHint(ClassHint.KEY);
if (classHint == null || classHint.shouldProcess(ClassHint.ResolveKind.METHOD)) {
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);
}
示例9: getHint
import com.intellij.psi.scope.NameHint; //导入依赖的package包/类
@Override
public <T> T getHint(@NotNull Key<T> hintKey) {
if (hintKey == NameHint.KEY) {
//noinspection unchecked
return myName != null ? (T)this : null;
}
return super.getHint(hintKey);
}
示例10: getHint
import com.intellij.psi.scope.NameHint; //导入依赖的package包/类
@Override
public <T> T getHint(@NotNull Key<T> hintKey) {
if (hintKey == ElementClassHint.KEY) {
return (T)this;
}
if (hintKey == NameHint.KEY && myNameHint != null) {
return (T)this;
}
return null;
}
示例11: getHint
import com.intellij.psi.scope.NameHint; //导入依赖的package包/类
@Override
public <T> T getHint(@NotNull final Key<T> hintKey) {
if (hintKey == NameHint.KEY) {
//noinspection unchecked
return (T)this;
}
return super.getHint(hintKey);
}
示例12: processDeclarations
import com.intellij.psi.scope.NameHint; //导入依赖的package包/类
@Override
public boolean processDeclarations(@NotNull PsiScopeProcessor processor, @NotNull ResolveState state, PsiElement lastParent, @NotNull PsiElement place) {
processor.handleEvent(PsiScopeProcessor.Event.SET_DECLARATION_HOLDER, this);
if (lastParent == null) {
// Parent element should not see our vars
return true;
}
Couple<Set<String>> pair = buildMaps();
boolean conflict = pair == null;
final Set<String> classesSet = conflict ? null : pair.getFirst();
final Set<String> variablesSet = conflict ? null : pair.getSecond();
final NameHint hint = processor.getHint(NameHint.KEY);
if (hint != null && !conflict) {
final ElementClassHint elementClassHint = processor.getHint(ElementClassHint.KEY);
final String name = hint.getName(state);
if ((elementClassHint == null || elementClassHint.shouldProcess(ElementClassHint.DeclarationKind.CLASS)) && classesSet.contains(name)) {
return PsiScopesUtil.walkChildrenScopes(this, processor, state, lastParent, place);
}
if ((elementClassHint == null || elementClassHint.shouldProcess(ElementClassHint.DeclarationKind.VARIABLE)) && variablesSet.contains(name)) {
return PsiScopesUtil.walkChildrenScopes(this, processor, state, lastParent, place);
}
}
else {
return PsiScopesUtil.walkChildrenScopes(this, processor, state, lastParent, place);
}
return true;
}
示例13: substituteProcessor
import com.intellij.psi.scope.NameHint; //导入依赖的package包/类
static PsiScopeProcessor substituteProcessor(PsiScopeProcessor processor, PsiElement scope) {
//hack for walking up in java code
//java's processDeclarations don't check names so we should do it manually
if (scope.getLanguage() != GroovyLanguage.INSTANCE && processor.getHint(NameHint.KEY) != null) {
return new JavaResolverProcessor(processor);
}
return processor;
}
示例14: getNameHint
import com.intellij.psi.scope.NameHint; //导入依赖的package包/类
@Nullable
public static String getNameHint(PsiScopeProcessor processor) {
NameHint nameHint = processor.getHint(NameHint.KEY);
if (nameHint == null) {
return null;
}
return nameHint.getName(ResolveState.initial());
}
示例15: processElement
import com.intellij.psi.scope.NameHint; //导入依赖的package包/类
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;
}