Search in sources :

Example 1 with ResizeNoteCommand

use of org.talend.designer.core.ui.editor.cmd.ResizeNoteCommand in project tdi-studio-se by Talend.

the class NoteResizableEditPolicy method getResizeCommand.

@Override
protected Command getResizeCommand(ChangeBoundsRequest request) {
    Object parent = getHost().getParent().getModel();
    if (!(parent instanceof Process)) {
        return null;
    }
    Note note = (Note) getHost().getModel();
    if (note.isReadOnly()) {
        return null;
    }
    TalendScalableFreeformRootEditPart rootEditPart = (TalendScalableFreeformRootEditPart) getHost().getRoot();
    double scale = 1 / rootEditPart.getZoomManager().getZoom();
    return new ResizeNoteCommand(note, new Dimension(note.getSize().width + request.getSizeDelta().getScaled(scale).width, note.getSize().height + request.getSizeDelta().getScaled(scale).height));
}
Also used : TalendScalableFreeformRootEditPart(org.talend.designer.core.ui.editor.TalendScalableFreeformRootEditPart) ResizeNoteCommand(org.talend.designer.core.ui.editor.cmd.ResizeNoteCommand) Process(org.talend.designer.core.ui.editor.process.Process) Dimension(org.eclipse.draw2d.geometry.Dimension) PrecisionDimension(org.eclipse.draw2d.geometry.PrecisionDimension)

Aggregations

Dimension (org.eclipse.draw2d.geometry.Dimension)1 PrecisionDimension (org.eclipse.draw2d.geometry.PrecisionDimension)1 TalendScalableFreeformRootEditPart (org.talend.designer.core.ui.editor.TalendScalableFreeformRootEditPart)1 ResizeNoteCommand (org.talend.designer.core.ui.editor.cmd.ResizeNoteCommand)1 Process (org.talend.designer.core.ui.editor.process.Process)1