diff options
author | aradermache | 2013-03-10 00:06:10 +0000 |
---|---|---|
committer | aradermache | 2013-03-10 00:06:10 +0000 |
commit | 41be70151fc13119d77be0d71dc46ab3fc23b9a1 (patch) | |
tree | b8c1470af3c1890e737595661d033d047b82c2b4 | |
parent | 2b9d966e7d1aa06d616c7d3cd2a1df20ce5d1fdb (diff) | |
download | org.eclipse.papyrus-41be70151fc13119d77be0d71dc46ab3fc23b9a1.tar.gz org.eclipse.papyrus-41be70151fc13119d77be0d71dc46ab3fc23b9a1.tar.xz org.eclipse.papyrus-41be70151fc13119d77be0d71dc46ab3fc23b9a1.zip |
Amendment of fix for bug 402068
2 files changed, 22 insertions, 27 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/edit/part/CustomStateMachineNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/edit/part/CustomStateMachineNameEditPart.java index 56584c52e29..881b60f9e11 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/edit/part/CustomStateMachineNameEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/edit/part/CustomStateMachineNameEditPart.java @@ -60,30 +60,27 @@ public class CustomStateMachineNameEditPart extends StateMachineNameEditPart { protected void refreshVisuals() { super.refreshVisuals(); + View stateMachineLabelView = (View)getModel(); + View stateMachineView = (View)stateMachineLabelView.eContainer(); + View stateMachineCompartView = (View)stateMachineView.getChildren().get(1); + StateMachineFigure stateFigure = ((StateMachineEditPart)getParent()).getPrimaryShape(); int width = stateFigure.getBounds().width; // calculate height for labels via position of the rectangle figure after the labels. Layout managers such as the // AutomaticCompartmentLayoutManager add extra space on top of the first label which would not be accounted for // when adding the space for the labels. int height = 0; - if(stateFigure.getStateMachineCompartmentFigure() != null) { - if(stateFigure.getStateMachineCompartmentFigure().isVisible()) { - stateFigure.validate(); // validate the figure, assure that layout manager is called. - height = stateFigure.getStateMachineCompartmentFigure().getBounds().y - stateFigure.getBounds().y + 1; - // Sanity check - if(height < 0) { - height = 0; - } - } - else { - height = stateFigure.getNameLabel().getBounds().height; + if(stateMachineCompartView.isVisible() && (stateFigure.getStateMachineCompartmentFigure() != null)) { + stateFigure.validate(); // validate the figure, assure that layout manager is called. + height = stateFigure.getStateMachineCompartmentFigure().getBounds().y - stateFigure.getBounds().y + 1; + // Sanity check + if(height < 0) { + height = 0; } } - - - View stateMachineLabelView = (View)getModel(); - View stateMachineView = (View)stateMachineLabelView.eContainer(); - View stateMachineCompartView = (View)stateMachineView.getChildren().get(1); + else { + height = stateFigure.getNameLabel().getBounds().height; + } int stateMachineHeight = Zone.getHeight(stateMachineView); int stateMachineWidth = Zone.getWidth(stateMachineView); diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/edit/part/CustomStateNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/edit/part/CustomStateNameEditPart.java index 26ee8ad39f9..8834dcace81 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/edit/part/CustomStateNameEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/edit/part/CustomStateNameEditPart.java @@ -87,19 +87,17 @@ public class CustomStateNameEditPart extends StateNameEditPart { // AutomaticCompartmentLayoutManager add extra space on top of the first label which would not be accounted for // when adding the space for the labels. int height = 0; - if(stateFigure.getStateCompartmentFigure() != null) { - if(stateFigure.getStateCompartmentFigure().isVisible()) { - stateFigure.validate(); // validate the figure, assure that layout manager is called. - height = stateFigure.getStateCompartmentFigure().getBounds().y - stateFigure.getBounds().y + 1; - // Sanity check - if(height < 0) { - height = 0; - } - } - else { - height = stateFigure.getNameLabel().getBounds().height; + if(stateCompartView.isVisible() && (stateFigure.getStateCompartmentFigure() != null)) { + stateFigure.validate(); // validate the figure, assure that layout manager is called. + height = stateFigure.getStateCompartmentFigure().getBounds().y - stateFigure.getBounds().y + 1; + // Sanity check + if(height < 0) { + height = 0; } } + else { + height = stateFigure.getNameLabel().getBounds().height; + } int stateHeight = Zone.getHeight(stateView); int stateWidth = Zone.getWidth(stateView); |