IFigure updateFigure = updateShape.getFigure();
IFigure containerFigure = updateShape.getParentFigure();
if (updateShape.visible())
{
ContainerShapePresentation containerPresentation = (ContainerShapePresentation)updateShape.parent();
// find the parent figure
if (containerFigure != null)
{
int index = containerPresentation.getChildFigureIndex(updateShape);
if (updateFigure != null)
{
// first delete it
containerFigure.remove(updateFigure);
}
// add it
updateShape.render();
updateFigure = updateShape.getFigure();
if (updateFigure != null)
{
Object layoutConstraint = getLayoutConstraint(updateShape, containerPresentation.getLayout());
if (layoutConstraint != null)
{
containerFigure.add(updateFigure, layoutConstraint, index);
}
else