import java.util.ConcurrentModificationException;
import java.util.HashSet;
+import java.util.Iterator;
import java.util.List;
import java.util.Set;
elements.add(element);
}
- protected void removeElement(ICdmFormElement element){
- elements.remove(element);
- }
-
/**
* Remove all child {@link ICdmFormElement}s and child {@link Control}s
* of the given and the element itself.
*/
@Override
public void removeElements(){
- for(ICdmFormElement childElement : getElements()){
+ for (Iterator<ICdmFormElement> iterator = getElements().iterator();iterator.hasNext();) {
+ ICdmFormElement childElement = iterator.next();
// recursion
childElement.removeElements();
// dispose of the controls
removeControls(childElement);
}
+ if(this instanceof ISelectableElement){
+ SelectionArbitrator selectionArbitrator = ((ISelectableElement) this).getSelectionArbitrator();
+ if(selectionArbitrator != null){
+ formFactory.destroySelectionArbitrator(selectionArbitrator);
+ }
+ }
removeControls(this);
elements.clear();
}