public void actionPerformed(final ActionEvent e) {
AWorkspaceTreeNode targetNode = this.getNodeFromActionEvent(e);
String oldName = targetNode.getName();
NodeRenameDialogPanel panel;
// if (targetNode instanceof IMutableLinkNode) {
// panel = new NodeRenameDialogPanel(oldName, true);
// }
// else {
panel = new NodeRenameDialogPanel(oldName);
if(targetNode instanceof DefaultFileNode) {
panel.setCheckboxSelected(true);
}
// }
int okButton = JOptionPane.showConfirmDialog(UITools.getFrame(), panel, TextUtils.getText("confirm_rename_file_action"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE);
String newName = panel.getText();
if(okButton != JOptionPane.OK_OPTION || oldName.equals(newName)) {
return;
}
if (newName != null) {
if (targetNode instanceof IMutableLinkNode) {
if (((IMutableLinkNode) targetNode).changeName(newName, panel.applyChangesForLink())) {
targetNode.refresh();
}
else {
JOptionPane.showMessageDialog(UITools.getFrame(), TextUtils.getText("error_rename_file"),
TextUtils.getText("error_rename_file_title"), JOptionPane.ERROR_MESSAGE);