Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Schnekenburger2016-01-14 10:09:36 +0000
committerRemi Schnekenburger2016-02-02 07:17:59 +0000
commitc2ee81bae9ce050688b6a16d6bb128927acc7d62 (patch)
treed74bd25d86adb2504d2314f4ea199be42636fe2b
parentd8dfd8fdeb773838c492e013486f1e7b8dacb52e (diff)
downloadorg.eclipse.papyrus-c2ee81bae9ce050688b6a16d6bb128927acc7d62.tar.gz
org.eclipse.papyrus-c2ee81bae9ce050688b6a16d6bb128927acc7d62.tar.xz
org.eclipse.papyrus-c2ee81bae9ce050688b6a16d6bb128927acc7d62.zip
Bug 485824: [All Diagrams] PapyrusLabel is used in
AutomaticLayoutManager only if the shape compartment is displayed https://bugs.eclipse.org/bugs/show_bug.cgi?id=485824 - adding a check if the compartment for shapes is visible or not Change-Id: Ic0fd920d345cf11c6fe7108e9f9689b3ddb5d928 Signed-off-by: Remi Schnekenburger <remi.schnekenburger@cea.fr>
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/figure/node/AutomaticCompartmentLayoutManager.java17
1 files changed, 16 insertions, 1 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 54a58687cd7..6aba9faa2c4 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
@@ -145,7 +145,7 @@ public class AutomaticCompartmentLayoutManager extends AbstractLayout {
Rectangle bounds = container.getBounds();
// do the layout based on the policies
if (!visibleCompartments.isEmpty()) {
- if (forcedLabelBounds) {
+ if (forcedLabelBounds && hasShapeDisplayed(container) ) { // Bug 485824
layoutForcedLabel(container);
} else {
layoutDefault(container);
@@ -160,6 +160,21 @@ public class AutomaticCompartmentLayoutManager extends AbstractLayout {
}
/**
+ * Returns <code>true</code> if there is a displayed shape compartment in the list of visible compartment
+ * @param container the figure to check
+ * @return <code>true</code> if there is a displayed shape compartment in the list of visible compartment
+ */
+ protected boolean hasShapeDisplayed(IFigure container) {
+ for (int i = 0; i != visibleCompartments.size(); i++) {
+ IFigure compartment = visibleCompartments.get(i);
+ if (compartment instanceof ScalableCompartmentFigure) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
* Layouts the invisible elements at the given location
*
* @param x

Back to the top