// Set name in pictogram model
if (pictogramElement instanceof ContainerShape) {
ContainerShape cs = (ContainerShape) pictogramElement;
for (Shape shape : cs.getChildren()) {
if (shape.getGraphicsAlgorithm() instanceof AbstractText) {
AbstractText text =
(AbstractText) shape.getGraphicsAlgorithm();
text.setValue(businessValue);
//We can user the layoutservice to get the new size
//but it seems to be broken wrt new lines so we need
//to multiply up by number of lines.
IDimension dim = GraphitiUi.getUiLayoutService(
).calculateTextSize(
businessValue, text.getFont());
text.setHeight(2 + (dim.getHeight() *
businessValue.split("\n").length));
cs.getGraphicsAlgorithm().setHeight(text.getHeight());
if (cs.eContainer() instanceof ContainerShape) {
((ContainerShape) cs.eContainer()
).getGraphicsAlgorithm().setHeight(
text.getHeight() + 20);
}
return true;
}
}