本文整理汇总了Java中com.intellij.psi.scope.NameHint类的典型用法代码示例。如果您正苦于以下问题:Java NameHint类的具体用法?Java NameHint怎么用?Java NameHint使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NameHint类属于com.intellij.psi.scope包,在下文中一共展示了NameHint类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:PsiClassImplUtil.java
示例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;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:JavaDummyHolder.java
示例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;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:GdkMethodHolder.java
示例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;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:GrImportStatementImpl.java
示例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);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:GrEnumTypeDefinitionImpl.java
示例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;
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:23,代码来源:GdkMethodHolder.java
示例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;
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:18,代码来源:GrImportStatementImpl.java
示例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);
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:19,代码来源:GrEnumTypeDefinitionImpl.java
示例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);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:ConflictFilterProcessor.java
示例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;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:MethodResolveProcessor.java
示例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);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:StaticImportResolveProcessor.java
示例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;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:28,代码来源:PsiCodeBlockImpl.java
示例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;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:ResolveUtil.java
示例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());
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:ResolveUtil.java
示例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;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:ResolveUtil.java
示例16: getHint
import com.intellij.psi.scope.NameHint; //导入依赖的package包/类
@Override
@SuppressWarnings({"unchecked"})
public <T> T getHint(@NotNull Key<T> hintKey) {
if (NameHint.KEY == hintKey && myName != null) {
return (T)this;
}
if ((ClassHint.KEY == hintKey || ElementClassHint.KEY == hintKey) && myResolveTargetKinds != null) {
return (T)this;
}
return null;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:GrScopeProcessorWithHints.java
示例17: getHint
import com.intellij.psi.scope.NameHint; //导入依赖的package包/类
@Override
public <T> T getHint(@NotNull Key<T> hintKey) {
if ((NameHint.KEY == hintKey && myNameHint != null) || ClassHint.KEY == hintKey || ElementClassHint.KEY == hintKey) {
//noinspection unchecked
return (T) this;
}
return null;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:GroovyConstructorNamedArgumentProvider.java
示例18: processSingleStaticImport
import com.intellij.psi.scope.NameHint; //导入依赖的package包/类
private boolean processSingleStaticImport(@NotNull final PsiScopeProcessor processor,
@NotNull ResolveState state,
@NotNull String importedName,
@Nullable PsiElement lastParent,
@NotNull PsiElement place) {
final GrCodeReferenceElement ref = getImportReference();
if (ref == null) return true;
PsiClass clazz = resolveQualifier();
if (clazz == null) return true;
state = state.put(ClassHint.RESOLVE_CONTEXT, this);
final String refName = ref.getReferenceName();
final NameHint nameHint = processor.getHint(NameHint.KEY);
final String hintName = nameHint == null ? null : nameHint.getName(state);
if (hintName == null || importedName.equals(hintName)) {
if (!clazz.processDeclarations(new GrDelegatingScopeProcessorWithHints(processor, refName, null), state, lastParent, place)) {
return false;
}
}
if (ResolveUtil.shouldProcessMethods(processor.getHint(ClassHint.KEY))) {
if (hintName == null || importedName.equals(GroovyPropertyUtils.getPropertyNameByGetterName(hintName, true))) {
if (!clazz.processDeclarations(new StaticGetterProcessor(refName, processor), state, lastParent, place)) {
return false;
}
}
if (hintName == null || importedName.equals(GroovyPropertyUtils.getPropertyNameBySetterName(hintName))) {
if (!clazz.processDeclarations(new StaticSetterProcessor(refName, processor), state, lastParent, place)) {
return false;
}
}
}
return true;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:41,代码来源:GrImportStatementImpl.java
示例19: getHint
import com.intellij.psi.scope.NameHint; //导入依赖的package包/类
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;
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:10,代码来源:MethodResolveProcessor.java
示例20: processDeclarationsInClass
import com.intellij.psi.scope.NameHint; //导入依赖的package包/类
public 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) {
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);
ParameterizedCachedValue<MembersMap, PsiClass> cache = getValues(aClass); //aClass.getUserData(MAP_IN_CLASS_KEY);
boolean upToDate = cache.hasUpToDateValue();
if (/*true || */upToDate) {
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, cache.getValue(aClass), name,languageLevel);
}
}
return processDeclarationsInClassNotCached(aClass, processor, state, visited, last, place, isRaw, languageLevel);
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:28,代码来源:PsiClassImplUtil.java
注:本文中的com.intellij.psi.scope.NameHint类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论