Search in sources :

Example 6 with TablePart

use of com.cubrid.common.ui.er.part.TablePart in project cubrid-manager by CUBRID.

the class TableDirectEditPolicy method revertOldEditValue.

@Override
protected void revertOldEditValue(DirectEditRequest request) {
    CellEditor cellEditor = request.getCellEditor();
    cellEditor.setValue(oldValue);
    TablePart tablePart = (TablePart) getHost();
    tablePart.revertNameChange();
}
Also used : CellEditor(org.eclipse.jface.viewers.CellEditor) TablePart(com.cubrid.common.ui.er.part.TablePart)

Example 7 with TablePart

use of com.cubrid.common.ui.er.part.TablePart 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;
}
Also used : TablePart(com.cubrid.common.ui.er.part.TablePart) Rectangle(org.eclipse.draw2d.geometry.Rectangle) ERSchema(com.cubrid.common.ui.er.model.ERSchema) DeleteTableCommand(com.cubrid.common.ui.er.commands.DeleteTableCommand)

Example 8 with TablePart

use of com.cubrid.common.ui.er.part.TablePart in project cubrid-manager by CUBRID.

the class TableNodeEditPolicy method getConnectionCreateCommand.

/**
	 * @see GraphicalNodeEditPolicy#getConnectionCreateCommand(CreateConnectionRequest)
	 */
@Override
protected Command getConnectionCreateCommand(CreateConnectionRequest request) {
    CreateRelationshipCommand cmd = new CreateRelationshipCommand();
    TablePart part = (TablePart) getHost();
    cmd.setForeignTable(part.getTable());
    request.setStartCommand(cmd);
    return cmd;
}
Also used : TablePart(com.cubrid.common.ui.er.part.TablePart) CreateRelationshipCommand(com.cubrid.common.ui.er.commands.CreateRelationshipCommand)

Example 9 with TablePart

use of com.cubrid.common.ui.er.part.TablePart in project cubrid-manager by CUBRID.

the class TableNodeEditPolicy method getReconnectSourceCommand.

/**
	 * @see GraphicalNodeEditPolicy#getReconnectSourceCommand(ReconnectRequest)
	 */
@Override
protected Command getReconnectSourceCommand(ReconnectRequest request) {
    ReconnectForeignKeyCommand cmd = new ReconnectForeignKeyCommand();
    cmd.setRelationship((Relationship) request.getConnectionEditPart().getModel());
    TablePart tablePart = (TablePart) getHost();
    cmd.setSourceForeignKey(tablePart.getTable());
    return cmd;
}
Also used : TablePart(com.cubrid.common.ui.er.part.TablePart) ReconnectForeignKeyCommand(com.cubrid.common.ui.er.commands.ReconnectForeignKeyCommand)

Example 10 with TablePart

use of com.cubrid.common.ui.er.part.TablePart in project cubrid-manager by CUBRID.

the class ERSchemaEditor method setAllFiguresOrigin.

/**
	 * When user click the empty space on the ERD canvas, then all the table
	 * should be unselected and background color should be reset to default.
	 */
public void setAllFiguresOrigin() {
    graphicalViewer.setFocus(null);
    graphicalViewer.deselectAll();
    SchemaDiagramPart schemaRootPart = getERSchemaRootPart();
    List allParts = schemaRootPart.getChildren();
    Iterator it = allParts.iterator();
    while (it.hasNext()) {
        Object obj = it.next();
        if (!(obj instanceof TablePart)) {
            continue;
        }
        TablePart tablePart = (TablePart) obj;
        tablePart.setSelected(TablePart.SELECTED_NONE);
        tablePart.getFigure().setBackgroundColor(TableFigure.defaultBackgroundColor);
    }
}
Also used : SchemaDiagramPart(com.cubrid.common.ui.er.part.SchemaDiagramPart) Iterator(java.util.Iterator) TablePart(com.cubrid.common.ui.er.part.TablePart) ArrayList(java.util.ArrayList) List(java.util.List) EventObject(java.util.EventObject)

Aggregations

TablePart (com.cubrid.common.ui.er.part.TablePart)21 List (java.util.List)7 ERTable (com.cubrid.common.ui.er.model.ERTable)5 RelationshipPart (com.cubrid.common.ui.er.part.RelationshipPart)4 ColumnPart (com.cubrid.common.ui.er.part.ColumnPart)3 SchemaDiagramPart (com.cubrid.common.ui.er.part.SchemaDiagramPart)3 ArrayList (java.util.ArrayList)3 EventObject (java.util.EventObject)3 Iterator (java.util.Iterator)3 Rectangle (org.eclipse.draw2d.geometry.Rectangle)3 CreateRelationshipCommand (com.cubrid.common.ui.er.commands.CreateRelationshipCommand)2 TableFigure (com.cubrid.common.ui.er.figures.TableFigure)2 ERTableColumn (com.cubrid.common.ui.er.model.ERTableColumn)2 Edge (org.eclipse.draw2d.graph.Edge)2 CreateColumnCommand (com.cubrid.common.ui.er.commands.CreateColumnCommand)1 DeleteTableCommand (com.cubrid.common.ui.er.commands.DeleteTableCommand)1 MoveTableCommand (com.cubrid.common.ui.er.commands.MoveTableCommand)1 ReconnectForeignKeyCommand (com.cubrid.common.ui.er.commands.ReconnectForeignKeyCommand)1 ReconnectPrimaryKeyCommand (com.cubrid.common.ui.er.commands.ReconnectPrimaryKeyCommand)1 TransferColumnCommand (com.cubrid.common.ui.er.commands.TransferColumnCommand)1