Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/figure/node/AutomaticCompartmentLayoutManager.java')
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/figure/node/AutomaticCompartmentLayoutManager.java11
1 files changed, 9 insertions, 2 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/figure/node/AutomaticCompartmentLayoutManager.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/figure/node/AutomaticCompartmentLayoutManager.java
index a69e5fa8710..20c2f3c77cf 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/figure/node/AutomaticCompartmentLayoutManager.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/figure/node/AutomaticCompartmentLayoutManager.java
@@ -19,6 +19,7 @@ import java.util.List;
import org.eclipse.draw2d.AbstractLayout;
import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.PositionConstants;
import org.eclipse.draw2d.geometry.Dimension;
import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure;
@@ -163,13 +164,19 @@ public class AutomaticCompartmentLayoutManager extends AbstractLayout {
protected void layoutOthers(Rectangle container) {
int totalHeight = 0;
for(IFigure child : visibleOthers) {
- totalHeight += child.getPreferredSize().height;
+ totalHeight += child.getPreferredSize(50, -1).height;
}
IFigure previous = null;
for(IFigure child : visibleOthers) {
Rectangle bound = new Rectangle();
- bound.setSize(getPreferedSize(child));
+ if (child instanceof WrappingLabel) {
+ ((WrappingLabel) child).setTextWrap(true);
+ ((WrappingLabel) child).setTextJustification(PositionConstants.CENTER);
+ bound.setSize(child.getPreferredSize(container.width, -1));
+ } else {
+ bound.setSize(getPreferedSize(child));
+ }
if(previous != null) {
bound.y = previous.getBounds().getBottomLeft().y + 1;
bound.x = container.x + 3;

Back to the top