Search in sources :

Example 1 with WorkflowSelectionDragEditPartsTracker

use of org.knime.workbench.editor2.WorkflowSelectionDragEditPartsTracker in project knime-core by knime.

the class AnnotationEditPart method getDragTracker.

/**
 * {@inheritDoc}
 * If dragging started on the "move" icon (top left corner) return the normal edit part dragger tool, otherwise
 * return the marquee selection tool.
 */
@Override
public DragTracker getDragTracker(final Request request) {
    Object object = request.getExtendedData().get(WorkflowSelectionTool.DRAG_START_LOCATION);
    IFigure f = getFigure();
    if (object instanceof Point && f instanceof WorkflowAnnotationFigure && getSelected() == SELECTED_NONE) {
        PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor().getEditorSite();
        Rectangle iconBounds = ((WorkflowAnnotationFigure) f).getEditIconBounds().getCopy();
        if (!iconBounds.contains((Point) object)) {
            return new WorkflowMarqueeSelectionTool();
        }
    }
    // "normal" edit part dragging
    return new WorkflowSelectionDragEditPartsTracker(this);
}
Also used : WorkflowAnnotationFigure(org.knime.workbench.editor2.figures.WorkflowAnnotationFigure) WorkflowMarqueeSelectionTool(org.knime.workbench.editor2.WorkflowMarqueeSelectionTool) Rectangle(org.eclipse.draw2d.geometry.Rectangle) WorkflowSelectionDragEditPartsTracker(org.knime.workbench.editor2.WorkflowSelectionDragEditPartsTracker) Point(org.eclipse.draw2d.geometry.Point) IFigure(org.eclipse.draw2d.IFigure)

Aggregations

IFigure (org.eclipse.draw2d.IFigure)1 Point (org.eclipse.draw2d.geometry.Point)1 Rectangle (org.eclipse.draw2d.geometry.Rectangle)1 WorkflowMarqueeSelectionTool (org.knime.workbench.editor2.WorkflowMarqueeSelectionTool)1 WorkflowSelectionDragEditPartsTracker (org.knime.workbench.editor2.WorkflowSelectionDragEditPartsTracker)1 WorkflowAnnotationFigure (org.knime.workbench.editor2.figures.WorkflowAnnotationFigure)1