final DefaultComboBoxModel model = (DefaultComboBoxModel) elementaryConditionList.getModel();
final int minSelectionIndex = elementaryConditionList.getMinSelectionIndex();
if (minSelectionIndex == -1) {
return;
}
final ASelectableCondition condition = (ASelectableCondition) model.getElementAt(minSelectionIndex);
final String userName = condition.getUserName();
final String newUserName = JOptionPane.showInputDialog(AFilterComposerDialog.this,
TextUtils.getText("enter_condition_name"), userName == null ? "" : userName);
if(newUserName == null)
return;
XMLElement xmlCondition = new XMLElement();
condition.toXml(xmlCondition);
ASelectableCondition newCondition = filterController.getConditionFactory().loadCondition(xmlCondition.getChildAtIndex(0));
if(newCondition== null)
return;
if (newUserName.equals("")) {
if(userName == null)
return;
newCondition.setUserName(null);
}
else {
if(newUserName.equals(userName))
return;
newCondition.setUserName(newUserName);
}
model.removeElementAt(minSelectionIndex);
model.insertElementAt(newCondition, minSelectionIndex);
}