public static Rectangle fixMessageBounds( Rectangle newBounds, Request cvr, LifelineEditPart host) { Object oc1 = getFirstElement( cvr.getExtendedData().get(SequenceRequestConstant.NEAREST_OCCURRENCE_SPECIFICATION)); Object oc2 = getFirstElement( cvr.getExtendedData().get(SequenceRequestConstant.NEAREST_OCCURRENCE_SPECIFICATION_2)); if (oc1 != null && oc2 != null && (oc1 instanceof MessageOccurrenceSpecification || oc2 instanceof MessageOccurrenceSpecification)) { Point start = null, end = null; Rectangle bounds = null; if (oc1 instanceof InteractionFragment) { start = SequenceUtil.findLocationOfEvent(host, (InteractionFragment) oc1, true); } if (oc2 instanceof InteractionFragment) { end = SequenceUtil.findLocationOfEvent(host, (InteractionFragment) oc2, true); } if (start != null && end != null) { bounds = (start.y < end.y) ? new Rectangle(start, end) : new Rectangle(end, start); } if (bounds != null) { IFigure parentFigure = host.getFigure(); Point parentFigDelta = parentFigure.getBounds().getLocation().getCopy().negate(); parentFigure.translateToRelative(bounds); bounds.translate(parentFigDelta); if (bounds.y != newBounds.y || newBounds.height != bounds.height) { newBounds.y = bounds.y; newBounds.height = bounds.height; } } } return newBounds; }