mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IG: optimization
This commit is contained in:
+8
-17
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2011 Dave Griffith, Bas Leijdekkers
|
||||
* Copyright 2006-2017 Dave Griffith, Bas Leijdekkers
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -39,8 +39,7 @@ public class PackageWithTooManyClassesInspection extends BaseGlobalInspection {
|
||||
@NotNull
|
||||
@Override
|
||||
public String getDisplayName() {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"package.with.too.many.classes.display.name");
|
||||
return InspectionGadgetsBundle.message("package.with.too.many.classes.display.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -54,29 +53,21 @@ public class PackageWithTooManyClassesInspection extends BaseGlobalInspection {
|
||||
return null;
|
||||
}
|
||||
final List<RefEntity> children = refEntity.getChildren();
|
||||
int numClasses = 0;
|
||||
for (RefEntity child : children) {
|
||||
if (child instanceof RefClass) {
|
||||
numClasses++;
|
||||
}
|
||||
if (children.size() <= limit) {
|
||||
return null;
|
||||
}
|
||||
final int numClasses = (int)children.stream().filter(c -> c instanceof RefClass).count();
|
||||
if (numClasses <= limit) {
|
||||
return null;
|
||||
}
|
||||
final String errorString = InspectionGadgetsBundle.message(
|
||||
"package.with.too.many.classes.problem.descriptor",
|
||||
refEntity.getQualifiedName(), Integer.valueOf(numClasses),
|
||||
Integer.valueOf(limit));
|
||||
return new CommonProblemDescriptor[]{
|
||||
inspectionManager.createProblemDescriptor(errorString)
|
||||
};
|
||||
refEntity.getQualifiedName(), Integer.valueOf(numClasses), Integer.valueOf(limit));
|
||||
return new CommonProblemDescriptor[]{inspectionManager.createProblemDescriptor(errorString)};
|
||||
}
|
||||
|
||||
@Override
|
||||
public JComponent createOptionsPanel() {
|
||||
return new SingleIntegerFieldOptionsPanel(
|
||||
InspectionGadgetsBundle.message(
|
||||
"package.with.too.many.classes.max.option"),
|
||||
this, "limit");
|
||||
return new SingleIntegerFieldOptionsPanel(InspectionGadgetsBundle.message("package.with.too.many.classes.max.option"), this, "limit");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user