}
}
});
cmNew.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
SvgMapper im = SvgMapper.createSvgMapperDialog(SvgShapePropertiesPanel.this.getOwner());
if (im == null) {
return;
}
if (SvgMapper.svgMappers == null) {
SvgMapper.svgMappers = new ArrayList();
}
if (SvgMapper.svgMappers.contains(im)) {
String[] message = new String[] { messageWriter.print1args("ReplaceExistingSvgMapperNamed?", im
.toString()) };
int answer = JOptionPane.showConfirmDialog(SvgShapePropertiesPanel.this.getOwner(), message,
messageWriter.print0args("MapperAlreadyExists!"), JOptionPane.YES_NO_OPTION);
if (answer == JOptionPane.YES_OPTION) {
// Object.equals is magic...
int index = SvgMapper.svgMappers.indexOf(im);
SvgMapper.svgMappers.set(index, im);
listModel.update();
cmlist.setSelectedValue(im, true);
}
return;
}
SvgMapper.svgMappers.add(im);
listModel.update();
cmlist.setSelectedValue(im, true);
}
});
cmDelete.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Object o = cmlist.getSelectedValue();
if (o == null) {
return;
}
if (SvgMapper.svgMappers != null) {
SvgMapper.svgMappers.remove(o);
}
listModel.update();
updateWarnings();
}
});
cmDelete.setEnabled(false);
cmDuplicate.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Object o = cmlist.getSelectedValue();
if ((o == null) || !(o instanceof SvgMapper)) {
return;
}
try{
SvgMapper im = (SvgMapper)((SvgMapper)o).clone();
if (SvgMapper.svgMappers != null) {
SvgMapper.svgMappers.add(im);
}
listModel.update();
}catch (CloneNotSupportedException cnse){