Source:
<code>public void register(final Element element) { if (null != element.asNode() && checkNotRegistered(element)) { final Canvas<?> canvas = canvasHandler.getCanvas(); final Shape<?> shape = canvas.getShape(element.getUUID()); shape.getShapeView().setDragEnabled(true); if (shape.getShapeView() instanceof HasDragBounds) { ensureDragConstraints((HasDragBounds<?>) shape.getShapeView()); } if (shape.getShapeView() instanceof HasEventHandlers) { final HasEventHandlers hasEventHandlers = (HasEventHandlers) shape.getShapeView(); if (supportsMouseEnter(hasEventHandlers) && supportsMouseExit(hasEventHandlers)) { final MouseEnterHandler overHandler = new MouseEnterHandler() { @Override public void handle(MouseEnterEvent event) { canvasHandler.getAbstractCanvas().getView().setCursor(AbstractCanvas.Cursors.MOVE); } }; hasEventHandlers.addHandler(ViewEventType.MOUSE_ENTER, overHandler); registerHandler(shape.getUUID(), overHandler); final MouseExitHandler outHandler = new MouseExitHandler() { @Override public void handle(MouseExitEvent event) { canvasHandler.getAbstractCanvas().getView().setCursor(AbstractCanvas.Cursors.AUTO); } }; hasEventHandlers.addHandler(ViewEventType.MOUSE_EXIT, outHandler); registerHandler(shape.getUUID(), outHandler); final DragHandler dragHandler = new DragHandler() { @Override public void start(DragEvent event) { if (selectionControl != null) { final Element item = canvasHandler.getGraphIndex().get(shape.getUUID()); if (!selectionControl.isSelected(item)) { <START> selectionControl.getSelectedItems() <END> .forEach(uuid -> selectionControl.deselect(String.valueOf(uuid))); selectionControl.select(item); } } } @Override public void end(DragEvent event) { } @Override public void handle(DragEvent event) { } }; hasEventHandlers.addHandler(ViewEventType.DRAG, dragHandler); registerHandler(shape.getUUID(), dragHandler); } } } }</code><technical_language>I guess is some clear method in SelectionControl instead of external iteration</technical_language>

Target:
public void register(final Element element) { if (null != element.asNode() && checkNotRegistered(element)) { final Canvas<?> canvas = canvasHandler.getCanvas(); final Shape<?> shape = canvas.getShape(element.getUUID()); shape.getShapeView().setDragEnabled(true); if (shape.getShapeView() instanceof HasDragBounds) { ensureDragConstraints((HasDragBounds<?>) shape.getShapeView()); } if (shape.getShapeView() instanceof HasEventHandlers) { final HasEventHandlers hasEventHandlers = (HasEventHandlers) shape.getShapeView(); if (supportsMouseEnter(hasEventHandlers) && supportsMouseExit(hasEventHandlers)) { final MouseEnterHandler overHandler = new MouseEnterHandler() { @Override public void handle(MouseEnterEvent event) { canvasHandler.getAbstractCanvas().getView().setCursor(AbstractCanvas.Cursors.MOVE); } }; hasEventHandlers.addHandler(ViewEventType.MOUSE_ENTER, overHandler); registerHandler(shape.getUUID(), overHandler); final MouseExitHandler outHandler = new MouseExitHandler() { @Override public void handle(MouseExitEvent event) { canvasHandler.getAbstractCanvas().getView().setCursor(AbstractCanvas.Cursors.AUTO); } }; hasEventHandlers.addHandler(ViewEventType.MOUSE_EXIT, outHandler); registerHandler(shape.getUUID(), outHandler); final DragHandler dragHandler = new DragHandler() { @Override public void start(DragEvent event) { if (Objects.nonNull(selectionEvent)) { selectionEvent.fire(new CanvasSelectionEvent(canvasHandler, shape.getUUID())); } } @Override public void end(DragEvent event) { } @Override public void handle(DragEvent event) { } }; hasEventHandlers.addHandler(ViewEventType.DRAG, dragHandler); registerHandler(shape.getUUID(), dragHandler); } } } }