*/
public void performAction(ActionEvent e, boolean allowAsking) {
ProjectController mediator = getProjectController();
ConfirmRemoveDialog dialog = getConfirmDeleteDialog(allowAsking);
if (mediator.getCurrentObjEntity() != null) {
if (dialog
.shouldDelete("ObjEntity", mediator.getCurrentObjEntity().getName())) {
application.getUndoManager().addEdit(
new RemoveUndoableEdit(mediator.getCurrentDataMap(), mediator
.getCurrentObjEntity()));
removeObjEntity(mediator.getCurrentDataMap(), mediator
.getCurrentObjEntity());
}
}
else if (mediator.getCurrentDbEntity() != null) {
if (dialog.shouldDelete("DbEntity", mediator.getCurrentDbEntity().getName())) {
application.getUndoManager().addEdit(
new RemoveUndoableEdit(mediator.getCurrentDataMap(), mediator
.getCurrentDbEntity()));
removeDbEntity(mediator.getCurrentDataMap(), mediator
.getCurrentDbEntity());
}
}
else if (mediator.getCurrentQuery() != null) {
if (dialog.shouldDelete("query", mediator.getCurrentQuery().getName())) {
application.getUndoManager().addEdit(
new RemoveUndoableEdit(mediator.getCurrentDataMap(), mediator
.getCurrentQuery()));
removeQuery(mediator.getCurrentDataMap(), mediator.getCurrentQuery());
}
}
else if (mediator.getCurrentProcedure() != null) {
if (dialog
.shouldDelete("procedure", mediator.getCurrentProcedure().getName())) {
application.getUndoManager().addEdit(
new RemoveUndoableEdit(mediator.getCurrentDataMap(), mediator
.getCurrentProcedure()));
removeProcedure(mediator.getCurrentDataMap(), mediator
.getCurrentProcedure());
}
}
else if (mediator.getCurrentEmbeddable() != null) {
if (dialog.shouldDelete("embeddable", mediator
.getCurrentEmbeddable()
.getClassName())) {
application.getUndoManager().addEdit(
new RemoveUndoableEdit(mediator.getCurrentDataMap(), mediator
.getCurrentEmbeddable()));
removeEmbeddable(mediator.getCurrentDataMap(), mediator
.getCurrentEmbeddable());
}
}
else if (mediator.getCurrentDataMap() != null) {
if (dialog.shouldDelete("data map", mediator.getCurrentDataMap().getName())) {
// In context of Data node just remove from Data Node
if (mediator.getCurrentDataNode() != null) {
application.getUndoManager().addEdit(
new RemoveUndoableEdit(application, mediator
.getCurrentDataNode(), mediator.getCurrentDataMap()));
removeDataMapFromDataNode(mediator.getCurrentDataNode(), mediator
.getCurrentDataMap());
}
else {
// Not under Data Node, remove completely
application
.getUndoManager()
.addEdit(
new RemoveUndoableEdit(application, mediator
.getCurrentDataDomain(), mediator
.getCurrentDataMap()));
removeDataMap(mediator.getCurrentDataDomain(), mediator
.getCurrentDataMap());
}
}
}
else if (mediator.getCurrentDataNode() != null) {
if (dialog.shouldDelete("data node", mediator.getCurrentDataNode().getName())) {
application.getUndoManager().addEdit(
new RemoveUndoableEdit(application, mediator
.getCurrentDataDomain(), mediator.getCurrentDataNode()));
removeDataNode(mediator.getCurrentDataDomain(), mediator
.getCurrentDataNode());
}
}
else if (mediator.getCurrentDataDomain() != null) {
if (dialog.shouldDelete("data domain", mediator
.getCurrentDataDomain()
.getName())) {
application.getUndoManager().addEdit(
new RemoveUndoableEdit(application, mediator
.getCurrentDataDomain()));
removeDomain(mediator.getCurrentDataDomain());
}
}
else if (mediator.getCurrentPaths() != null) { // multiple deletion
if (dialog.shouldDelete("selected objects")) {
ProjectPath[] paths = mediator.getCurrentPaths();
CompoundEdit compoundEdit = new RemoveCompoundUndoableEdit();
for (ProjectPath path : paths) {