use of com.cubrid.common.ui.cubrid.table.dialog.AddFKDialog in project cubrid-manager by CUBRID.
the class CreateRelationshipCommand method execute.
@Override
public void execute() {
if (!check()) {
return;
}
ERSchema erSchema = foreignTable.getERSchema();
SchemaInfo fkSchemaInfo = erSchema.getSchemaInfo(foreignTable.getName());
AddFKDialog dlg = new AddFKDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), erSchema.getCubridDatabase(), fkSchemaInfo, null, false, erSchema.getAllSchemaInfo());
dlg.setDefaultTableName(primaryTable.getName());
int returnCode = dlg.open();
if (returnCode == AddFKDialog.OK) {
Constraint fk = dlg.getRetFK();
if (fk == null) {
return;
}
CubridTableParser parser = new CubridTableParser(erSchema);
try {
parser.addFKShip(foreignTable, fkSchemaInfo, fk);
fkSchemaInfo.addConstraint(fk);
} catch (Exception e) {
CommonUITool.openErrorBox(e.getMessage());
}
}
}
Aggregations