Source:
<code>private Point computeRelativeLocation(final Point absolutePointerLocation, boolean isBorderNode, boolean isConcernedBorderedNode) { if (absolutePointerLocation != null && getHost() instanceof IGraphicalEditPart) { final IFigure hostFigure = ((IGraphicalEditPart) getHost()).getFigure(); <START> Dimension difference = new Dimension(absolutePointerLocation.x, absolutePointerLocation.y); if (!(getHost() instanceof DiagramEditPart)) { Point topLeftHostLocation = hostFigure.getBounds().getTopLeft().getCopy(); if (topLeftHostLocation.x == -1) { topLeftHostLocation.x = 0; } hostFigure.translateToAbsolute(topLeftHostLocation); GraphicalHelper.screen2logical(topLeftHostLocation, (IGraphicalEditPart) getHost()); difference = absolutePointerLocation.getDifference(topLeftHostLocation); } <END> Point locationHint = new Point(difference.width, difference.height); if ((hostFigure instanceof ResizableCompartmentFigure) && (getHost() instanceof AbstractDNodeContainerCompartmentEditPart) && !isBorderNode) { final Point scrollOffset = ((ResizableCompartmentFigure) hostFigure).getScrollPane().getViewport().getViewLocation(); final Point shiftFromMarginOffset = FigureUtilities.getShiftFromMarginOffset((ResizableCompartmentFigure) hostFigure, isConcernedBorderedNode, getHost()); locationHint = new Point(locationHint.x + scrollOffset.x - shiftFromMarginOffset.x, locationHint.y + scrollOffset.y - shiftFromMarginOffset.y); } return locationHint; } return null; }</code><technical_language>Style remark: I form more readable: final Dimension difference; if (getHost() instanceof DiagramEditPart) { difference = ...; } else { ... difference = ...; } avoids negative test double-assignment difference clear cases handle are</technical_language>

Target:
private Point computeRelativeLocation(final Point absolutePointerLocation, boolean isBorderNode, boolean isConcernedBorderedNode) { if (absolutePointerLocation != null && getHost() instanceof IGraphicalEditPart) { final IFigure hostFigure = ((IGraphicalEditPart) getHost()).getFigure(); Dimension difference; if (getHost() instanceof DiagramEditPart) { difference = new Dimension(absolutePointerLocation.x, absolutePointerLocation.y); } else { Point topLeftHostLocation = hostFigure.getBounds().getTopLeft().getCopy(); if (topLeftHostLocation.x == -1) { topLeftHostLocation.x = 0; } hostFigure.translateToAbsolute(topLeftHostLocation); GraphicalHelper.screen2logical(topLeftHostLocation, (IGraphicalEditPart) getHost()); difference = absolutePointerLocation.getDifference(topLeftHostLocation); } Point locationHint = new Point(difference.width, difference.height); if ((hostFigure instanceof ResizableCompartmentFigure) && (getHost() instanceof AbstractDNodeContainerCompartmentEditPart) && !isBorderNode) { final Point scrollOffset = ((ResizableCompartmentFigure) hostFigure).getScrollPane().getViewport().getViewLocation(); final Point shiftFromMarginOffset = FigureUtilities.getShiftFromMarginOffset((ResizableCompartmentFigure) hostFigure, isConcernedBorderedNode, getHost()); locationHint = new Point(locationHint.x + scrollOffset.x - shiftFromMarginOffset.x, locationHint.y + scrollOffset.y - shiftFromMarginOffset.y); } return locationHint; } return null; }