Search in sources :

Example 1 with CreateDbEntityUndoableEdit

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

the class CreateDbEntityAction method performAction.

/**
 * Creates new DbEntity, adds it to the current DataMap, fires DbEntityEvent and DbEntityDisplayEvent.
 */
public void performAction(ActionEvent e) {
    ProjectController mediator = getProjectController();
    DataMap map = mediator.getCurrentDataMap();
    DbEntity entity = new DbEntity();
    entity.setName(NameBuilder.builder(entity, map).name());
    createEntity(map, entity);
    application.getUndoManager().addEdit(new CreateDbEntityUndoableEdit(map, entity));
}
Also used : CreateDbEntityUndoableEdit(org.apache.cayenne.modeler.undo.CreateDbEntityUndoableEdit) DbEntity(org.apache.cayenne.map.DbEntity) ProjectController(org.apache.cayenne.modeler.ProjectController) DataMap(org.apache.cayenne.map.DataMap)

Aggregations

DataMap (org.apache.cayenne.map.DataMap)1 DbEntity (org.apache.cayenne.map.DbEntity)1 ProjectController (org.apache.cayenne.modeler.ProjectController)1 CreateDbEntityUndoableEdit (org.apache.cayenne.modeler.undo.CreateDbEntityUndoableEdit)1