mirror of
https://github.com/badvision/lawless-legends.git
synced 2025-02-24 16:29:12 +00:00
Added cloning for user types
This commit is contained in:
parent
fef4595e9a
commit
55023ceb79
@ -162,6 +162,22 @@ public class GlobalEditorTabControllerImpl extends GlobalEditorTabController {
|
||||
|
||||
@Override
|
||||
protected void onDataTypeClonePressed(ActionEvent event) {
|
||||
UserType source = dataTypeList.getSelectionModel().getSelectedItem();
|
||||
if (source == null) {
|
||||
String message = "First select a data type and then press Clone";
|
||||
UIAction.alert(message);
|
||||
} else {
|
||||
try {
|
||||
UserType newType = TransferHelper.cloneObject(source, UserType.class, "userType");
|
||||
newType.setName(source.getName() + " CLONE");
|
||||
Application.gameData.getGlobal().getUserTypes().getUserType().add(newType);
|
||||
redrawGlobalDataTypes();
|
||||
UIAction.editUserType(newType);
|
||||
} catch (JAXBException ex) {
|
||||
Logger.getLogger(MapEditorTabControllerImpl.class.getName()).log(Level.SEVERE, null, ex);
|
||||
UIAction.alert("Error occured when attempting clone operation:\n" + ex.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
x
Reference in New Issue
Block a user