summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Wouters2014-02-27 03:32:23 (EST)
committerLaurent Wouters2014-02-27 04:25:58 (EST)
commit2327a1ba6c830f2de6789d15830729410a9eeecc (patch)
tree0189f21f9d2556cb3aad0cc11db85b59f8e0412b
parenta25fb2153a8f54f539f8508d4081aba794ba8733 (diff)
downloadorg.eclipse.papyrus-2327a1ba6c830f2de6789d15830729410a9eeecc.zip
org.eclipse.papyrus-2327a1ba6c830f2de6789d15830729410a9eeecc.tar.gz
org.eclipse.papyrus-2327a1ba6c830f2de6789d15830729410a9eeecc.tar.bz2
Activate multiline labels layout
Signed-off-by: Laurent Wouters <laurent.wouters@cea.fr>
-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 a69e5fa..20c2f3c 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;