break;
} catch (StructuralException e) {
newName = JOptionPane.showInputDialog(UIEnvironment.getInstance(),
"Names cannot contain '.' or ':', please enter a new name", newName);
if (newName == null || newName.equals("")) {
throw new UserCancelledException();
}
}
}
String originalName = node.getName();
while (container.getNodeModel(newName) != null) {
// Avoid duplicate names
while (container.getNodeModel(newName) != null) {
i++;
newName = originalName + " (" + i + ")";
}
newName = JOptionPane.showInputDialog(UIEnvironment.getInstance(),
"Node already exists, please enter a new name", newName);
if (newName == null || newName.equals("")) {
throw new UserCancelledException();
}
}
try {
node.setName(newName);