diff options
| author | Maxime Porhel | 2015-10-12 16:07:07 +0000 |
|---|---|---|
| committer | Maxime Porhel | 2015-10-14 07:16:39 +0000 |
| commit | 1b5af199644f0c7d9e9ad2bc594e70d8b11b85a5 (patch) | |
| tree | 19c40f0579cdb1c3b45f6c63751dac07fed97e1f | |
| parent | 2722c79151cc39e1850f82592d612ee4f13ec1e4 (diff) | |
| download | org.eclipse.sirius-1b5af199644f0c7d9e9ad2bc594e70d8b11b85a5.tar.gz org.eclipse.sirius-1b5af199644f0c7d9e9ad2bc594e70d8b11b85a5.tar.xz org.eclipse.sirius-1b5af199644f0c7d9e9ad2bc594e70d8b11b85a5.zip | |
[470859] Complete release note and documentation
Remove the capability to cancel resize propagation on
RegionContainer resize as this is correctly managed from Region
and this produced unwanted side effects for Region which are also
RegionContainers.
Add a Warning validation rule to detect reconnect tools on edge mapping
related to Regions as the reconnect is disabled On Regions.
Bug: 470859
Change-Id: I5a879a451164cfd6cbbba9d3ce8dc542438b0720
Signed-off-by: Maxime Porhel <maxime.porhel@obeo.fr>
13 files changed, 149 insertions, 45 deletions
diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/graphical/edit/policies/RegionContainerResizableEditPolicy.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/graphical/edit/policies/RegionContainerResizableEditPolicy.java index e17969b7a1..e9bfd8dae2 100644 --- a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/graphical/edit/policies/RegionContainerResizableEditPolicy.java +++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/graphical/edit/policies/RegionContainerResizableEditPolicy.java @@ -14,11 +14,9 @@ import java.util.Collection; import java.util.Collections; import java.util.List; -import org.eclipse.draw2d.IFigure; import org.eclipse.draw2d.PositionConstants; import org.eclipse.draw2d.geometry.Dimension; import org.eclipse.draw2d.geometry.Point; -import org.eclipse.draw2d.geometry.Rectangle; import org.eclipse.emf.transaction.TransactionalEditingDomain; import org.eclipse.gef.EditPart; import org.eclipse.gef.Request; @@ -205,25 +203,11 @@ public class RegionContainerResizableEditPolicy extends AirResizableEditPolicy { ChangeBoundsRequest req = initConstrainedRequest(request); req.setEditParts(Lists.newArrayList(regionToResize)); req.setSizeDelta(new Dimension(sizeDelta.width, 0)); - if (query.isResizeFromRight()) { - // Handle F3 for regions in region to allow manual layout. - // Allow manual resize of the region container to reduce - // empty space due to VSM specified size or recursive - // regions. - req = handleEmptySpace(request, req); - } constrainedRequests.add(req); } else if (stackDirection == PositionConstants.EAST_WEST && (query.isResizeFromTop() || query.isResizeFromBottom()) && sizeDelta.height != 0) { ChangeBoundsRequest req = initConstrainedRequest(request); req.setEditParts(Lists.newArrayList(regionToResize)); req.setSizeDelta(new Dimension(0, sizeDelta.height)); - if (query.isResizeFromBottom()) { - // Handle F3 for regions in region to allow manual layout. - // Allow manual resize of the region container to reduce - // empty space due to VSM specified size or recursive - // regions. - req = handleEmptySpace(request, req); - } constrainedRequests.add(req); } } @@ -231,31 +215,6 @@ public class RegionContainerResizableEditPolicy extends AirResizableEditPolicy { return constrainedRequests; } - private ChangeBoundsRequest handleEmptySpace(ChangeBoundsRequest initialRequest, ChangeBoundsRequest constrainedRequest) { - ChangeBoundsRequest result = constrainedRequest; - Object object = initialRequest.getExtendedData().get(SiriusResizeTracker.CHILDREN_MOVE_MODE_KEY); - boolean keepSameAbsoluteLocation = (object == null && SiriusResizeTracker.DEFAULT_CHILDREN_MOVE_MODE) || (object != null && ((Boolean) object).booleanValue()); - if (!initialRequest.isConstrainedResize() && !keepSameAbsoluteLocation) { - result.setMoveDelta(new Point(0, 0)); - result.setSizeDelta(new Dimension(0, 0)); - - Rectangle rect = new Rectangle(); - IFigure parentFigure = getHostFigure(); - for (IGraphicalEditPart part : Iterables.filter(constrainedRequest.getEditParts(), IGraphicalEditPart.class)) { - IFigure figure = part.getFigure(); - rect = rect.getUnion(figure.getBounds()); - parentFigure = figure.getParent(); - } - - // Restrict the move to the parent bounds. - RequestQuery requestQuery = new RequestQuery(initialRequest); - if (rect.contains(requestQuery.getLogicalTransformedRectangle(parentFigure.getBounds()).getBottomRight())) { - result = null; - } - } - return result; - } - private ChangeBoundsRequest initConstrainedRequest(ChangeBoundsRequest request) { ChangeBoundsRequest req = new ChangeBoundsRequest(); req.setConstrainedResize(true); diff --git a/plugins/org.eclipse.sirius.diagram/plugin.properties b/plugins/org.eclipse.sirius.diagram/plugin.properties index c18e5346de..51e06e6dca 100644 --- a/plugins/org.eclipse.sirius.diagram/plugin.properties +++ b/plugins/org.eclipse.sirius.diagram/plugin.properties @@ -103,6 +103,9 @@ constraint.edgeMappingCycle.name = Check that EdgeMappings with an EdgeMapping a constraint.mandatoryDomainClass.description = Validates DomainClass features. constraint.mandatoryDomainClass.message = The Domain Class is mandatory for this element constraint.mandatoryDomainClass.name = Diagram Mandatory Domain Class +constraint.mappingsForReconnectionTools.description= The edge reconnection on regions is disabled. +constraint.mappingsForReconnectionTools.message= Reconnection on regions is disabled, the reconnect tool {0} will not with {1} +constraint.mappingsForReconnectionTools.name= No reconnect on regions constraint.missingRequiredEdgeSizeExpression.description = Validates that the size computation expression of an EdgeStyleDecription is set constraint.missingRequiredEdgeSizeExpression.message = The SizeComputationExpression field of {0} does not accept a blank value. constraint.missingRequiredEdgeSizeExpression.name = Missing Required Size Expression On Edge Style Description diff --git a/plugins/org.eclipse.sirius.diagram/plugin.xml b/plugins/org.eclipse.sirius.diagram/plugin.xml index 78bde40ee5..460fea0269 100644 --- a/plugins/org.eclipse.sirius.diagram/plugin.xml +++ b/plugins/org.eclipse.sirius.diagram/plugin.xml @@ -682,6 +682,21 @@ <message> %constraint.preconditionForDndTools.message </message> + </constraint> + <constraint + class="org.eclipse.sirius.diagram.tools.internal.validation.description.constraints.MappingForReconnectToolsConstraint" + id="org.eclipse.sirius.diagram.constraints.MappingsForReconnectionTools" + lang="Java" + mode="Batch" + name="%constraint.mappingsForReconnectionTools.name" + severity="WARNING" + statusCode="1"> + <description> + %constraint.mappingsForReconnectionTools.description + </description> + <message> + %constraint.mappingsForReconnectionTools.message + </message> </constraint> </constraints> </constraintProvider> diff --git a/plugins/org.eclipse.sirius.diagram/src-core/org/eclipse/sirius/diagram/tools/internal/validation/description/constraints/MappingForReconnectToolsConstraint.java b/plugins/org.eclipse.sirius.diagram/src-core/org/eclipse/sirius/diagram/tools/internal/validation/description/constraints/MappingForReconnectToolsConstraint.java new file mode 100644 index 0000000000..1314764256 --- /dev/null +++ b/plugins/org.eclipse.sirius.diagram/src-core/org/eclipse/sirius/diagram/tools/internal/validation/description/constraints/MappingForReconnectToolsConstraint.java @@ -0,0 +1,92 @@ +/******************************************************************************* + * Copyright (c) 2015 Obeo. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Obeo - initial API and implementation + *******************************************************************************/ +package org.eclipse.sirius.diagram.tools.internal.validation.description.constraints; + +import java.util.Collection; + +import org.eclipse.core.runtime.IStatus; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.validation.AbstractModelConstraint; +import org.eclipse.emf.validation.EMFEventType; +import org.eclipse.emf.validation.IValidationContext; +import org.eclipse.sirius.business.api.query.IdentifiedElementQuery; +import org.eclipse.sirius.diagram.business.api.query.ContainerMappingQuery; +import org.eclipse.sirius.diagram.description.ContainerMapping; +import org.eclipse.sirius.diagram.description.EdgeMapping; +import org.eclipse.sirius.diagram.description.tool.ReconnectEdgeDescription; +import org.eclipse.sirius.diagram.description.tool.ReconnectionKind; + +import com.google.common.base.Predicate; +import com.google.common.collect.Iterables; +import com.google.common.collect.Lists; +import com.google.common.collect.Sets; + +/** + * Checks that a {@link ReconnectEdgeDescription} tool does not reference Region + * mapping. + * + * @author mporhel + */ +public class MappingForReconnectToolsConstraint extends AbstractModelConstraint { + + /** + * {@inheritDoc} + */ + @Override + public IStatus validate(IValidationContext ctx) { + EObject eObj = ctx.getTarget(); + EMFEventType eventType = ctx.getEventType(); + // In the case of batch mode. + + if (eventType == EMFEventType.NULL) { + Resource eObjResource = eObj.eResource(); + if (eObjResource != null && eObjResource.getResourceSet() != null && eObj instanceof ReconnectEdgeDescription) { + ReconnectEdgeDescription red = (ReconnectEdgeDescription) eObj; + Collection<String> edgeToRegions = getReconnectOnRegions(red); + if (!edgeToRegions.isEmpty()) { + return ctx.createFailureStatus(new Object[] { new IdentifiedElementQuery(red).getLabel(), edgeToRegions }); + } + } + } + return ctx.createSuccessStatus(); + } + + private Collection<String> getReconnectOnRegions(ReconnectEdgeDescription tool) { + Predicate<ContainerMapping> isRegionMapping = new Predicate<ContainerMapping>() { + @Override + public boolean apply(ContainerMapping input) { + return new ContainerMappingQuery(input).isRegion(); + } + }; + + Collection<EdgeMapping> edgeToRegions = Sets.newLinkedHashSet(); + for (EdgeMapping em : tool.getMappings()) { + if (tool.getReconnectionKind() == ReconnectionKind.RECONNECT_BOTH_LITERAL || tool.getReconnectionKind() == ReconnectionKind.RECONNECT_BOTH_LITERAL) { + if (Iterables.any(Iterables.filter(em.getSourceMapping(), ContainerMapping.class), isRegionMapping)) { + edgeToRegions.add(em); + } + } + + if (tool.getReconnectionKind() == ReconnectionKind.RECONNECT_BOTH_LITERAL || tool.getReconnectionKind() == ReconnectionKind.RECONNECT_BOTH_LITERAL) { + if (Iterables.any(Iterables.filter(em.getTargetMapping(), ContainerMapping.class), isRegionMapping)) { + edgeToRegions.add(em); + } + } + } + + Collection<String> mappingsLabel = Lists.newArrayList(); + for (EdgeMapping mapping : edgeToRegions) { + mappingsLabel.add(new IdentifiedElementQuery(mapping).getLabel()); + } + return mappingsLabel; + } +} diff --git a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html index dd74d2efd4..6ede3210df 100644 --- a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html +++ b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html @@ -79,6 +79,14 @@ <img border="0" src="images/edgeLabelMoveAfterSirius3.1.gif"/> </p> <ul> + <li><span class="label label-success">Added</span> It is now possible to collapse compartments using the handle visible on the following illustrations. The handle’s position varies depending on the label alignment to avoid overlapping (depending on the list elements alignment for a list with an hidden label).</li> + </ul> + <p> + <img border="0" src="images/compartments_collapse.png"/> + <br/> + <img border="0" src="images/compartments_collapse2.png"/> + </p> + <ul> <li><span class="label label-info">Modified</span> The <em>Snap to Grid</em> and <em>Snap to Shapes</em> features are now automatically disabled on Sequence diagrams. As indicated diff --git a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile index d96dfa2838..5d49cc292f 100644 --- a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile +++ b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile @@ -15,6 +15,9 @@ Sample before Sirius 3.1: !images/edgeLabelMoveBeforeSirius3.1.gif! Same sample since Sirius 3.1: !images/edgeLabelMoveAfterSirius3.1.gif! +* <span class="label label-success">Added</span> It is now possible to collapse compartments using the handle visible on the following illustrations. The handle's position varies depending on the label alignment to avoid overlapping (depending on the list elements alignment for a list with an hidden label). +!images/compartments_collapse.png! +!images/compartments_collapse2.png! * <span class="label label-info">Modified</span> The _Snap to Grid_ and _Snap to Shapes_ features are now automatically disabled on Sequence diagrams. As indicated "in the user documentation":./user/sequences/Sequence%20Diagrams.html#introduction, to work correctly, Sirius sequence diagrams must have a tight control on where the graphical elements are placed on the diagram and on their synchronization with the underlying semantic model. Previously, the user had to explicitely disable the snap features. * <span class="label label-info">Modified</span> The _Link with Editor_ behavior has changed. The link with editor was previously unidirectional from the Common Navigator (Model Explorer view or Project view) toward the active representation. Now, when selecting one or several elements in the representation, the corresponding semantic elements are selected in the Common Navigator. * <span class="label label-info">Modified</span> The _Arrange Linked Bordered Nodes_ tabbar action has been renamed to _Arrange Linked Border Nodes_ as it is border nodes which are layouted and not bordered nodes. diff --git a/plugins/org.eclipse.sirius.doc/doc/images/compartments_collapse.png b/plugins/org.eclipse.sirius.doc/doc/images/compartments_collapse.png Binary files differnew file mode 100644 index 0000000000..be0233c979 --- /dev/null +++ b/plugins/org.eclipse.sirius.doc/doc/images/compartments_collapse.png diff --git a/plugins/org.eclipse.sirius.doc/doc/images/compartments_collapse2.png b/plugins/org.eclipse.sirius.doc/doc/images/compartments_collapse2.png Binary files differnew file mode 100644 index 0000000000..b6c2291916 --- /dev/null +++ b/plugins/org.eclipse.sirius.doc/doc/images/compartments_collapse2.png diff --git a/plugins/org.eclipse.sirius.doc/doc/specifier/diagrams/Diagrams.html b/plugins/org.eclipse.sirius.doc/doc/specifier/diagrams/Diagrams.html index 974df55c62..f4fe9a547c 100644 --- a/plugins/org.eclipse.sirius.doc/doc/specifier/diagrams/Diagrams.html +++ b/plugins/org.eclipse.sirius.doc/doc/specifier/diagrams/Diagrams.html @@ -1159,7 +1159,7 @@ </li> <li> <em>Label border style</em> (only available for a - <em>Gradient container style</em>): the specifier can choose a label border style among a list. As a result a border will be drawn or not around the label. + <em>Gradient container style</em>): the specifier can choose a label border style among a list. As a result a border will be drawn or not around the label, this might impact the children content pane configuration. </li> <li> <em>Show icon</em> indicates whether or not the element’s icon should be made visible. If set, the icon used is the one associated with the type of the target element, and is rendered on the left of the label. Note that end-user will always be able to hide such icons by using the diff --git a/plugins/org.eclipse.sirius.doc/doc/specifier/diagrams/Diagrams.textile b/plugins/org.eclipse.sirius.doc/doc/specifier/diagrams/Diagrams.textile index c4108eeef3..7384fb6fb9 100644 --- a/plugins/org.eclipse.sirius.doc/doc/specifier/diagrams/Diagrams.textile +++ b/plugins/org.eclipse.sirius.doc/doc/specifier/diagrams/Diagrams.textile @@ -400,7 +400,7 @@ One of the responsibility of styles is to describe labels which will be displaye * _Label Size_ indicates the font size to use in points. * _Label Format_ is used to specify the font style attributes (_Bold_ and/or _Italic_ and/or _Underline_ and/or _Strike through_). * _Label Alignment_ is used for labels positioned inside node to specify their alignment (note that not all alignment values are supported for all styles). For nodes, this attribute only applies when *Label position* is set to *node* (otherwise, the label is freely movable by the user). For containers, it only applies to the container's label itself, not its content. This attribute does not apply to edges (again, their label is freely movable by users) and list items. -* _Label border style_ (only available for a _Gradient container style_): the specifier can choose a label border style among a list. As a result a border will be drawn or not around the label. +* _Label border style_ (only available for a _Gradient container style_): the specifier can choose a label border style among a list. As a result a border will be drawn or not around the label, this might impact the children content pane configuration. * _Show icon_ indicates whether or not the element's icon should be made visible. If set, the icon used is the one associated with the type of the target element, and is rendered on the left of the label. Note that end-user will always be able to hide such icons by using the _Label icons_ preferences (_Window_/ _Preferences_/ _Sirius_/ _Sirius Diagram_/ _Appearance_). * _Hide label by default_ (not available for edges) is used to configure the label visibility when an element is created. diff --git a/plugins/org.eclipse.sirius.doc/doc/user/diagrams/Diagrams.html b/plugins/org.eclipse.sirius.doc/doc/user/diagrams/Diagrams.html index 02149a9ff1..ea11a3caeb 100644 --- a/plugins/org.eclipse.sirius.doc/doc/user/diagrams/Diagrams.html +++ b/plugins/org.eclipse.sirius.doc/doc/user/diagrams/Diagrams.html @@ -228,11 +228,18 @@ <li>CTRL (or ALT for Mac users): Centered resize (expands the shape on both opposite sides)</li> <li>SHIFT: Resize that keeps the ratio</li> <li>ALT (or CTRL for Mac users): Resize without snap (temporarily disables the snap during the resize if it is activated). </li> - <li>F3: Resize with children location relative to the parent. If the shape is resized to the left, upwards, or both, the children (contained nodes for container and border nodes for all shapes) are moved with the same offset that the resize.</li> + <li>F3: Resize with children location relative to the parent. If the shape is resized to the left, upwards, or both, the children (contained nodes for container and border nodes for all shapes) are moved with the same offset than the resize.</li> <li>F4: Resize with snap to all shapes (if the <a href="#snap_to_shapes">Snap to shapes</a> is already activated for the current diagram) </li> </ul> + <h4 id="Compartments">Compartments</h4> + <p>The resize of compartments might evolve in future versions. The current behavior is to redistribute space between adjacent compartments and to resize the first/last compartment when the compartmented container is resized from top/bottom for a vertical stack and left/right for an horizontal one.</p> + <p>When resizing a compartmented container or a compartment from the top or from the left, the F3 shortcut configures the same behaviors than on standard containers (see previous section). </p> + <p>On + <em>experimental</em> structures of containers with compartmented compartments, the F3 shortcut also allows to disable the resize propagation to manually correct the computed layout and remove empty space ( + <em>experimental</em>). This might occur when there are several levels of compartments without the same number of compartments on each level. The corrective resize can be done on the last compartments of each compartmented container (from bottom for vertical stacks and from right for horizontal stacks). + </p> <h3 id="Movingelements">Moving elements</h3> <p>There are specific shortcuts to change the move behavior:</p> <ul> @@ -475,6 +482,11 @@ <em>Hide label icons on connectors</em>", next time you will open your diagram, all label icons of shapes and connectors will be hidden : </p> <img border="0" src="images/diagram_editor_hide_label_icon_2.png"/> + <h4 id="Collapsingcompartments">Collapsing compartments</h4> + <p>When working with compartmented containers, you may want to collapse the compartments. Select a compartment and collapse/expand it using the handle visible on the following illustration. The collapse handle’s location varies depending on the label alignment to avoid overlapping (depending on the list elements alignment for a list with an hidden label).</p> + <p> + <img border="0" src="images/compartments_collapse3.png"/> + </p> <h3 id="Validatingthemodel">Validating the model</h3> <p>On a diagram, you can have validation rules. These rules were previously created by the architect who created the diagram’s configuration. As a user of the modeler, you can validate these rules on your model.</p> <p>To validate the rules open the context menu of the diagram itself (by right-clicking on its background) and choose the diff --git a/plugins/org.eclipse.sirius.doc/doc/user/diagrams/Diagrams.textile b/plugins/org.eclipse.sirius.doc/doc/user/diagrams/Diagrams.textile index 249423eaf7..de37662225 100644 --- a/plugins/org.eclipse.sirius.doc/doc/user/diagrams/Diagrams.textile +++ b/plugins/org.eclipse.sirius.doc/doc/user/diagrams/Diagrams.textile @@ -76,9 +76,16 @@ There are specific shortcuts to change the resize behavior: * CTRL (or ALT for Mac users): Centered resize (expands the shape on both opposite sides) * SHIFT: Resize that keeps the ratio * ALT (or CTRL for Mac users): Resize without snap (temporarily disables the snap during the resize if it is activated). -* F3: Resize with children location relative to the parent. If the shape is resized to the left, upwards, or both, the children (contained nodes for container and border nodes for all shapes) are moved with the same offset that the resize. +* F3: Resize with children location relative to the parent. If the shape is resized to the left, upwards, or both, the children (contained nodes for container and border nodes for all shapes) are moved with the same offset than the resize. * F4: Resize with snap to all shapes (if the "Snap to shapes":#snap_to_shapes is already activated for the current diagram) +h4. Compartments + +The resize of compartments might evolve in future versions. The current behavior is to redistribute space between adjacent compartments and to resize the first/last compartment when the compartmented container is resized from top/bottom for a vertical stack and left/right for an horizontal one. + +When resizing a compartmented container or a compartment from the top or from the left, the F3 shortcut configures the same behaviors than on standard containers (see previous section). + +On _experimental_ structures of containers with compartmented compartments, the F3 shortcut also allows to disable the resize propagation to manually correct the computed layout and remove empty space (_experimental_). This might occur when there are several levels of compartments without the same number of compartments on each level. The corrective resize can be done on the last compartments of each compartmented container (from bottom for vertical stacks and from right for horizontal stacks). h3. Moving elements @@ -282,6 +289,11 @@ If you check both "_Hide label icons on shapes_" and "_Hide label icons on con !images/diagram_editor_hide_label_icon_2.png! +h4. Collapsing compartments + +When working with compartmented containers, you may want to collapse the compartments. Select a compartment and collapse/expand it using the handle visible on the following illustration. The collapse handle's location varies depending on the label alignment to avoid overlapping (depending on the list elements alignment for a list with an hidden label). + +!images/compartments_collapse3.png! h3. Validating the model diff --git a/plugins/org.eclipse.sirius.doc/doc/user/diagrams/images/compartments_collapse3.png b/plugins/org.eclipse.sirius.doc/doc/user/diagrams/images/compartments_collapse3.png Binary files differnew file mode 100644 index 0000000000..2714151663 --- /dev/null +++ b/plugins/org.eclipse.sirius.doc/doc/user/diagrams/images/compartments_collapse3.png |
