Search in sources :

Example 6 with NotePart

use of org.jkiss.dbeaver.ext.erd.part.NotePart in project dbeaver by serge-rider.

the class NoteCreateCommand method execute.

@Override
public void execute() {
    diagramPart.getDiagram().addNote(note, true);
    if (location != null) {
        // Set new note location
        for (Object diagramChild : diagramPart.getChildren()) {
            if (diagramChild instanceof NotePart) {
                NotePart entityPart = (NotePart) diagramChild;
                if (entityPart.getNote() == note) {
                    final Dimension size = entityPart.getFigure().getPreferredSize();
                    final Rectangle newBounds = new Rectangle(location.x, location.y, size.width, size.height);
                    entityPart.modifyBounds(newBounds);
                    break;
                }
            }
        }
    }
}
Also used : NotePart(org.jkiss.dbeaver.ext.erd.part.NotePart) Rectangle(org.eclipse.draw2d.geometry.Rectangle) Dimension(org.eclipse.draw2d.geometry.Dimension)

Example 7 with NotePart

use of org.jkiss.dbeaver.ext.erd.part.NotePart in project dbeaver by serge-rider.

the class NoteEditPolicy method createDeleteCommand.

@Override
protected Command createDeleteCommand(GroupRequest request) {
    NotePart notePart = (NotePart) getHost();
    Rectangle bounds = notePart.getFigure().getBounds().getCopy();
    EntityDiagram parent = (EntityDiagram) (notePart.getParent().getModel());
    return new NoteDeleteCommand(parent, notePart, bounds);
}
Also used : NoteDeleteCommand(org.jkiss.dbeaver.ext.erd.command.NoteDeleteCommand) EntityDiagram(org.jkiss.dbeaver.ext.erd.model.EntityDiagram) NotePart(org.jkiss.dbeaver.ext.erd.part.NotePart) Rectangle(org.eclipse.draw2d.geometry.Rectangle)

Example 8 with NotePart

use of org.jkiss.dbeaver.ext.erd.part.NotePart in project dbeaver by dbeaver.

the class NoteDirectEditPolicy method revertOldEditValue.

/**
 * @param request
 */
@Override
protected void revertOldEditValue(DirectEditRequest request) {
    CellEditor cellEditor = request.getCellEditor();
    cellEditor.setValue(oldValue);
    NotePart entityPart = (NotePart) getHost();
    entityPart.revertNameChange();
}
Also used : NotePart(org.jkiss.dbeaver.ext.erd.part.NotePart) CellEditor(org.eclipse.jface.viewers.CellEditor)

Example 9 with NotePart

use of org.jkiss.dbeaver.ext.erd.part.NotePart in project dbeaver by dbeaver.

the class NoteEditPolicy method createDeleteCommand.

@Override
protected Command createDeleteCommand(GroupRequest request) {
    NotePart notePart = (NotePart) getHost();
    Rectangle bounds = notePart.getFigure().getBounds().getCopy();
    EntityDiagram parent = (EntityDiagram) (notePart.getParent().getModel());
    return new NoteDeleteCommand(parent, notePart, bounds);
}
Also used : NoteDeleteCommand(org.jkiss.dbeaver.ext.erd.command.NoteDeleteCommand) EntityDiagram(org.jkiss.dbeaver.ext.erd.model.EntityDiagram) NotePart(org.jkiss.dbeaver.ext.erd.part.NotePart) Rectangle(org.eclipse.draw2d.geometry.Rectangle)

Aggregations

NotePart (org.jkiss.dbeaver.ext.erd.part.NotePart)9 Rectangle (org.eclipse.draw2d.geometry.Rectangle)5 Dimension (org.eclipse.draw2d.geometry.Dimension)2 CellEditor (org.eclipse.jface.viewers.CellEditor)2 NoteDeleteCommand (org.jkiss.dbeaver.ext.erd.command.NoteDeleteCommand)2 EntityDiagram (org.jkiss.dbeaver.ext.erd.model.EntityDiagram)2 AbsoluteBendpoint (org.eclipse.draw2d.AbsoluteBendpoint)1 Bendpoint (org.eclipse.draw2d.Bendpoint)1 RelativeBendpoint (org.eclipse.draw2d.RelativeBendpoint)1 Point (org.eclipse.draw2d.geometry.Point)1 DBException (org.jkiss.dbeaver.DBException)1 AssociationPart (org.jkiss.dbeaver.ext.erd.part.AssociationPart)1 EntityPart (org.jkiss.dbeaver.ext.erd.part.EntityPart)1 XMLBuilder (org.jkiss.utils.xml.XMLBuilder)1