use of org.apache.cayenne.dbsync.reverse.dbimport.IncludeTable in project cayenne by apache.
the class DeleteNodeAction method performAction.
@Override
public void performAction(ActionEvent e) {
tree.stopEditing();
final TreePath[] paths = tree.getSelectionPaths();
final DbImportView rootParent = ((DbImportView) panel.getParent().getParent());
rootParent.getLoadDbSchemaButton().setEnabled(false);
rootParent.getReverseEngineeringProgress().setVisible(true);
if (paths != null) {
ReverseEngineering reverseEngineeringOldCopy = new ReverseEngineering(tree.getReverseEngineering());
rootParent.lockToolbarButtons();
for (TreePath path : paths) {
selectedElement = (DbImportTreeNode) path.getLastPathComponent();
parentElement = (DbImportTreeNode) selectedElement.getParent();
if (parentElement != null) {
Object parentUserObject = parentElement.getUserObject();
if (parentUserObject instanceof ReverseEngineering) {
ReverseEngineering reverseEngineering = (ReverseEngineering) parentUserObject;
deleteChilds(reverseEngineering);
} else if (parentUserObject instanceof Catalog) {
Catalog catalog = (Catalog) parentUserObject;
deleteChilds(catalog);
} else if (parentUserObject instanceof Schema) {
Schema schema = (Schema) parentUserObject;
deleteChilds(schema);
} else if (parentUserObject instanceof IncludeTable) {
IncludeTable includeTable = (IncludeTable) parentUserObject;
deleteChilds(includeTable);
}
}
}
if (paths.length > 1) {
getProjectController().setDirty(true);
ArrayList<DbImportTreeNode> expandList = tree.getTreeExpandList();
tree.translateReverseEngineeringToTree(tree.getReverseEngineering(), false);
tree.expandTree(expandList);
} else {
updateParentChilds();
}
putReverseEngineeringToUndoManager(reverseEngineeringOldCopy);
rootParent.getLoadDbSchemaButton().setEnabled(true);
rootParent.getReverseEngineeringProgress().setVisible(false);
}
}
Aggregations