[116042] fix for setProperty : committed for JL
diff --git a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/resources/VirtualComponent.java b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/resources/VirtualComponent.java
index bb84883..eeeba3e 100644
--- a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/resources/VirtualComponent.java
+++ b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/resources/VirtualComponent.java
@@ -169,12 +169,21 @@
StructureEdit core = null;
try {
core = StructureEdit.getStructureEditForWrite(getProject());
- WorkbenchComponent component = core.getComponent();
-
- final Property prop = ComponentcoreFactory.eINSTANCE.createProperty();
- prop.setName(key);
- prop.setValue(value);
- component.getProperties().add(prop);
+ WorkbenchComponent component = core.getComponent();
+ //Remove existing property first
+ List properties = component.getProperties();
+ for (int i=0; i<properties.size(); i++) {
+ Property existing = (Property) properties.get(i);
+ if (existing.getName().equals(key)) {
+ properties.remove(existing);
+ break;
+ }
+ }
+ //Set new property
+ final Property prop = ComponentcoreFactory.eINSTANCE.createProperty();
+ prop.setName(key);
+ prop.setValue(value);
+ component.getProperties().add(prop);
} finally {
if(core != null){