Search in sources :

Example 1 with EditForeignKeyPage

use of org.jkiss.dbeaver.ui.editors.object.struct.EditForeignKeyPage in project dbeaver by serge-rider.

the class OracleForeignKeyConfigurator method configureObject.

@Override
public OracleTableForeignKey configureObject(DBRProgressMonitor monitor, Object table, OracleTableForeignKey foreignKey) {
    return UITask.run(() -> {
        EditForeignKeyPage editPage = new EditForeignKeyPage(OracleUIMessages.edit_oracle_foreign_key_manager_dialog_title, foreignKey, new DBSForeignKeyModifyRule[] { DBSForeignKeyModifyRule.NO_ACTION, DBSForeignKeyModifyRule.CASCADE, DBSForeignKeyModifyRule.RESTRICT, DBSForeignKeyModifyRule.SET_NULL, DBSForeignKeyModifyRule.SET_DEFAULT });
        editPage.setSupportsCustomName(true);
        if (!editPage.edit()) {
            return null;
        }
        foreignKey.setReferencedConstraint((OracleTableConstraint) editPage.getUniqueConstraint());
        foreignKey.setName(editPage.getName());
        foreignKey.setDeleteRule(editPage.getOnDeleteRule());
        int colIndex = 1;
        for (EditForeignKeyPage.FKColumnInfo tableColumn : editPage.getColumns()) {
            foreignKey.addColumn(new OracleTableForeignKeyColumn(foreignKey, (OracleTableColumn) tableColumn.getOwnColumn(), colIndex++));
        }
        return foreignKey;
    });
}
Also used : OracleTableForeignKeyColumn(org.jkiss.dbeaver.ext.oracle.model.OracleTableForeignKeyColumn) OracleTableColumn(org.jkiss.dbeaver.ext.oracle.model.OracleTableColumn) EditForeignKeyPage(org.jkiss.dbeaver.ui.editors.object.struct.EditForeignKeyPage) OracleTableConstraint(org.jkiss.dbeaver.ext.oracle.model.OracleTableConstraint)

Example 2 with EditForeignKeyPage

use of org.jkiss.dbeaver.ui.editors.object.struct.EditForeignKeyPage in project dbeaver by serge-rider.

the class MySQLForeignKeyConfigurator method configureObject.

@Override
public MySQLTableForeignKey configureObject(DBRProgressMonitor monitor, Object table, MySQLTableForeignKey foreignKey) {
    return UITask.run(() -> {
        EditForeignKeyPage editPage = new EditForeignKeyPage(MySQLUIMessages.edit_foreign_key_manager_title, foreignKey, new DBSForeignKeyModifyRule[] { DBSForeignKeyModifyRule.NO_ACTION, DBSForeignKeyModifyRule.CASCADE, DBSForeignKeyModifyRule.RESTRICT, DBSForeignKeyModifyRule.SET_NULL, DBSForeignKeyModifyRule.SET_DEFAULT });
        if (!editPage.edit()) {
            return null;
        }
        foreignKey.setReferencedKey((MySQLTableConstraint) editPage.getUniqueConstraint());
        foreignKey.setDeleteRule(editPage.getOnDeleteRule());
        foreignKey.setUpdateRule(editPage.getOnUpdateRule());
        int colIndex = 1;
        for (EditForeignKeyPage.FKColumnInfo tableColumn : editPage.getColumns()) {
            foreignKey.addColumn(new MySQLTableForeignKeyColumn(foreignKey, (MySQLTableColumn) tableColumn.getOwnColumn(), colIndex++, (MySQLTableColumn) tableColumn.getRefColumn()));
        }
        return foreignKey;
    });
}
Also used : MySQLTableForeignKeyColumn(org.jkiss.dbeaver.ext.mysql.model.MySQLTableForeignKeyColumn) EditForeignKeyPage(org.jkiss.dbeaver.ui.editors.object.struct.EditForeignKeyPage) MySQLTableColumn(org.jkiss.dbeaver.ext.mysql.model.MySQLTableColumn) MySQLTableConstraint(org.jkiss.dbeaver.ext.mysql.model.MySQLTableConstraint)

Example 3 with EditForeignKeyPage

use of org.jkiss.dbeaver.ui.editors.object.struct.EditForeignKeyPage in project dbeaver by dbeaver.

the class OracleForeignKeyConfigurator method configureObject.

@Override
public OracleTableForeignKey configureObject(DBRProgressMonitor monitor, Object table, OracleTableForeignKey foreignKey) {
    return UITask.run(() -> {
        EditForeignKeyPage editPage = new EditForeignKeyPage(OracleUIMessages.edit_oracle_foreign_key_manager_dialog_title, foreignKey, new DBSForeignKeyModifyRule[] { DBSForeignKeyModifyRule.NO_ACTION, DBSForeignKeyModifyRule.CASCADE, DBSForeignKeyModifyRule.RESTRICT, DBSForeignKeyModifyRule.SET_NULL, DBSForeignKeyModifyRule.SET_DEFAULT });
        editPage.setSupportsCustomName(true);
        if (!editPage.edit()) {
            return null;
        }
        foreignKey.setReferencedConstraint((OracleTableConstraint) editPage.getUniqueConstraint());
        foreignKey.setName(editPage.getName());
        foreignKey.setDeleteRule(editPage.getOnDeleteRule());
        int colIndex = 1;
        for (EditForeignKeyPage.FKColumnInfo tableColumn : editPage.getColumns()) {
            foreignKey.addColumn(new OracleTableForeignKeyColumn(foreignKey, (OracleTableColumn) tableColumn.getOwnColumn(), colIndex++));
        }
        return foreignKey;
    });
}
Also used : OracleTableForeignKeyColumn(org.jkiss.dbeaver.ext.oracle.model.OracleTableForeignKeyColumn) OracleTableColumn(org.jkiss.dbeaver.ext.oracle.model.OracleTableColumn) EditForeignKeyPage(org.jkiss.dbeaver.ui.editors.object.struct.EditForeignKeyPage) OracleTableConstraint(org.jkiss.dbeaver.ext.oracle.model.OracleTableConstraint)

Example 4 with EditForeignKeyPage

use of org.jkiss.dbeaver.ui.editors.object.struct.EditForeignKeyPage in project dbeaver by dbeaver.

the class MySQLForeignKeyConfigurator method configureObject.

@Override
public MySQLTableForeignKey configureObject(DBRProgressMonitor monitor, Object table, MySQLTableForeignKey foreignKey) {
    return UITask.run(() -> {
        EditForeignKeyPage editPage = new EditForeignKeyPage(MySQLUIMessages.edit_foreign_key_manager_title, foreignKey, new DBSForeignKeyModifyRule[] { DBSForeignKeyModifyRule.NO_ACTION, DBSForeignKeyModifyRule.CASCADE, DBSForeignKeyModifyRule.RESTRICT, DBSForeignKeyModifyRule.SET_NULL, DBSForeignKeyModifyRule.SET_DEFAULT });
        if (!editPage.edit()) {
            return null;
        }
        foreignKey.setReferencedKey((MySQLTableConstraint) editPage.getUniqueConstraint());
        foreignKey.setDeleteRule(editPage.getOnDeleteRule());
        foreignKey.setUpdateRule(editPage.getOnUpdateRule());
        int colIndex = 1;
        for (EditForeignKeyPage.FKColumnInfo tableColumn : editPage.getColumns()) {
            foreignKey.addColumn(new MySQLTableForeignKeyColumn(foreignKey, (MySQLTableColumn) tableColumn.getOwnColumn(), colIndex++, (MySQLTableColumn) tableColumn.getRefColumn()));
        }
        return foreignKey;
    });
}
Also used : MySQLTableForeignKeyColumn(org.jkiss.dbeaver.ext.mysql.model.MySQLTableForeignKeyColumn) EditForeignKeyPage(org.jkiss.dbeaver.ui.editors.object.struct.EditForeignKeyPage) MySQLTableColumn(org.jkiss.dbeaver.ext.mysql.model.MySQLTableColumn) MySQLTableConstraint(org.jkiss.dbeaver.ext.mysql.model.MySQLTableConstraint)

Aggregations

EditForeignKeyPage (org.jkiss.dbeaver.ui.editors.object.struct.EditForeignKeyPage)4 MySQLTableColumn (org.jkiss.dbeaver.ext.mysql.model.MySQLTableColumn)2 MySQLTableConstraint (org.jkiss.dbeaver.ext.mysql.model.MySQLTableConstraint)2 MySQLTableForeignKeyColumn (org.jkiss.dbeaver.ext.mysql.model.MySQLTableForeignKeyColumn)2 OracleTableColumn (org.jkiss.dbeaver.ext.oracle.model.OracleTableColumn)2 OracleTableConstraint (org.jkiss.dbeaver.ext.oracle.model.OracleTableConstraint)2 OracleTableForeignKeyColumn (org.jkiss.dbeaver.ext.oracle.model.OracleTableForeignKeyColumn)2