DeviceRepositoryAccessorManager dram =
context.getDeviceRepositoryAccessorManager();
Element typeElement = dram.getTypeDefinitionElement(getPolicyName());
PolicyTypeComposition composition =
PolicyTypeComposition.getComposition(typeElement);
PolicyType policyType = (PolicyType) typeCombo.getValue();
PolicyType currentType =
PolicyTypeComposition.getPolicyType(typeElement);
if (currentType != policyType) {
policyDefinition.removeChangeListener(odomChangeListener);
try {
// detatch type element from the policy definition element
typeElement.detach();
// add the new type element
composition.addTypeElement(policyDefinition,
policyType,
context.getODOMFactory());
// update the optional controls that may be required if the
// new type requires optional controls.
updateOptionalTypeControls();