Search in sources :

Example 16 with EntityFigure

use of org.jkiss.dbeaver.ext.erd.figures.EntityFigure in project dbeaver by dbeaver.

the class EntityPart method revertNameChange.

/**
 * Reverts to existing name in model when exiting from a direct edit
 * (possibly before a commit which will result in a change in the label
 * value)
 */
public void revertNameChange() {
    EntityFigure entityFigure = getFigure();
    EditableLabel label = entityFigure.getNameLabel();
    ERDEntity entity = getTable();
    label.setText(entity.getObject().getName());
    label.setVisible(true);
    refreshVisuals();
}
Also used : EditableLabel(org.jkiss.dbeaver.ext.erd.figures.EditableLabel) EntityFigure(org.jkiss.dbeaver.ext.erd.figures.EntityFigure) ERDEntity(org.jkiss.dbeaver.ext.erd.model.ERDEntity)

Example 17 with EntityFigure

use of org.jkiss.dbeaver.ext.erd.figures.EntityFigure in project dbeaver by dbeaver.

the class EntityPart method performDirectEdit.

protected void performDirectEdit() {
    if (manager == null) {
        ERDGraphicalViewer viewer = getViewer();
        ValidationMessageHandler handler = viewer.getValidationHandler();
        EntityFigure figure = getFigure();
        EditableLabel nameLabel = figure.getNameLabel();
        manager = new ExtendedDirectEditManager(this, TextCellEditor.class, new LabelCellEditorLocator(nameLabel), nameLabel, new TableNameCellEditorValidator(handler));
    }
    manager.show();
}
Also used : EditableLabel(org.jkiss.dbeaver.ext.erd.figures.EditableLabel) EntityFigure(org.jkiss.dbeaver.ext.erd.figures.EntityFigure) ExtendedDirectEditManager(org.jkiss.dbeaver.ext.erd.directedit.ExtendedDirectEditManager) LabelCellEditorLocator(org.jkiss.dbeaver.ext.erd.directedit.LabelCellEditorLocator) ValidationMessageHandler(org.jkiss.dbeaver.ext.erd.directedit.ValidationMessageHandler) TextCellEditor(org.eclipse.jface.viewers.TextCellEditor) TableNameCellEditorValidator(org.jkiss.dbeaver.ext.erd.directedit.TableNameCellEditorValidator) ERDGraphicalViewer(org.jkiss.dbeaver.ext.erd.editor.ERDGraphicalViewer)

Example 18 with EntityFigure

use of org.jkiss.dbeaver.ext.erd.figures.EntityFigure in project dbeaver by dbeaver.

the class EntityPart method directEditHitTest.

private boolean directEditHitTest(Point requestLoc) {
    EntityFigure figure = getFigure();
    EditableLabel nameLabel = figure.getNameLabel();
    nameLabel.translateToRelative(requestLoc);
    return nameLabel.containsPoint(requestLoc);
}
Also used : EditableLabel(org.jkiss.dbeaver.ext.erd.figures.EditableLabel) EntityFigure(org.jkiss.dbeaver.ext.erd.figures.EntityFigure)

Aggregations

EntityFigure (org.jkiss.dbeaver.ext.erd.figures.EntityFigure)18 EditableLabel (org.jkiss.dbeaver.ext.erd.figures.EditableLabel)10 Rectangle (org.eclipse.draw2d.geometry.Rectangle)5 ERDEntity (org.jkiss.dbeaver.ext.erd.model.ERDEntity)4 FileOutputStream (java.io.FileOutputStream)2 HashMap (java.util.HashMap)2 Bendpoint (org.eclipse.draw2d.Bendpoint)2 Point (org.eclipse.draw2d.geometry.Point)2 TextCellEditor (org.eclipse.jface.viewers.TextCellEditor)2 ExtendedDirectEditManager (org.jkiss.dbeaver.ext.erd.directedit.ExtendedDirectEditManager)2 LabelCellEditorLocator (org.jkiss.dbeaver.ext.erd.directedit.LabelCellEditorLocator)2 TableNameCellEditorValidator (org.jkiss.dbeaver.ext.erd.directedit.TableNameCellEditorValidator)2 ValidationMessageHandler (org.jkiss.dbeaver.ext.erd.directedit.ValidationMessageHandler)2 ERDGraphicalViewer (org.jkiss.dbeaver.ext.erd.editor.ERDGraphicalViewer)2 AttributeListFigure (org.jkiss.dbeaver.ext.erd.figures.AttributeListFigure)2 ERDAssociation (org.jkiss.dbeaver.ext.erd.model.ERDAssociation)2 ERDEntityAttribute (org.jkiss.dbeaver.ext.erd.model.ERDEntityAttribute)2 EntityDiagram (org.jkiss.dbeaver.ext.erd.model.EntityDiagram)2 AssociationPart (org.jkiss.dbeaver.ext.erd.part.AssociationPart)2 EntityPart (org.jkiss.dbeaver.ext.erd.part.EntityPart)2