mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-85626 "Field declaration" usage type group mixes together fields of class and fields of its inner classes fixed
This commit is contained in:
@@ -157,6 +157,11 @@ public class JavaUsageTypeProvider implements UsageTypeProviderEx {
|
||||
|
||||
@Nullable
|
||||
private static UsageType getClassUsageType(@NotNull PsiElement element, @NotNull UsageTarget[] targets) {
|
||||
final PsiJavaCodeReferenceElement codeReference = PsiTreeUtil.getParentOfType(element, PsiJavaCodeReferenceElement.class);
|
||||
if(codeReference != null && isNestedClassOf(codeReference,targets)){
|
||||
return UsageType.CLASS_NESTED_CLASS_ACCESS;
|
||||
}
|
||||
|
||||
if (element.getParent() instanceof PsiAnnotation &&
|
||||
element == ((PsiAnnotation)element.getParent()).getNameReferenceElement()) {
|
||||
return UsageType.ANNOTATION;
|
||||
@@ -224,9 +229,6 @@ public class JavaUsageTypeProvider implements UsageTypeProviderEx {
|
||||
if (isAnonymousClassOf(psiNewExpression.getAnonymousClass(), targets)) {
|
||||
return UsageType.CLASS_ANONYMOUS_NEW_OPERATOR;
|
||||
}
|
||||
if (isInnerClassOf(classReference, targets)) {
|
||||
return UsageType.CLASS_INNER_NEW_OPERATOR;
|
||||
}
|
||||
if (isNewArrayCreation(psiNewExpression)) {
|
||||
return UsageType.CLASS_NEW_ARRAY;
|
||||
}
|
||||
@@ -249,7 +251,7 @@ public class JavaUsageTypeProvider implements UsageTypeProviderEx {
|
||||
return qualifiesToTargetClasses(anonymousClass.getBaseClassReference(), targets);
|
||||
}
|
||||
|
||||
private static boolean isInnerClassOf(PsiJavaCodeReferenceElement classReference, @NotNull UsageTarget[] targets) {
|
||||
private static boolean isNestedClassOf(PsiJavaCodeReferenceElement classReference, @NotNull UsageTarget[] targets) {
|
||||
final PsiElement qualifier = classReference.getQualifier();
|
||||
if (qualifier instanceof PsiJavaCodeReferenceElement) {
|
||||
return qualifiesToTargetClasses((PsiJavaCodeReferenceElement)qualifier, targets);
|
||||
|
||||
@@ -33,6 +33,7 @@ usage.type.import=Usage in import
|
||||
usage.type.cast.target=Usage in cast target type
|
||||
usage.type.extends=Usage in extends/implements clause
|
||||
usage.type.static.member=Class static member access
|
||||
usage.type.nested.class=Nested class access
|
||||
usage.type.throws.list=Method throws list
|
||||
usage.type.class.object=Usage in .class
|
||||
usage.type.field.declaration=Field declaration
|
||||
@@ -52,7 +53,6 @@ usage.target.xml.tag.of.file={0} of file {1}
|
||||
usage.target.package.in.directory={0} (in {1})
|
||||
usage.target.exception=Exception
|
||||
usage.type.new=New instance creation
|
||||
usage.type.new.nested=New nested class instance creation
|
||||
usage.type.new.anonymous=New anonymous inheritor creation
|
||||
usage.type.new.array=New array creation
|
||||
usage.type.annotation=Annotation
|
||||
|
||||
@@ -23,6 +23,7 @@ public final class UsageType {
|
||||
public static final UsageType CLASS_CAST_TO = new UsageType(UsageViewBundle.message("usage.type.cast.target"));
|
||||
public static final UsageType CLASS_EXTENDS_IMPLEMENTS_LIST = new UsageType(UsageViewBundle.message("usage.type.extends"));
|
||||
public static final UsageType CLASS_STATIC_MEMBER_ACCESS = new UsageType(UsageViewBundle.message("usage.type.static.member"));
|
||||
public static final UsageType CLASS_NESTED_CLASS_ACCESS = new UsageType(UsageViewBundle.message("usage.type.nested.class"));
|
||||
public static final UsageType CLASS_METHOD_THROWS_LIST = new UsageType(UsageViewBundle.message("usage.type.throws.list"));
|
||||
public static final UsageType CLASS_CLASS_OBJECT_ACCESS = new UsageType(UsageViewBundle.message("usage.type.class.object"));
|
||||
public static final UsageType CLASS_FIELD_DECLARATION = new UsageType(UsageViewBundle.message("usage.type.field.declaration"));
|
||||
@@ -31,7 +32,6 @@ public final class UsageType {
|
||||
public static final UsageType CLASS_CATCH_CLAUSE_PARAMETER_DECLARATION = new UsageType(UsageViewBundle.message("usage.type.catch.declaration"));
|
||||
public static final UsageType CLASS_METHOD_RETURN_TYPE = new UsageType(UsageViewBundle.message("usage.type.return"));
|
||||
public static final UsageType CLASS_NEW_OPERATOR = new UsageType(UsageViewBundle.message("usage.type.new"));
|
||||
public static final UsageType CLASS_NESTED_NEW_OPERATOR = new UsageType(UsageViewBundle.message("usage.type.new.nested"));
|
||||
public static final UsageType CLASS_ANONYMOUS_NEW_OPERATOR = new UsageType(UsageViewBundle.message("usage.type.new.anonymous"));
|
||||
public static final UsageType CLASS_NEW_ARRAY = new UsageType(UsageViewBundle.message("usage.type.new.array"));
|
||||
public static final UsageType ANNOTATION = new UsageType(UsageViewBundle.message("usage.type.annotation"));
|
||||
|
||||
Reference in New Issue
Block a user