}
@Override
public void actionPerformed(ActionEvent event) {
// Get new name.
String newName = JOptionPane.showInputDialog("Enter new name:");
CommandData data = new CommandData();
data.addItem(Keys.NEW_NAME, newName);
// Get file to be renamed.
File file = getSelectedFile();
data.addItem(Keys.FILE, file);
// Create command.
Rename rename = new Rename();
try {
rename.perform(data);
} catch (Exception exception) {
exception.printStackTrace();
}
// Refresh panels.
CommandData refreshData = new CommandData();
refreshData.addItem(Keys.PANELS, panels);
Refresh refresh = new Refresh();
try {
refresh.perform(refreshData);
} catch (Exception exception) {
exception.printStackTrace();