Search in sources :

Example 11 with NodeAnnotationEditPart

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

the class SnapIconToGrid method getReferencePart.

/**
 * Returns the part the request started on (the part that was dragged to move all selected nodes).
 * @param parts
 * @param mouseLoc
 * @param moveDelta
 * @return
 */
private EditPart getReferencePart(@SuppressWarnings("rawtypes") final List parts, final Point mouseLoc, final Point moveDelta) {
    int i = 0;
    Point loc = mouseLoc.getCopy().translate(moveDelta.getCopy().negate());
    makeRelative(m_container.getContentPane(), loc);
    while (i < parts.size()) {
        GraphicalEditPart result = (GraphicalEditPart) parts.get(i);
        if (result.getFigure().containsPoint(loc)) {
            return result;
        }
        if (result instanceof NodeContainerEditPart) {
            NodeAnnotationEditPart annoPart = ((NodeContainerEditPart) result).getNodeAnnotationEditPart();
            if (annoPart.getFigure().containsPoint(loc)) {
                return annoPart;
            }
        }
        i++;
    }
    return null;
}
Also used : NodeContainerEditPart(org.knime.workbench.editor2.editparts.NodeContainerEditPart) Point(org.eclipse.draw2d.geometry.Point) GraphicalEditPart(org.eclipse.gef.GraphicalEditPart) Point(org.eclipse.draw2d.geometry.Point) NodeAnnotationEditPart(org.knime.workbench.editor2.editparts.NodeAnnotationEditPart)

Aggregations

NodeAnnotationEditPart (org.knime.workbench.editor2.editparts.NodeAnnotationEditPart)10 NodeContainerEditPart (org.knime.workbench.editor2.editparts.NodeContainerEditPart)7 AnnotationEditPart (org.knime.workbench.editor2.editparts.AnnotationEditPart)6 EditPart (org.eclipse.gef.EditPart)4 Point (org.eclipse.draw2d.geometry.Point)3 Rectangle (org.eclipse.draw2d.geometry.Rectangle)3 GraphicalEditPart (org.eclipse.gef.GraphicalEditPart)3 Annotation (org.knime.core.node.workflow.Annotation)3 NodeAnnotation (org.knime.core.node.workflow.NodeAnnotation)3 ConnectionContainerEditPart (org.knime.workbench.editor2.editparts.ConnectionContainerEditPart)3 NodeContainerFigure (org.knime.workbench.editor2.figures.NodeContainerFigure)3 IFigure (org.eclipse.draw2d.IFigure)2 Composite (org.eclipse.swt.widgets.Composite)2 NodeContainerUI (org.knime.core.ui.node.workflow.NodeContainerUI)2 AbstractWorkflowEditPart (org.knime.workbench.editor2.editparts.AbstractWorkflowEditPart)2 WorkflowRootEditPart (org.knime.workbench.editor2.editparts.WorkflowRootEditPart)2 EventObject (java.util.EventObject)1 HashSet (java.util.HashSet)1 Iterator (java.util.Iterator)1 LinkedList (java.util.LinkedList)1