本文整理汇总了Java中com.intellij.codeInspection.inheritance.search.InheritorsStatisticsSearchResult类的典型用法代码示例。如果您正苦于以下问题:Java InheritorsStatisticsSearchResult类的具体用法?Java InheritorsStatisticsSearchResult怎么用?Java InheritorsStatisticsSearchResult使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
InheritorsStatisticsSearchResult类属于com.intellij.codeInspection.inheritance.search包,在下文中一共展示了InheritorsStatisticsSearchResult类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkClass
import com.intellij.codeInspection.inheritance.search.InheritorsStatisticsSearchResult; //导入依赖的package包/类
@Nullable
@Override
public ProblemDescriptor[] checkClass(@NotNull final PsiClass aClass,
@NotNull final InspectionManager manager,
final boolean isOnTheFly) {
if (aClass.isInterface() ||
aClass.isEnum() ||
aClass instanceof PsiTypeParameter ||
aClass.getMethods().length != 0 ||
aClass.hasModifierProperty(PsiModifier.ABSTRACT)) {
return null;
}
final PsiClass superClass = getSuperIfUnique(aClass);
if (superClass == null) return null;
final List<InheritorsStatisticsSearchResult> topInheritors =
InheritorsStatisticalDataSearch.search(superClass, aClass, aClass.getResolveScope(), MIN_PERCENT_RATIO);
if (topInheritors.isEmpty()) {
return null;
}
final Collection<LocalQuickFix> topInheritorsQuickFix = new ArrayList<LocalQuickFix>(topInheritors.size());
boolean isFirst = true;
for (final InheritorsStatisticsSearchResult searchResult : topInheritors) {
final LocalQuickFix quickFix;
if (isFirst) {
quickFix = new ChangeSuperClassFix(searchResult.getPsiClass(), searchResult.getPercent(), superClass);
isFirst = false;
} else {
quickFix = new ChangeSuperClassFix.LowPriority(searchResult.getPsiClass(), searchResult.getPercent(), superClass);
}
topInheritorsQuickFix.add(quickFix);
if (topInheritorsQuickFix.size() >= MAX_QUICK_FIX_COUNTS) {
break;
}
}
return new ProblemDescriptor[]{manager
.createProblemDescriptor(aClass, getDisplayName(), false,
topInheritorsQuickFix.toArray(new LocalQuickFix[topInheritorsQuickFix.size()]),
ProblemHighlightType.INFORMATION)};
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:45,代码来源:SuperClassHasFrequentlyUsedInheritorsInspection.java
示例2: checkClass
import com.intellij.codeInspection.inheritance.search.InheritorsStatisticsSearchResult; //导入依赖的package包/类
@Nullable
@Override
public ProblemDescriptor[] checkClass(@NotNull final PsiClass aClass,
@NotNull final InspectionManager manager,
final boolean isOnTheFly) {
if (aClass.isInterface() ||
aClass instanceof PsiTypeParameter ||
aClass.getMethods().length != 0 ||
aClass.hasModifierProperty(PsiModifier.ABSTRACT)) {
return null;
}
final PsiClass superClass = getSuperIfUnique(aClass);
if (superClass == null) return null;
final List<InheritorsStatisticsSearchResult> topInheritors =
InheritorsStatisticalDataSearch.search(superClass, aClass, aClass.getResolveScope(), MIN_PERCENT_RATIO);
if (topInheritors.isEmpty()) {
return null;
}
final Collection<LocalQuickFix> topInheritorsQuickFix = new ArrayList<LocalQuickFix>(topInheritors.size());
boolean isFirst = true;
for (final InheritorsStatisticsSearchResult searchResult : topInheritors) {
final LocalQuickFix quickFix;
if (isFirst) {
quickFix = new ChangeSuperClassFix(searchResult.getPsiClass(), searchResult.getPercent(), superClass);
isFirst = false;
} else {
quickFix = new ChangeSuperClassFix.LowPriority(searchResult.getPsiClass(), searchResult.getPercent(), superClass);
}
topInheritorsQuickFix.add(quickFix);
if (topInheritorsQuickFix.size() >= MAX_QUICK_FIX_COUNTS) {
break;
}
}
return new ProblemDescriptor[]{manager
.createProblemDescriptor(aClass, getDisplayName(), false,
topInheritorsQuickFix.toArray(new LocalQuickFix[topInheritorsQuickFix.size()]),
ProblemHighlightType.INFORMATION)};
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:44,代码来源:SuperClassHasFrequentlyUsedInheritorsInspection.java
示例3: checkClass
import com.intellij.codeInspection.inheritance.search.InheritorsStatisticsSearchResult; //导入依赖的package包/类
@Nullable
@Override
public ProblemDescriptor[] checkClass(@NotNull final PsiClass aClass,
@NotNull final InspectionManager manager,
final boolean isOnTheFly) {
if (aClass.isInterface() ||
aClass instanceof PsiTypeParameter ||
aClass.getMethods().length != 0 ||
aClass.hasModifierProperty(PsiModifier.ABSTRACT)) {
return null;
}
final PsiClass superClass = getSuperIfUnique(aClass);
if (superClass == null) return null;
final List<InheritorsStatisticsSearchResult> topInheritors =
InheritorsStatisticalDataSearch.search(superClass, aClass, aClass.getResolveScope(), MIN_PERCENT_RATIO);
if (topInheritors.isEmpty()) {
return null;
}
final Collection<LocalQuickFix> topInheritorsQuickFix = new ArrayList<LocalQuickFix>(topInheritors.size());
boolean isFirst = true;
for (final InheritorsStatisticsSearchResult searchResult : topInheritors) {
final LocalQuickFix quickFix;
if (isFirst) {
quickFix = new ChangeSuperClassFix(searchResult.getPsiClass(), searchResult.getPercent(), superClass);
isFirst = false;
} else {
quickFix = new ChangeSuperClassFix.LowPriority(searchResult.getPsiClass(), searchResult.getPercent(), superClass);
}
topInheritorsQuickFix.add(quickFix);
if (topInheritorsQuickFix.size() >= MAX_QUICK_FIX_COUNTS) {
break;
}
}
return new ProblemDescriptor[]{manager
.createProblemDescriptor(aClass, "Class may extend a commonly used base class instead of implementing interface or extending abstract class", false,
topInheritorsQuickFix.toArray(new LocalQuickFix[topInheritorsQuickFix.size()]),
ProblemHighlightType.INFORMATION)};
}