diff options
author | Laurent Redor | 2017-08-24 08:29:37 +0000 |
---|---|---|
committer | Laurent Redor | 2017-08-31 08:46:16 +0000 |
commit | 53ac4e417ad148254376b2ff489a6a32d6946ae4 (patch) | |
tree | b041142eb38d5c28d91c1a66229025d525991607 /plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram | |
parent | d8c7667824651c5776c402236724e68f1150a931 (diff) | |
download | org.eclipse.sirius-53ac4e417ad148254376b2ff489a6a32d6946ae4.tar.gz org.eclipse.sirius-53ac4e417ad148254376b2ff489a6a32d6946ae4.tar.xz org.eclipse.sirius-53ac4e417ad148254376b2ff489a6a32d6946ae4.zip |
[521356] Fix bug when resizing an Execution to the parent limit bounds
The AbstractNodeEventResizeSelectionValidator did not consider the
margins/constraints that were considered by the layout
(SequenceVerticalLayout). So the resize was authorized but parent was
then resized to respect the constraints.
This commit uses the getValidSubEventsRange() of execution's parent
instead of just getVerticalRange().
It also fixes:
* the valid sub events range of a LifeLine.
* the correct CombinedFragment location check in
AbstractInteractionFrameValidator
* an incomplete condition added for bug 518246 in commit c6ad066e [1].
[1]
http://git.eclipse.org/c/sirius/org.eclipse.sirius.git/diff/plugins/org.eclipse.sirius.diagram.sequence.ui/src/org/eclipse/sirius/diagram/sequence/ui/tool/internal/edit/validator/AbstractNodeEventResizeSelectionValidator.java?id=c6ad066eb1f59f2e802c968edcc36b83ef1a4e22
Bug: 521356
Change-Id: Iaf099503644ab1a5a15c827d8ad5d5d6db7c053a
Signed-off-by: Laurent Redor <laurent.redor@obeo.fr>
Diffstat (limited to 'plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram')
2 files changed, 22 insertions, 3 deletions
diff --git a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/elements/Lifeline.java b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/elements/Lifeline.java index 0314d05ea9..d75c872d12 100644 --- a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/elements/Lifeline.java +++ b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/elements/Lifeline.java @@ -187,8 +187,8 @@ public class Lifeline extends AbstractSequenceNode implements ISequenceEvent { @Override public Range getValidSubEventsRange() { Range result = getVerticalRange(); - if (result.width() > 2 * LayoutConstants.EXECUTION_CHILDREN_MARGIN) { - result = result.shrinked(LayoutConstants.EXECUTION_CHILDREN_MARGIN); + if (result.width() > LayoutConstants.TIME_START_MIN_OFFSET) { + result = result.shifted(LayoutConstants.TIME_START_MIN_OFFSET).reduced(LayoutConstants.TIME_START_MIN_OFFSET); } return result; } diff --git a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/util/Range.java b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/util/Range.java index bf30eaa0ef..5eacb8131a 100644 --- a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/util/Range.java +++ b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/util/Range.java @@ -336,7 +336,7 @@ public class Range { * * @param distance * the positive distance to shrink this range. - * @return the new grown range. + * @return the new shrinked range. */ public Range shrinked(int distance) { Preconditions.checkArgument(distance >= 0); @@ -349,6 +349,25 @@ public class Range { } /** + * Returns a new range corresponding to this range reduced by the specified size (which must be positive). Reducing + * an empty range produces an empty range. Otherwise the resulting range has a smaller width than original (- size). + * The lower bound value of this range is kept constant. + * + * @param size + * the positive size to reduce this range. + * @return the new reduced range. + */ + public Range reduced(int size) { + Preconditions.checkArgument(size >= 0); + if (isEmpty()) { + return Range.EMPTY_RANGE; + } else { + Preconditions.checkArgument(width() - size >= 0); + return new Range(lower, upper - size); + } + } + + /** * Returns a percentage of how much the given absolute number is inside this * range. * |