use of com.cubrid.common.ui.er.model.ERSchema in project cubrid-manager by CUBRID.
the class ERSchemaEditor method setInput.
protected void setInput(IEditorInput input) {
super.setInput(input);
if (input instanceof SchemaEditorInput) {
database = ((SchemaEditorInput) input).getDatabase();
}
tableNodesLoader = new ERSchemaTableNodesLoader(database);
erSchema = new ERSchema(database.getName(), (SchemaEditorInput) input);
erSchema.setLayoutManualDesiredAndFire(true);
initCollections(database.getDatabaseInfo());
}
use of com.cubrid.common.ui.er.model.ERSchema 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;
}
use of com.cubrid.common.ui.er.model.ERSchema in project cubrid-manager by CUBRID.
the class TableEditPolicy method createDeleteCommand.
@Override
protected Command createDeleteCommand(GroupRequest request) {
TablePart tablePart = (TablePart) getHost();
Rectangle bounds = tablePart.getFigure().getBounds().getCopy();
ERSchema parent = (ERSchema) (tablePart.getParent().getModel());
DeleteTableCommand deleteCmd = new DeleteTableCommand();
deleteCmd.setSchema(parent);
deleteCmd.setTable((ERTable) (tablePart.getModel()));
deleteCmd.setOriginalBounds(bounds);
return deleteCmd;
}
use of com.cubrid.common.ui.er.model.ERSchema in project cubrid-manager by CUBRID.
the class PartFactory method createEditPart.
public EditPart createEditPart(EditPart context, Object model) {
EditPart part = null;
if (model instanceof ERSchema) {
part = new SchemaDiagramPart();
} else if (model instanceof ERTable) {
part = new TablePart();
} else if (model instanceof Relationship) {
part = new RelationshipPart();
} else if (model instanceof ERTableColumn) {
part = new ColumnPart();
}
if (null == part) {
LOGGER.error("Part is null :" + context + "," + model);
}
part.setModel(model);
return part;
}
use of com.cubrid.common.ui.er.model.ERSchema in project cubrid-manager by CUBRID.
the class ERSchemaToolBar method createAutoLayoutComp.
/**
* Create auto layout button
*
* @return comp composite
*/
private Composite createAutoLayoutComp() {
Composite comp = new Composite(this, SWT.NONE);
final GridLayout gdLayout = new GridLayout(1, false);
gdLayout.marginHeight = 0;
final GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
comp.setLayout(gdLayout);
comp.setLayoutData(gridData);
final Button autoLayoutButton = new Button(comp, SWT.PUSH | SWT.CENTER | SWT.FILL);
autoLayoutButton.setLayoutData(gridData);
autoLayoutButton.setText(Messages.btnAutoLayout);
autoLayoutButton.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event event) {
ERSchema er = erSchemaEditor.getERSchema();
er.setTmpAutoLayoutAndFire();
}
});
return comp;
}
Aggregations