use of com.cubrid.common.ui.er.commands.AddTableCommand in project cubrid-manager by CUBRID.
the class SchemaContainerEditPolicy method getCreateCommand.
@Override
protected Command getCreateCommand(CreateRequest request) {
Object newObject = request.getNewObject();
if (!(newObject instanceof ERTable)) {
return null;
}
Point location = request.getLocation();
SchemaDiagramPart schemaPart = (SchemaDiagramPart) getHost();
ERSchema erSchema = schemaPart.getSchema();
ERTable erTable = (ERTable) newObject;
ERSchemaEditor editor = schemaPart.getEditor();
int offsetX = 0;
int offsetY = 0;
if (editor != null) {
offsetX = editor.getHorizontalScrollWidth();
offsetY = editor.getVerticalScrollHeight();
}
erTable.setBounds(new Rectangle(location.x + offsetX, location.y + offsetY, erTable.getMinWidth(), erTable.getMinHeight()));
AddTableCommand addTableCommand = new AddTableCommand();
addTableCommand.setSchema(erSchema);
SchemaInfo schemaInfo = ERTable.createEmptySchemaInfo(erTable.getName(), erTable.getCubridDatabase().getName());
addTableCommand.setTable(erTable, schemaInfo);
return addTableCommand;
}
Aggregations