Search in sources :

Example 1 with CreateEmbeddableUndoableEdit

use of org.apache.cayenne.modeler.undo.CreateEmbeddableUndoableEdit in project cayenne by apache.

the class CreateEmbeddableAction method performAction.

@Override
public void performAction(ActionEvent e) {
    ProjectController mediator = getProjectController();
    DataMap dataMap = mediator.getCurrentDataMap();
    Embeddable embeddable = new Embeddable();
    String baseName = NameBuilder.builder(embeddable, dataMap).name();
    String nameWithPackage = dataMap.getNameWithDefaultPackage(baseName);
    embeddable.setClassName(nameWithPackage);
    createEmbeddable(dataMap, embeddable);
    application.getUndoManager().addEdit(new CreateEmbeddableUndoableEdit(dataMap, embeddable));
}
Also used : CreateEmbeddableUndoableEdit(org.apache.cayenne.modeler.undo.CreateEmbeddableUndoableEdit) ProjectController(org.apache.cayenne.modeler.ProjectController) DataMap(org.apache.cayenne.map.DataMap) Embeddable(org.apache.cayenne.map.Embeddable)

Aggregations

DataMap (org.apache.cayenne.map.DataMap)1 Embeddable (org.apache.cayenne.map.Embeddable)1 ProjectController (org.apache.cayenne.modeler.ProjectController)1 CreateEmbeddableUndoableEdit (org.apache.cayenne.modeler.undo.CreateEmbeddableUndoableEdit)1