Source:
private int getActualLabelAlignment(AbstractDiagramNameEditPart abstractDiagramNameEditPart) { int actualLabelAlignment = 0; IFigure abstractGraphicalEditPartFigure = abstractDiagramNameEditPart.getFigure(); Assert.assertTrue("This figure should be a SiriusWrapLabel.", abstractGraphicalEditPartFigure instanceof SiriusWrapLabel); SiriusWrapLabel abstractGraphicalEditPartWrappingLabel = (SiriusWrapLabel) abstractGraphicalEditPartFigure; LayoutManager layoutManager = abstractGraphicalEditPartWrappingLabel.getParent().getLayoutManager(); if (layoutManager instanceof ToolbarLayout) { ToolbarLayout ePackage1WrappingLabelParentLayoutManager = (ToolbarLayout) abstractGraphicalEditPartWrappingLabel.getParent().getLayoutManager(); actualLabelAlignment = ePackage1WrappingLabelParentLayoutManager.getMinorAlignment(); int labelRefX = 0; int parentRefX = 0; if (ToolbarLayout.ALIGN_TOPLEFT == actualLabelAlignment) { labelRefX = abstractGraphicalEditPartWrappingLabel.getBounds().getLeft().x; parentRefX = abstractGraphicalEditPartWrappingLabel.getParent().getBounds().getLeft().x; } else if (ToolbarLayout.ALIGN_BOTTOMRIGHT == actualLabelAlignment) { labelRefX = abstractGraphicalEditPartWrappingLabel.getBounds().getRight().x; parentRefX = abstractGraphicalEditPartWrappingLabel.getParent().getBounds().getRight().x; } else if (ToolbarLayout.ALIGN_CENTER == actualLabelAlignment) { labelRefX = abstractGraphicalEditPartWrappingLabel.getBounds().getCenter().x; parentRefX = abstractGraphicalEditPartWrappingLabel.getParent().getBounds().getCenter().x; } assertEquals("Figure alignement is not consitent with style", parentRefX, labelRefX, 5); } else { Assert.fail(" a AbstractGraphicalEditPart should have a ToolbarLayout on its main figure"); } return actualLabelAlignment; }

Target:
private int getActualLabelAlignment(AbstractDiagramNameEditPart abstractDiagramNameEditPart) { int actualLabelAlignment = 0; IFigure abstractGraphicalEditPartFigure = abstractDiagramNameEditPart.getFigure(); Assert.assertTrue("This figure should be a SiriusWrapLabel.", abstractGraphicalEditPartFigure instanceof SiriusWrapLabel); SiriusWrapLabel abstractGraphicalEditPartWrappingLabel = (SiriusWrapLabel) abstractGraphicalEditPartFigure; LayoutManager layoutManager = abstractGraphicalEditPartWrappingLabel.getParent().getLayoutManager(); if (layoutManager instanceof ToolbarLayout) { ToolbarLayout ePackage1WrappingLabelParentLayoutManager = (ToolbarLayout) abstractGraphicalEditPartWrappingLabel.getParent().getLayoutManager(); actualLabelAlignment = ePackage1WrappingLabelParentLayoutManager.getMinorAlignment(); int labelRefX = 0; int parentRefX = 0; if (ToolbarLayout.ALIGN_TOPLEFT == actualLabelAlignment) { labelRefX = abstractGraphicalEditPartWrappingLabel.getBounds().getLeft().x; parentRefX = abstractGraphicalEditPartWrappingLabel.getParent().getBounds().getLeft().x; } else if (ToolbarLayout.ALIGN_BOTTOMRIGHT == actualLabelAlignment) { labelRefX = abstractGraphicalEditPartWrappingLabel.getBounds().getRight().x; parentRefX = abstractGraphicalEditPartWrappingLabel.getParent().getBounds().getRight().x; } else if (ToolbarLayout.ALIGN_CENTER == actualLabelAlignment) { labelRefX = abstractGraphicalEditPartWrappingLabel.getBounds().getCenter().x; parentRefX = abstractGraphicalEditPartWrappingLabel.getParent().getBounds().getCenter().x; } assertEquals("Figure alignment is not consitent with style", parentRefX, labelRefX, 5); } else { Assert.fail(" a AbstractGraphicalEditPart should have a ToolbarLayout on its main figure"); } return actualLabelAlignment; }