aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-plugin-api
diff options
context:
space:
mode:
authorsimonbrandhof <simon.brandhof@gmail.com>2010-10-04 14:34:48 +0000
committersimonbrandhof <simon.brandhof@gmail.com>2010-10-04 14:34:48 +0000
commite871a18725ae45b245a3cface0935206ae35d750 (patch)
tree12fb73aabb244422ef6464f033109a73b1f07ded /sonar-plugin-api
parentfff7e6b8f66198eee455a89323c84f40dd6f2802 (diff)
downloadsonarqube-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.java9
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);
}