Source:
<code>public static Dimension getContainerTopLeftInsets(Node node, boolean searchFirstParentContainer) { Dimension result = new Dimension(0, 0); if (node.eContainer() instanceof Node) { Node parentNode = (Node) <START> node.eContainer(); <END> NodeQuery nodeQuery = new NodeQuery(parentNode); if (nodeQuery.isContainer()) { EObject element = parentNode.getElement(); if (element instanceof DDiagramElementContainer) { DDiagramElementContainer ddec = (DDiagramElementContainer) element; if (ddec instanceof DNodeContainer) { if (new DNodeContainerExperimentalQuery((DNodeContainer) ddec).isRegionContainer() || hasFullLabelBorder(ddec)) { result.setHeight(CONTAINER_INSETS.y + getLabelSize(parentNode) + AbstractDiagramElementContainerEditPart.DEFAULT_SPACING); } else { result.setWidth(CONTAINER_INSETS.x); result.setHeight(CONTAINER_INSETS.y); } } ContainerStyle containerStyle = ddec.getOwnedStyle(); int borderSize = containerStyle.getBorderSize().intValue(); DDiagramElementContainerExperimentalQuery regionQuery = new DDiagramElementContainerExperimentalQuery(ddec); if (regionQuery.isRegionInHorizontalStack()) { result.setWidth(result.width() + (isFirstRegion(ddec) ? 0 : borderSize)); result.setHeight(result.height() + 1); } else if (regionQuery.isRegionInVerticalStack()) { result.setWidth(result.width() + 1); result.setHeight(result.height() + (isFirstRegion(ddec) ? 1 : borderSize)); } else { result.setWidth(result.width() + borderSize); result.setHeight(result.height() + borderSize); } } } else if (searchFirstParentContainer) { result = getContainerTopLeftInsets(parentNode, searchFirstParentContainer); } } return result; }</code><technical_language>eContainer() is called twice</technical_language>

Target:
public static Dimension getContainerTopLeftInsets(Node node, boolean searchFirstParentContainer) { Dimension result = new Dimension(0, 0); EObject nodeContainer = node.eContainer(); if (nodeContainer instanceof Node) { Node parentNode = (Node) nodeContainer; NodeQuery nodeQuery = new NodeQuery(parentNode); if (nodeQuery.isContainer()) { EObject element = parentNode.getElement(); if (element instanceof DDiagramElementContainer) { DDiagramElementContainer ddec = (DDiagramElementContainer) element; if (ddec instanceof DNodeContainer) { if (new DNodeContainerExperimentalQuery((DNodeContainer) ddec).isRegionContainer() || hasFullLabelBorder(ddec)) { result.setHeight(CONTAINER_INSETS.y + getLabelSize(parentNode) + AbstractDiagramElementContainerEditPart.DEFAULT_SPACING); } else { result.setWidth(CONTAINER_INSETS.x); result.setHeight(CONTAINER_INSETS.y); } } ContainerStyle containerStyle = ddec.getOwnedStyle(); int borderSize = containerStyle.getBorderSize().intValue(); DDiagramElementContainerExperimentalQuery regionQuery = new DDiagramElementContainerExperimentalQuery(ddec); if (regionQuery.isRegionInHorizontalStack()) { result.setWidth(result.width() + (isFirstRegion(ddec) ? 0 : borderSize)); result.setHeight(result.height() + 1); } else if (regionQuery.isRegionInVerticalStack()) { result.setWidth(result.width() + 1); result.setHeight(result.height() + (isFirstRegion(ddec) ? 1 : borderSize)); } else { result.setWidth(result.width() + borderSize); result.setHeight(result.height() + borderSize); } } } else if (searchFirstParentContainer) { result = getContainerTopLeftInsets(parentNode, searchFirstParentContainer); } } return result; }