diff options
author | simonbrandhof <simon.brandhof@gmail.com> | 2010-10-04 14:34:48 +0000 |
---|---|---|
committer | simonbrandhof <simon.brandhof@gmail.com> | 2010-10-04 14:34:48 +0000 |
commit | e871a18725ae45b245a3cface0935206ae35d750 (patch) | |
tree | 12fb73aabb244422ef6464f033109a73b1f07ded /sonar-plugin-api | |
parent | fff7e6b8f66198eee455a89323c84f40dd6f2802 (diff) | |
download | sonarqube-e871a18725ae45b245a3cface0935206ae35d750.tar.gz sonarqube-e871a18725ae45b245a3cface0935206ae35d750.zip |
quality model API: removeCharacteristic() must support disabled characteristics
Diffstat (limited to 'sonar-plugin-api')
-rw-r--r-- | sonar-plugin-api/src/main/java/org/sonar/api/qualitymodel/Model.java | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/qualitymodel/Model.java b/sonar-plugin-api/src/main/java/org/sonar/api/qualitymodel/Model.java index fb5b5ad6b43..874d64bf68d 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/qualitymodel/Model.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/qualitymodel/Model.java @@ -177,7 +177,14 @@ public final class Model implements Comparable<Model> { } public Model removeCharacteristic(Characteristic characteristic) { - characteristic.setEnabled(false); + if (characteristic.getId() == null) { + characteristics.remove(characteristic); + for (Characteristic parent : characteristic.getParents()) { + parent.removeChild(characteristic); + } + } else { + characteristic.setEnabled(false); + } for (Characteristic child : characteristic.getChildren()) { removeCharacteristic(child); } |