Search in sources :

Example 26 with IncludeTable

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);
    }
}
Also used : DbImportView(org.apache.cayenne.modeler.editor.dbimport.DbImportView) TreePath(javax.swing.tree.TreePath) ReverseEngineering(org.apache.cayenne.dbsync.reverse.dbimport.ReverseEngineering) DbImportTreeNode(org.apache.cayenne.modeler.dialog.db.load.DbImportTreeNode) Schema(org.apache.cayenne.dbsync.reverse.dbimport.Schema) IncludeTable(org.apache.cayenne.dbsync.reverse.dbimport.IncludeTable) Catalog(org.apache.cayenne.dbsync.reverse.dbimport.Catalog)

Aggregations

IncludeTable (org.apache.cayenne.dbsync.reverse.dbimport.IncludeTable)26 Catalog (org.apache.cayenne.dbsync.reverse.dbimport.Catalog)10 IncludeColumn (org.apache.cayenne.dbsync.reverse.dbimport.IncludeColumn)10 Schema (org.apache.cayenne.dbsync.reverse.dbimport.Schema)10 DbImportTreeNode (org.apache.cayenne.modeler.dialog.db.load.DbImportTreeNode)9 ExcludeTable (org.apache.cayenne.dbsync.reverse.dbimport.ExcludeTable)6 ReverseEngineering (org.apache.cayenne.dbsync.reverse.dbimport.ReverseEngineering)6 ExcludeColumn (org.apache.cayenne.dbsync.reverse.dbimport.ExcludeColumn)5 FilterContainer (org.apache.cayenne.dbsync.reverse.dbimport.FilterContainer)5 TransferableNode (org.apache.cayenne.modeler.dialog.db.load.TransferableNode)4 Test (org.junit.Test)3 ArrayList (java.util.ArrayList)2 IncludeProcedure (org.apache.cayenne.dbsync.reverse.dbimport.IncludeProcedure)2 DbImportView (org.apache.cayenne.modeler.editor.dbimport.DbImportView)2 DBConnectionInfo (org.apache.cayenne.modeler.pref.DBConnectionInfo)2 SQLException (java.sql.SQLException)1 TreePath (javax.swing.tree.TreePath)1 DbImportConfiguration (org.apache.cayenne.dbsync.reverse.dbimport.DbImportConfiguration)1 ExcludeProcedure (org.apache.cayenne.dbsync.reverse.dbimport.ExcludeProcedure)1 ExcludeRelationship (org.apache.cayenne.dbsync.reverse.dbimport.ExcludeRelationship)1