Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPierre Guilet2019-01-04 16:23:02 +0000
committerPierre-Charles David2019-01-28 15:33:30 +0000
commit8cb4e46fc3431147c123188041a2b94b18ebb5a9 (patch)
tree6b87ea4ca923132d3ba9606f5707fd4aae3149a7
parent903b68d5deaf4cfa182bf5e990ebd93266a61b8c (diff)
downloadorg.eclipse.sirius-8cb4e46fc3431147c123188041a2b94b18ebb5a9.tar.gz
org.eclipse.sirius-8cb4e46fc3431147c123188041a2b94b18ebb5a9.tar.xz
org.eclipse.sirius-8cb4e46fc3431147c123188041a2b94b18ebb5a9.zip
[543177] Allow vertical spaces removal for sequence diagram
Ctrl+Shift+Mouse drag done from bottom to top of a lifeline of a sequence diagram now removes vertical spaces. Bug: 543177 Change-Id: I6afc96495df9a9ed2565899ce22f8e3f351aa853 Signed-off-by: Pierre Guilet <pierre.guilet@obeo.fr>
-rw-r--r--plugins/org.eclipse.sirius.diagram.sequence.ui/src/org/eclipse/sirius/diagram/sequence/ui/tool/internal/edit/command/SequenceEMFCommandFactory.java33
-rw-r--r--plugins/org.eclipse.sirius.diagram.sequence.ui/src/org/eclipse/sirius/diagram/sequence/ui/tool/internal/edit/policy/CombinedFragmentResizableEditPolicy.java27
-rw-r--r--plugins/org.eclipse.sirius.diagram.sequence.ui/src/org/eclipse/sirius/diagram/sequence/ui/tool/internal/edit/policy/ExecutionSelectionEditPolicy.java40
-rw-r--r--plugins/org.eclipse.sirius.diagram.sequence.ui/src/org/eclipse/sirius/diagram/sequence/ui/tool/internal/edit/policy/ISEComplexMoveCommandBuilder.java13
-rw-r--r--plugins/org.eclipse.sirius.diagram.sequence.ui/src/org/eclipse/sirius/diagram/sequence/ui/tool/internal/edit/policy/InteractionUseResizableEditPolicy.java9
-rw-r--r--plugins/org.eclipse.sirius.diagram.sequence.ui/src/org/eclipse/sirius/diagram/sequence/ui/tool/internal/edit/policy/SequenceContainerCreationPolicy.java25
-rw-r--r--plugins/org.eclipse.sirius.diagram.sequence.ui/src/org/eclipse/sirius/diagram/sequence/ui/tool/internal/util/DelegatingDiagramCommandFactory.java6
-rw-r--r--plugins/org.eclipse.sirius.diagram.sequence/plugin.properties1
-rw-r--r--plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/Messages.java15
-rw-r--r--plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/operation/VerticalSpaceExpansionOrReduction.java (renamed from plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/operation/VerticalSpaceExpansion.java)40
-rw-r--r--plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/query/SequenceNodeQuery.java8
-rw-r--r--plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/util/DecreasingRange.java119
-rw-r--r--plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/util/Range.java116
-rw-r--r--plugins/org.eclipse.sirius.diagram.ui/plugin.properties3
-rw-r--r--plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/editor/SiriusBlankSpacesDragTracker.java71
-rw-r--r--plugins/org.eclipse.sirius.diagram.ui/src/org/eclipse/sirius/diagram/ui/provider/Messages.java5
-rw-r--r--plugins/org.eclipse.sirius.diagram/src-core/org/eclipse/sirius/diagram/tools/api/command/IDiagramCommandFactory.java100
-rw-r--r--plugins/org.eclipse.sirius.diagram/src-core/org/eclipse/sirius/diagram/tools/internal/command/UndoRedoCapableEMFCommandFactory.java2
-rw-r--r--plugins/org.eclipse.sirius.doc/doc/Release_Notes.html48
-rw-r--r--plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile11
-rw-r--r--plugins/org.eclipse.sirius.doc/doc/user/sequences/Sequence Diagrams.html24
-rw-r--r--plugins/org.eclipse.sirius.doc/doc/user/sequences/Sequence Diagrams.textile18
-rw-r--r--plugins/org.eclipse.sirius.doc/doc/user/sequences/images/remove_vertical_blank_space.pngbin0 -> 17103 bytes
-rw-r--r--plugins/org.eclipse.sirius.ui.debug/src/org/eclipse/sirius/ui/debug/SiriusDebugView.java6
24 files changed, 455 insertions, 285 deletions
diff --git a/plugins/org.eclipse.sirius.diagram.sequence.ui/src/org/eclipse/sirius/diagram/sequence/ui/tool/internal/edit/command/SequenceEMFCommandFactory.java b/plugins/org.eclipse.sirius.diagram.sequence.ui/src/org/eclipse/sirius/diagram/sequence/ui/tool/internal/edit/command/SequenceEMFCommandFactory.java
index abcc088330..8e4f49aa21 100644
--- a/plugins/org.eclipse.sirius.diagram.sequence.ui/src/org/eclipse/sirius/diagram/sequence/ui/tool/internal/edit/command/SequenceEMFCommandFactory.java
+++ b/plugins/org.eclipse.sirius.diagram.sequence.ui/src/org/eclipse/sirius/diagram/sequence/ui/tool/internal/edit/command/SequenceEMFCommandFactory.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010, 2018 THALES GLOBAL SERVICES.
+ * Copyright (c) 2010, 2019 THALES GLOBAL SERVICES.
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
@@ -30,7 +30,8 @@ import org.eclipse.sirius.diagram.sequence.business.internal.operation.RefreshGr
import org.eclipse.sirius.diagram.sequence.business.internal.operation.RefreshSemanticOrderingsOperation;
import org.eclipse.sirius.diagram.sequence.business.internal.operation.SetVerticalRangeOperation;
import org.eclipse.sirius.diagram.sequence.business.internal.operation.SynchronizeISequenceEventsSemanticOrderingOperation;
-import org.eclipse.sirius.diagram.sequence.business.internal.operation.VerticalSpaceExpansion;
+import org.eclipse.sirius.diagram.sequence.business.internal.operation.VerticalSpaceExpansionOrReduction;
+import org.eclipse.sirius.diagram.sequence.business.internal.util.DecreasingRange;
import org.eclipse.sirius.diagram.sequence.ui.tool.internal.edit.operation.ExecutionOperations;
import org.eclipse.sirius.diagram.sequence.ui.tool.internal.edit.part.ExecutionEditPart;
import org.eclipse.sirius.diagram.sequence.ui.tool.internal.edit.part.OperandEditPart;
@@ -41,8 +42,7 @@ import org.eclipse.sirius.diagram.ui.tools.internal.edit.command.CommandFactory;
import org.eclipse.sirius.ext.base.Option;
/**
- * A custom EMF Command Factory to specialize the delete behavior for sequence
- * diagram elements.
+ * A custom EMF Command Factory to specialize the delete behavior for sequence diagram elements.
*
* @author pcdavid
*/
@@ -53,8 +53,7 @@ public final class SequenceEMFCommandFactory extends UndoRedoCapableEMFCommandFa
/**
* Constructor.
*
- * The factory will be initialized with the TransactionalEditingDomain of
- * the current SequenceDiagramEditPart.
+ * The factory will be initialized with the TransactionalEditingDomain of the current SequenceDiagramEditPart.
*
* @param sdep
* the sequence diagram.
@@ -89,9 +88,17 @@ public final class SequenceEMFCommandFactory extends UndoRedoCapableEMFCommandFa
}
@Override
- public Command buildInsertVerticalBlankSpaceCommand(DDiagram diagram, int startY, int spaceToInsert) {
- return CommandFactory.createRecordingCommand(sdep.getEditingDomain(),
- new VerticalSpaceExpansion(sdep.getSequenceDiagram(), new Range(startY, startY + spaceToInsert), 0, Collections.<ISequenceEvent> emptyList()));
+ public Command buildInsertOrRemoveVerticalBlankSpaceCommand(DDiagram diagram, int startY, int spaceToInsertOrRemove) {
+ if (spaceToInsertOrRemove < 0) {
+ return CommandFactory.createRecordingCommand(sdep.getEditingDomain(),
+ new VerticalSpaceExpansionOrReduction(sdep.getSequenceDiagram(), new DecreasingRange(startY, startY + spaceToInsertOrRemove), 0, Collections.<ISequenceEvent> emptyList()));
+
+ } else {
+ return CommandFactory.createRecordingCommand(sdep.getEditingDomain(),
+ new VerticalSpaceExpansionOrReduction(sdep.getSequenceDiagram(), new Range(startY, startY + spaceToInsertOrRemove), 0, Collections.<ISequenceEvent> emptyList()));
+
+ }
+
}
private Command getDeleteExecutionCommand(ExecutionEditPart executionPart, Command basicDelete) {
@@ -124,9 +131,8 @@ public final class SequenceEMFCommandFactory extends UndoRedoCapableEMFCommandFa
Operand deletedOperand = (Operand) operandPart.getISequenceEvent();
if (deletedOperand.getCombinedFragment().getOperands().size() == 1 || operandPart.getViewer().getSelectedEditParts().size() != 1) {
/*
- * The last remaining operand can not be deleted. It is also not
- * possible to delete 2 operand to avoid NPE in
- * SetVerticalRangeOperation.
+ * The last remaining operand can not be deleted. It is also not possible to delete 2 operand to avoid NPE
+ * in SetVerticalRangeOperation.
*/
return UnexecutableCommand.INSTANCE;
}
@@ -144,8 +150,7 @@ public final class SequenceEMFCommandFactory extends UndoRedoCapableEMFCommandFa
}
/**
- * Returns the sibling operand which should absorb the space previously
- * occupied by the operand about to be deleted.
+ * Returns the sibling operand which should absorb the space previously occupied by the operand about to be deleted.
*/
private Option<Operand> getAbsorbingOperand(Operand deletedOperand) {
assert deletedOperand != null;
diff --git a/plugins/org.eclipse.sirius.diagram.sequence.ui/src/org/eclipse/sirius/diagram/sequence/ui/tool/internal/edit/policy/CombinedFragmentResizableEditPolicy.java b/plugins/org.eclipse.sirius.diagram.sequence.ui/src/org/eclipse/sirius/diagram/sequence/ui/tool/internal/edit/policy/CombinedFragmentResizableEditPolicy.java
index e8cad29389..133a62c495 100644
--- a/plugins/org.eclipse.sirius.diagram.sequence.ui/src/org/eclipse/sirius/diagram/sequence/ui/tool/internal/edit/policy/CombinedFragmentResizableEditPolicy.java
+++ b/plugins/org.eclipse.sirius.diagram.sequence.ui/src/org/eclipse/sirius/diagram/sequence/ui/tool/internal/edit/policy/CombinedFragmentResizableEditPolicy.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010, 2015 THALES GLOBAL SERVICES and others.
+ * Copyright (c) 2010, 2019 THALES GLOBAL SERVICES and others.
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
@@ -45,7 +45,7 @@ import org.eclipse.sirius.diagram.sequence.business.internal.elements.ISequenceE
import org.eclipse.sirius.diagram.sequence.business.internal.elements.Operand;
import org.eclipse.sirius.diagram.sequence.business.internal.elements.SequenceDiagram;
import org.eclipse.sirius.diagram.sequence.business.internal.layout.LayoutConstants;
-import org.eclipse.sirius.diagram.sequence.business.internal.operation.VerticalSpaceExpansion;
+import org.eclipse.sirius.diagram.sequence.business.internal.operation.VerticalSpaceExpansionOrReduction;
import org.eclipse.sirius.diagram.sequence.ui.Messages;
import org.eclipse.sirius.diagram.sequence.ui.tool.internal.edit.operation.SequenceEditPartsOperations;
import org.eclipse.sirius.diagram.sequence.ui.tool.internal.edit.part.CombinedFragmentCompartmentEditPart;
@@ -63,8 +63,7 @@ import org.eclipse.sirius.ext.base.Options;
import com.google.common.collect.Iterables;
/**
- * A specific AirResizableEditPolicy to combined fragment roles move & resize
- * requests.
+ * A specific AirResizableEditPolicy to combined fragment roles move & resize requests.
*
* @author smonnier
*/
@@ -119,7 +118,7 @@ public class CombinedFragmentResizableEditPolicy extends AbstractFrameResizableE
if (expansionZone != null && !expansionZone.isEmpty()) {
SequenceDiagram diagram = fragment.getDiagram();
Collection<ISequenceEvent> eventToIgnore = Collections.singletonList(fragment);
- autoExpand = CommandFactory.createICommand(cfep.getEditingDomain(), new VerticalSpaceExpansion(diagram, expansionZone, 0, eventToIgnore));
+ autoExpand = CommandFactory.createICommand(cfep.getEditingDomain(), new VerticalSpaceExpansionOrReduction(diagram, expansionZone, 0, eventToIgnore));
}
postProcessDefaultCommand(cfep, request, ctc, autoExpand);
@@ -167,8 +166,8 @@ public class CombinedFragmentResizableEditPolicy extends AbstractFrameResizableE
}
/**
- * Returns the command to resize the combined fragment from the north face,
- * and therefore resize up the first operand.
+ * Returns the command to resize the combined fragment from the north face, and therefore resize up the first
+ * operand.
*
* @param ctc
* the current transactional command.
@@ -212,8 +211,8 @@ public class CombinedFragmentResizableEditPolicy extends AbstractFrameResizableE
}
/**
- * Returns the command to resize the combined fragment from the south face,
- * and therefore resize down the last operand.
+ * Returns the command to resize the combined fragment from the south face, and therefore resize down the last
+ * operand.
*
* @param ctc
* the current transactional command.
@@ -268,8 +267,8 @@ public class CombinedFragmentResizableEditPolicy extends AbstractFrameResizableE
}
/**
- * Finds the following {@link OperandEditPart} of the current
- * {@link OperandEditPart} identified by the index currentOperandIndex.
+ * Finds the following {@link OperandEditPart} of the current {@link OperandEditPart} identified by the index
+ * currentOperandIndex.
*
* @param currentOperandIndex
* the index of the current {@link OperandEditPart}
@@ -358,7 +357,8 @@ public class CombinedFragmentResizableEditPolicy extends AbstractFrameResizableE
default:
break;
}
- return new SetBoundsCommand(part.getEditingDomain(), Messages.CombinedFragmentResizableEditPolicy_resizeSubCommand, new EObjectAdapter(part.getNotationView()), new Rectangle(position, dimension));
+ return new SetBoundsCommand(part.getEditingDomain(), Messages.CombinedFragmentResizableEditPolicy_resizeSubCommand, new EObjectAdapter(part.getNotationView()),
+ new Rectangle(position, dimension));
}
return null;
}
@@ -375,7 +375,8 @@ public class CombinedFragmentResizableEditPolicy extends AbstractFrameResizableE
* @return a command to resize an operand
*/
private AbstractTransactionalCommand createOperandSetBoundsCommand(IGraphicalEditPart part, Point location, Dimension dimension) {
- return new SetBoundsCommand(part.getEditingDomain(), Messages.CombinedFragmentResizableEditPolicy_resizeSubCommand, new EObjectAdapter(part.getNotationView()), new Rectangle(location, dimension));
+ return new SetBoundsCommand(part.getEditingDomain(), Messages.CombinedFragmentResizableEditPolicy_resizeSubCommand, new EObjectAdapter(part.getNotationView()),
+ new Rectangle(location, dimension));
}
private static Point getPositionFromView(IGraphicalEditPart part) {
diff --git a/plugins/org.eclipse.sirius.diagram.sequence.ui/src/org/eclipse/sirius/diagram/sequence/ui/tool/internal/edit/policy/ExecutionSelectionEditPolicy.java b/plugins/org.eclipse.sirius.diagram.sequence.ui/src/org/eclipse/sirius/diagram/sequence/ui/tool/internal/edit/policy/ExecutionSelectionEditPolicy.java
index 515a634260..06ca2d9420 100644
--- a/plugins/org.eclipse.sirius.diagram.sequence.ui/src/org/eclipse/sirius/diagram/sequence/ui/tool/internal/edit/policy/ExecutionSelectionEditPolicy.java
+++ b/plugins/org.eclipse.sirius.diagram.sequence.ui/src/org/eclipse/sirius/diagram/sequence/ui/tool/internal/edit/policy/ExecutionSelectionEditPolicy.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010, 2017 THALES GLOBAL SERVICES and others.
+ * Copyright (c) 2010, 2019 THALES GLOBAL SERVICES and others.
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
@@ -55,7 +55,7 @@ import org.eclipse.sirius.diagram.sequence.business.internal.elements.SequenceDi
import org.eclipse.sirius.diagram.sequence.business.internal.operation.SetMessageRangeOperation;
import org.eclipse.sirius.diagram.sequence.business.internal.operation.SetVerticalRangeOperation;
import org.eclipse.sirius.diagram.sequence.business.internal.operation.ShiftDirectSubExecutionsOperation;
-import org.eclipse.sirius.diagram.sequence.business.internal.operation.VerticalSpaceExpansion;
+import org.eclipse.sirius.diagram.sequence.business.internal.operation.VerticalSpaceExpansionOrReduction;
import org.eclipse.sirius.diagram.sequence.business.internal.ordering.EventEndHelper;
import org.eclipse.sirius.diagram.sequence.business.internal.query.ISequenceEventQuery;
import org.eclipse.sirius.diagram.sequence.business.internal.util.EventFinder;
@@ -89,16 +89,15 @@ import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
/**
- * Specialization of the default policy for executions, in order to validate and
- * execute the specific resize and move behaviors needed for sequence diagrams.
+ * Specialization of the default policy for executions, in order to validate and execute the specific resize and move
+ * behaviors needed for sequence diagrams.
*
* @author pcdavid
*/
public class ExecutionSelectionEditPolicy extends SpecificBorderItemSelectionEditPolicy {
/**
- * The color to use for the horizontal feedback rules shown when
- * moving/resizing an execution.
+ * The color to use for the horizontal feedback rules shown when moving/resizing an execution.
*/
protected static final Color EXECUTION_FEEDBACK_COLOR = ColorConstants.lightGray;
@@ -204,7 +203,7 @@ public class ExecutionSelectionEditPolicy extends SpecificBorderItemSelectionEdi
if (needVerticalSpaceExpansion(validator, request)) {
SequenceDiagramEditPart diagram = EditPartsHelper.getSequenceDiagramPart(hostPart);
Collection<ISequenceEvent> eventToIgnore = Collections.singletonList((ISequenceEvent) self);
- ctc.compose(CommandFactory.createICommand(editingDomain, new VerticalSpaceExpansion(diagram.getSequenceDiagram(), validator.getExpansionZone(), 0, eventToIgnore)));
+ ctc.compose(CommandFactory.createICommand(editingDomain, new VerticalSpaceExpansionOrReduction(diagram.getSequenceDiagram(), validator.getExpansionZone(), 0, eventToIgnore)));
}
if (validator.getFinalHierarchicalParent().equals(self.getHierarchicalParentEvent())) {
Command cmd = DiagramBorderNodeEditPartOperation.getResizeBorderItemCommand((ExecutionEditPart) getHost(), request, false);
@@ -373,8 +372,8 @@ public class ExecutionSelectionEditPolicy extends SpecificBorderItemSelectionEdi
return Integer.MIN_VALUE;
}
- private void addMessageReconnectionCommand(Execution self, CompositeTransactionalCommand cc, TransactionalEditingDomain editingDomain, Message message, Range newRange,
- ChangeBoundsRequest request, AbstractNodeEventResizeSelectionValidator validator) {
+ private void addMessageReconnectionCommand(Execution self, CompositeTransactionalCommand cc, TransactionalEditingDomain editingDomain, Message message, Range newRange, ChangeBoundsRequest request,
+ AbstractNodeEventResizeSelectionValidator validator) {
Set<Execution> executionsInMove = new RequestQuery(request).getExecutions();
boolean invalidCommand = false;
@@ -492,29 +491,29 @@ public class ExecutionSelectionEditPolicy extends SpecificBorderItemSelectionEdi
}
/**
- * Avoid moving the source of the return message of a reflexive synchronous
- * message when resizing a parent execution.
+ * Avoid moving the source of the return message of a reflexive synchronous message when resizing a parent
+ * execution.
*
* @param ise
- * the sequence event to validate if it is a reflexive message we
- * do not want to move
+ * the sequence event to validate if it is a reflexive message we do not want to move
* @return the validation result of the message move.
*/
private boolean doNotMoveSourceOfReturnMessageOfReflexiveSyncCall(Execution self, ISequenceEvent ise, RequestQuery rq) {
- return !(isMovedReflexiveMessage(ise, rq) && self.equals(((Message) ise).getSourceElement()) && getSelection(((Message) ise).getSourceElement()) == EditPart.SELECTED_NONE && getSelection(ise) == EditPart.SELECTED_NONE);
+ return !(isMovedReflexiveMessage(ise, rq) && self.equals(((Message) ise).getSourceElement()) && getSelection(((Message) ise).getSourceElement()) == EditPart.SELECTED_NONE
+ && getSelection(ise) == EditPart.SELECTED_NONE);
}
/**
- * Avoid moving the target of the invocation message of a reflexive
- * synchronous message when resizing a parent execution.
+ * Avoid moving the target of the invocation message of a reflexive synchronous message when resizing a parent
+ * execution.
*
* @param ise
- * the sequence event to validate if it is a reflexive message we
- * do not want to move
+ * the sequence event to validate if it is a reflexive message we do not want to move
* @return the validation result of the message move.
*/
private boolean doNotMoveTargetOfStartMessageOfReflexiveSyncCall(Execution self, ISequenceEvent ise, RequestQuery rq) {
- return !(isMovedReflexiveMessage(ise, rq) && self.equals(((Message) ise).getTargetElement()) && getSelection(((Message) ise).getTargetElement()) == EditPart.SELECTED_NONE && getSelection(ise) == EditPart.SELECTED_NONE);
+ return !(isMovedReflexiveMessage(ise, rq) && self.equals(((Message) ise).getTargetElement()) && getSelection(((Message) ise).getTargetElement()) == EditPart.SELECTED_NONE
+ && getSelection(ise) == EditPart.SELECTED_NONE);
}
private boolean isMovedReflexiveMessage(ISequenceEvent ise, RequestQuery rq) {
@@ -525,8 +524,7 @@ public class ExecutionSelectionEditPolicy extends SpecificBorderItemSelectionEdi
* Feedback
*/
/**
- * Show/update the horizontal feedback lines aligned on the top and bottom
- * of the execution.
+ * Show/update the horizontal feedback lines aligned on the top and bottom of the execution.
* <p>
* {@inheritDoc}
*/
diff --git a/plugins/org.eclipse.sirius.diagram.sequence.ui/src/org/eclipse/sirius/diagram/sequence/ui/tool/internal/edit/policy/ISEComplexMoveCommandBuilder.java b/plugins/org.eclipse.sirius.diagram.sequence.ui/src/org/eclipse/sirius/diagram/sequence/ui/tool/internal/edit/policy/ISEComplexMoveCommandBuilder.java
index ba3e214305..bf2b887ce4 100644
--- a/plugins/org.eclipse.sirius.diagram.sequence.ui/src/org/eclipse/sirius/diagram/sequence/ui/tool/internal/edit/policy/ISEComplexMoveCommandBuilder.java
+++ b/plugins/org.eclipse.sirius.diagram.sequence.ui/src/org/eclipse/sirius/diagram/sequence/ui/tool/internal/edit/policy/ISEComplexMoveCommandBuilder.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 THALES GLOBAL SERVICES.
+ * Copyright (c) 2010, 2019 THALES GLOBAL SERVICES.
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
@@ -36,7 +36,7 @@ import org.eclipse.sirius.diagram.sequence.business.internal.elements.State;
import org.eclipse.sirius.diagram.sequence.business.internal.operation.ISequenceNodeMoveOperation;
import org.eclipse.sirius.diagram.sequence.business.internal.operation.ReparentExecutionOperation;
import org.eclipse.sirius.diagram.sequence.business.internal.operation.SetMessageRangeOperation;
-import org.eclipse.sirius.diagram.sequence.business.internal.operation.VerticalSpaceExpansion;
+import org.eclipse.sirius.diagram.sequence.business.internal.operation.VerticalSpaceExpansionOrReduction;
import org.eclipse.sirius.diagram.sequence.business.internal.util.EventFinder;
import org.eclipse.sirius.diagram.sequence.ui.tool.internal.edit.operation.ShiftMessagesOperation;
import org.eclipse.sirius.diagram.sequence.ui.tool.internal.edit.validator.ISEComplexMoveValidator;
@@ -166,7 +166,8 @@ public class ISEComplexMoveCommandBuilder {
Point locationOnFinalParent = new Point(realLocation.x, d.height);
// Create the command to apply the change.
- final ICommand moveCommand = new SetBoundsCommand(ctc.getEditingDomain(), DiagramUIMessages.Commands_MoveElement, new EObjectAdapter(entry.getKey().getNotationNode()), locationOnFinalParent);
+ final ICommand moveCommand = new SetBoundsCommand(ctc.getEditingDomain(), DiagramUIMessages.Commands_MoveElement, new EObjectAdapter(entry.getKey().getNotationNode()),
+ locationOnFinalParent);
ctc.compose(moveCommand);
}
@@ -202,7 +203,7 @@ public class ISEComplexMoveCommandBuilder {
private void expandDiagram(CompositeTransactionalCommand ctc, Integer vMove) {
if (validator.getExpansionZone() != null && !validator.getExpansionZone().isEmpty()) {
- ctc.compose(CommandFactory.createICommand(editingDomain, new VerticalSpaceExpansion(validator.getDiagram(), validator.getExpansionZone(), vMove, validator.getMovedElements())));
+ ctc.compose(CommandFactory.createICommand(editingDomain, new VerticalSpaceExpansionOrReduction(validator.getDiagram(), validator.getExpansionZone(), vMove, validator.getMovedElements())));
}
}
@@ -211,8 +212,8 @@ public class ISEComplexMoveCommandBuilder {
Collection<AbstractNodeEvent> movedExecutions = Lists.newArrayList(Iterables.filter(sequenceNodesToMove, AbstractNodeEvent.class));
// reparent unmoved executions
- Collection<AbstractNodeEvent> unmovedExecutions = Lists.newArrayList(Iterables.filter(validator.getDiagram().getAllAbstractNodeEvents(),
- Predicates.not(Predicates.in(validator.getMovedElements()))));
+ Collection<AbstractNodeEvent> unmovedExecutions = Lists
+ .newArrayList(Iterables.filter(validator.getDiagram().getAllAbstractNodeEvents(), Predicates.not(Predicates.in(validator.getMovedElements()))));
for (AbstractNodeEvent execToReparent : Iterables.concat(movedExecutions, unmovedExecutions)) {
ISequenceEvent potentialParent = getNewParent(execToReparent, reparents);
diff --git a/plugins/org.eclipse.sirius.diagram.sequence.ui/src/org/eclipse/sirius/diagram/sequence/ui/tool/internal/edit/policy/InteractionUseResizableEditPolicy.java b/plugins/org.eclipse.sirius.diagram.sequence.ui/src/org/eclipse/sirius/diagram/sequence/ui/tool/internal/edit/policy/InteractionUseResizableEditPolicy.java
index af6b5d48e8..57872bc5a7 100644
--- a/plugins/org.eclipse.sirius.diagram.sequence.ui/src/org/eclipse/sirius/diagram/sequence/ui/tool/internal/edit/policy/InteractionUseResizableEditPolicy.java
+++ b/plugins/org.eclipse.sirius.diagram.sequence.ui/src/org/eclipse/sirius/diagram/sequence/ui/tool/internal/edit/policy/InteractionUseResizableEditPolicy.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010, 2015 THALES GLOBAL SERVICES and others.
+ * Copyright (c) 2010, 2019 THALES GLOBAL SERVICES and others.
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
@@ -26,7 +26,7 @@ import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalC
import org.eclipse.sirius.diagram.sequence.business.internal.elements.ISequenceEvent;
import org.eclipse.sirius.diagram.sequence.business.internal.elements.InteractionUse;
import org.eclipse.sirius.diagram.sequence.business.internal.elements.SequenceDiagram;
-import org.eclipse.sirius.diagram.sequence.business.internal.operation.VerticalSpaceExpansion;
+import org.eclipse.sirius.diagram.sequence.business.internal.operation.VerticalSpaceExpansionOrReduction;
import org.eclipse.sirius.diagram.sequence.ui.Messages;
import org.eclipse.sirius.diagram.sequence.ui.tool.internal.edit.operation.SequenceEditPartsOperations;
import org.eclipse.sirius.diagram.sequence.ui.tool.internal.edit.part.ISequenceEventEditPart;
@@ -38,8 +38,7 @@ import org.eclipse.sirius.diagram.sequence.util.Range;
import org.eclipse.sirius.diagram.ui.tools.internal.edit.command.CommandFactory;
/**
- * A specific AirResizableEditPolicy to manage interaction use roles move &
- * resize requests.
+ * A specific AirResizableEditPolicy to manage interaction use roles move & resize requests.
*
* @author mporhel
*/
@@ -99,7 +98,7 @@ public class InteractionUseResizableEditPolicy extends AbstractFrameResizableEdi
ISequenceEvent iSequenceEvent = self.getISequenceEvent();
SequenceDiagram diagram = iSequenceEvent.getDiagram();
Collection<ISequenceEvent> eventToIgnore = Collections.singletonList(iSequenceEvent);
- ICommand autoExpand = CommandFactory.createICommand(self.getEditingDomain(), new VerticalSpaceExpansion(diagram, expansionZone, 0, eventToIgnore));
+ ICommand autoExpand = CommandFactory.createICommand(self.getEditingDomain(), new VerticalSpaceExpansionOrReduction(diagram, expansionZone, 0, eventToIgnore));
ctc.compose(autoExpand);
}
diff --git a/plugins/org.eclipse.sirius.diagram.sequence.ui/src/org/eclipse/sirius/diagram/sequence/ui/tool/internal/edit/policy/SequenceContainerCreationPolicy.java b/plugins/org.eclipse.sirius.diagram.sequence.ui/src/org/eclipse/sirius/diagram/sequence/ui/tool/internal/edit/policy/SequenceContainerCreationPolicy.java
index 77e0e5cebe..fd24c775fa 100644
--- a/plugins/org.eclipse.sirius.diagram.sequence.ui/src/org/eclipse/sirius/diagram/sequence/ui/tool/internal/edit/policy/SequenceContainerCreationPolicy.java
+++ b/plugins/org.eclipse.sirius.diagram.sequence.ui/src/org/eclipse/sirius/diagram/sequence/ui/tool/internal/edit/policy/SequenceContainerCreationPolicy.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010, 2015 THALES GLOBAL SERVICES and others.
+ * Copyright (c) 2010, 2019 THALES GLOBAL SERVICES and others.
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
@@ -46,7 +46,7 @@ import org.eclipse.sirius.diagram.sequence.business.internal.elements.ISequenceE
import org.eclipse.sirius.diagram.sequence.business.internal.elements.ISequenceEvent;
import org.eclipse.sirius.diagram.sequence.business.internal.elements.SequenceDiagram;
import org.eclipse.sirius.diagram.sequence.business.internal.layout.LayoutConstants;
-import org.eclipse.sirius.diagram.sequence.business.internal.operation.VerticalSpaceExpansion;
+import org.eclipse.sirius.diagram.sequence.business.internal.operation.VerticalSpaceExpansionOrReduction;
import org.eclipse.sirius.diagram.sequence.description.tool.CombinedFragmentCreationTool;
import org.eclipse.sirius.diagram.sequence.description.tool.InstanceRoleCreationTool;
import org.eclipse.sirius.diagram.sequence.description.tool.InteractionUseCreationTool;
@@ -73,9 +73,8 @@ import org.eclipse.sirius.ext.gmf.runtime.editparts.GraphicalHelper;
import org.eclipse.sirius.viewpoint.description.tool.AbstractToolDescription;
/**
- * An extension of the standard Sirius ContainerCreationEditPolicy which knows
- * how to handle the specific tools use to create frames (i.e. Interaction Uses
- * and Combined Fragments).
+ * An extension of the standard Sirius ContainerCreationEditPolicy which knows how to handle the specific tools use to
+ * create frames (i.e. Interaction Uses and Combined Fragments).
*
* @author pcdavid
*/
@@ -149,7 +148,7 @@ public class SequenceContainerCreationPolicy extends ContainerCreationEditPolicy
if (expansionZone != null && !expansionZone.isEmpty() && result != null && result.canExecute()) {
// Shift the element to not include int the range of the
// AbstractFrame to create
- VerticalSpaceExpansion verticalSpaceExpansion = new VerticalSpaceExpansion(sequenceDiagram, expansionZone, 0, Collections.<ISequenceEvent> emptyList());
+ VerticalSpaceExpansionOrReduction verticalSpaceExpansion = new VerticalSpaceExpansionOrReduction(sequenceDiagram, expansionZone, 0, Collections.<ISequenceEvent> emptyList());
ICommand expandSubEventsCmd = CommandFactory.createICommand(domain, verticalSpaceExpansion);
result = new ICommandProxy(expandSubEventsCmd).chain(result);
@@ -171,10 +170,9 @@ public class SequenceContainerCreationPolicy extends ContainerCreationEditPolicy
}
/**
- * Overridden to show the feedback of the expansion zone for
- * InteractionUse/CombinedFragment creation when there is inclusion of
- * existing sequence events in its creation range and vertical space
- * expansion is needed for some sequence events.
+ * Overridden to show the feedback of the expansion zone for InteractionUse/CombinedFragment creation when there is
+ * inclusion of existing sequence events in its creation range and vertical space expansion is needed for some
+ * sequence events.
*
*
* {@inheritDoc}
@@ -188,8 +186,8 @@ public class SequenceContainerCreationPolicy extends ContainerCreationEditPolicy
Option<ISequenceElement> seqDiag = ISequenceElementAccessor.getISequenceElement((View) this.getHost().getModel());
AbstractToolDescription tool = getTool(createRequest);
if (seqDiag.some() && seqDiag.get() instanceof SequenceDiagram && (tool instanceof InteractionUseCreationTool || tool instanceof CombinedFragmentCreationTool)) {
- FrameCreationValidator validator = FrameCreationValidator.getOrCreateValidator((SequenceDiagram) seqDiag.get(), (ContainerCreationDescription) tool, new CreateRequestQuery(
- createRequest, sdep));
+ FrameCreationValidator validator = FrameCreationValidator.getOrCreateValidator((SequenceDiagram) seqDiag.get(), (ContainerCreationDescription) tool,
+ new CreateRequestQuery(createRequest, sdep));
if (validator != null) {
SequenceInteractionFeedBackBuilder feedBackBuilder = new SequenceInteractionFeedBackBuilder(validator, getFeedbackLayer(), (IGraphicalEditPart) getHost());
for (Figure fig : feedBackBuilder.buildFeedBack()) {
@@ -260,8 +258,7 @@ public class SequenceContainerCreationPolicy extends ContainerCreationEditPolicy
}
/**
- * Removes the specified <code>Figure</code> from the
- * {@link LayerConstants#FEEDBACK_LAYER}.
+ * Removes the specified <code>Figure</code> from the {@link LayerConstants#FEEDBACK_LAYER}.
*
* @param figure
* the feedback to remove
diff --git a/plugins/org.eclipse.sirius.diagram.sequence.ui/src/org/eclipse/sirius/diagram/sequence/ui/tool/internal/util/DelegatingDiagramCommandFactory.java b/plugins/org.eclipse.sirius.diagram.sequence.ui/src/org/eclipse/sirius/diagram/sequence/ui/tool/internal/util/DelegatingDiagramCommandFactory.java
index ba14b97fd3..e695448fd5 100644
--- a/plugins/org.eclipse.sirius.diagram.sequence.ui/src/org/eclipse/sirius/diagram/sequence/ui/tool/internal/util/DelegatingDiagramCommandFactory.java
+++ b/plugins/org.eclipse.sirius.diagram.sequence.ui/src/org/eclipse/sirius/diagram/sequence/ui/tool/internal/util/DelegatingDiagramCommandFactory.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010, 2018 THALES GLOBAL SERVICES.
+ * Copyright (c) 2010, 2019 THALES GLOBAL SERVICES.
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
@@ -358,7 +358,7 @@ public class DelegatingDiagramCommandFactory implements IDiagramCommandFactory {
}
@Override
- public Command buildInsertVerticalBlankSpaceCommand(DDiagram diagram, int startY, int spaceToInsert) {
- return baseFactory.buildInsertVerticalBlankSpaceCommand(diagram, startY, spaceToInsert);
+ public Command buildInsertOrRemoveVerticalBlankSpaceCommand(DDiagram diagram, int startY, int spaceToInsert) {
+ return baseFactory.buildInsertOrRemoveVerticalBlankSpaceCommand(diagram, startY, spaceToInsert);
}
}
diff --git a/plugins/org.eclipse.sirius.diagram.sequence/plugin.properties b/plugins/org.eclipse.sirius.diagram.sequence/plugin.properties
index 4a8505ee94..ece586f1d6 100644
--- a/plugins/org.eclipse.sirius.diagram.sequence/plugin.properties
+++ b/plugins/org.eclipse.sirius.diagram.sequence/plugin.properties
@@ -82,3 +82,4 @@ SynchronizeInstanceRoleSemanticOrderingOperation_operationName = Synchronize sem
SynchronizeISequenceEventsSemanticOrderingOperation_invalidISequenceEventContext = Invalid context for ISequenceEvent {0}
SynchronizeISequenceEventsSemanticOrderingOperation_operationName = Synchronize semantic ordering
VerticalSpaceExpansion_operationName = Auto-expand of {0}
+VerticalSpaceReduction_operationName = Auto-reduction of {0}
diff --git a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/Messages.java b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/Messages.java
index 0207ace3f8..8e4adf5fb8 100644
--- a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/Messages.java
+++ b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/Messages.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2015, 2017 Obeo.
+ * Copyright (c) 2015, 2019 Obeo.
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
@@ -21,13 +21,13 @@ import org.eclipse.sirius.ext.base.I18N.TranslatableMessage;
* @author mporhel
*/
public final class Messages {
-
+
static {
I18N.initializeMessages(Messages.class, SequenceDiagramPlugin.INSTANCE);
}
// CHECKSTYLE:OFF
-
+
@TranslatableMessage
public static String AbstractFrame_coverageProfilerTaskCategory;
@@ -111,10 +111,10 @@ public final class Messages {
@TranslatableMessage
public static String RefreshLayoutCommand_profilerTaskCategory;
-
+
@TranslatableMessage
public static String RefreshLayoutCommand_profilerTaskName;
-
+
@TranslatableMessage
public static String RefreshSemanticOrderingsOperation_operationName;
@@ -181,8 +181,11 @@ public final class Messages {
@TranslatableMessage
public static String VerticalSpaceExpansion_operationName;
+ @TranslatableMessage
+ public static String VerticalSpaceReduction_operationName;
+
// CHECKSTYLE:ON
-
+
private Messages() {
// Prevents instanciation.
}
diff --git a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/operation/VerticalSpaceExpansion.java b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/operation/VerticalSpaceExpansionOrReduction.java
index b18aa10990..d6de6bcb63 100644
--- a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/operation/VerticalSpaceExpansion.java
+++ b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/operation/VerticalSpaceExpansionOrReduction.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010, 2017 THALES GLOBAL SERVICES and others.
+ * Copyright (c) 2010, 2019 THALES GLOBAL SERVICES and others.
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
@@ -45,11 +45,11 @@ import com.google.common.collect.Iterables;
/**
* An operation to shift all the atomic events on a sequence diagram below a certain point to make room. The space is
- * added from a point to the bottom direction.
+ * added or removed from a point to the bottom direction.
*
* @author pcdavid, smonnier
*/
-public class VerticalSpaceExpansion extends AbstractModelChangeOperation<Void> {
+public class VerticalSpaceExpansionOrReduction extends AbstractModelChangeOperation<Void> {
private final SequenceDiagram sequenceDiagram;
@@ -77,14 +77,15 @@ public class VerticalSpaceExpansion extends AbstractModelChangeOperation<Void> {
* @param diagram
* the sequence diagram in which to make the change.
* @param shift
- * the zone to expand.
+ * the zone to expand or reduce.
* @param move
* how much the main execution which triggered this change is vertically moved.
* @param eventsToIgnore
* the events which should be ignored, as they will be moved into the new space.
*/
- public VerticalSpaceExpansion(SequenceDiagram diagram, Range shift, Integer move, Collection<ISequenceEvent> eventsToIgnore) {
- super(MessageFormat.format(Messages.VerticalSpaceExpansion_operationName, shift));
+ public VerticalSpaceExpansionOrReduction(SequenceDiagram diagram, Range shift, Integer move, Collection<ISequenceEvent> eventsToIgnore) {
+ super(shift.getLowerBound() > shift.getUpperBound() ? MessageFormat.format(Messages.VerticalSpaceReduction_operationName, shift)
+ : MessageFormat.format(Messages.VerticalSpaceExpansion_operationName, shift));
this.sequenceDiagram = diagram;
this.move = move;
this.insertionPoint = shift.getLowerBound();
@@ -144,8 +145,7 @@ public class VerticalSpaceExpansion extends AbstractModelChangeOperation<Void> {
}
/**
- * Expand all the lifelines which do not have a destroy message, but keep
- * the messages they contain stable.
+ * Expand all the lifelines which do not have a destroy message, but keep the messages they contain stable.
*/
private void expandLifelines() {
List<Lifeline> lifelines = sequenceDiagram.getAllLifelines();
@@ -176,9 +176,8 @@ public class VerticalSpaceExpansion extends AbstractModelChangeOperation<Void> {
}
/**
- * Find all the executions in the diagram which may be affected by the
- * operation. This is <em>all</em> the executions except the ones we are
- * explicitly told to ignore (and their descendants).
+ * Find all the executions in the diagram which may be affected by the operation. This is <em>all</em> the
+ * executions except the ones we are explicitly told to ignore (and their descendants).
*/
private Set<ISequenceNode> findAllSequenceNodesToConsider() {
Set<ISequenceNode> sequenceNodes = new LinkedHashSet<>();
@@ -205,13 +204,11 @@ public class VerticalSpaceExpansion extends AbstractModelChangeOperation<Void> {
}
/**
- * Validate if the message is a reflexive message between two ignored
- * executions
+ * Validate if the message is a reflexive message between two ignored executions
*
* @param msg
* a Message
- * @return if the message "msg" is a reflexive message between two ignored
- * executions
+ * @return if the message "msg" is a reflexive message between two ignored executions
*/
private boolean isContainedReflexiveMessage(Message msg) {
return eventsToIgnore.contains(msg.getSourceElement()) && eventsToIgnore.contains(msg.getTargetElement()) && msg.isReflective();
@@ -233,14 +230,12 @@ public class VerticalSpaceExpansion extends AbstractModelChangeOperation<Void> {
* Decide what needs to be done for each of the specified ISequenceNode:
* <ul>
* <li>nothing if it is above the expansion zone.</li>
- * <li>a resize if it intersects the insertion point, i.e. its top is above
- * the point but its bottom is below.</li>
+ * <li>a resize if it intersects the insertion point, i.e. its top is above the point but its bottom is below.</li>
* <li>a complete shift if it is completely below the insertion point.</li>
* </ul>
* <p>
- * After completion of this method, <code>toResize</code> contains all the
- * executions which need to be resized and <code>toShift</code> all the
- * executions which need to be shifted.
+ * After completion of this method, <code>toResize</code> contains all the executions which need to be resized and
+ * <code>toShift</code> all the executions which need to be shifted.
*/
private void categorizeSequenceNodes(Set<? extends ISequenceNode> sequenceNodes) {
eventsToResize = new HashSet<>();
@@ -270,9 +265,8 @@ public class VerticalSpaceExpansion extends AbstractModelChangeOperation<Void> {
continue;
}
/*
- * Only actually shift the "top-level" executions. The rest will be
- * moved along with their shifted ancestor, as execution position is
- * relative to its parent.
+ * Only actually shift the "top-level" executions. The rest will be moved along with their shifted ancestor,
+ * as execution position is relative to its parent.
*/
if (!containsAncestors(eventsToShift, execution)) {
diff --git a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/query/SequenceNodeQuery.java b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/query/SequenceNodeQuery.java
index 1abdfe4df8..c40232ed47 100644
--- a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/query/SequenceNodeQuery.java
+++ b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/query/SequenceNodeQuery.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 THALES GLOBAL SERVICES.
+ * Copyright (c) 2010, 2019 THALES GLOBAL SERVICES.
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
@@ -23,6 +23,7 @@ import org.eclipse.sirius.diagram.WorkspaceImage;
import org.eclipse.sirius.diagram.sequence.business.internal.elements.AbstractNodeEvent;
import org.eclipse.sirius.diagram.sequence.business.internal.elements.EndOfLife;
import org.eclipse.sirius.diagram.sequence.business.internal.elements.Lifeline;
+import org.eclipse.sirius.diagram.sequence.business.internal.util.DecreasingRange;
import org.eclipse.sirius.diagram.sequence.util.Range;
import org.eclipse.sirius.diagram.ui.business.internal.query.DNodeQuery;
import org.eclipse.sirius.diagram.ui.internal.refresh.GMFHelper;
@@ -48,8 +49,7 @@ public class SequenceNodeQuery {
}
/**
- * Returns the vertical range of a sequence diagram element from its GMF
- * notation node.
+ * Returns the vertical range of a sequence diagram element from its GMF notation node.
*
* @return the vertical range of the element.
*/
@@ -79,7 +79,7 @@ public class SequenceNodeQuery {
height = new DNodeQuery((DNode) element).getDefaultDimension().height;
}
- Range result = new Range(y, y + height);
+ Range result = y > y + height ? new DecreasingRange(y, y + height) : new Range(y, y + height);
if (isShifted()) {
result = result.shifted(IBorderItemOffsets.DEFAULT_OFFSET.height);
diff --git a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/util/DecreasingRange.java b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/util/DecreasingRange.java
new file mode 100644
index 0000000000..1242cddcbe
--- /dev/null
+++ b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/util/DecreasingRange.java
@@ -0,0 +1,119 @@
+/*******************************************************************************
+ * Copyright (c) 2019 THALES GLOBAL SERVICES and others.
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.sirius.diagram.sequence.business.internal.util;
+
+import org.eclipse.sirius.diagram.sequence.util.Range;
+
+/**
+ * Specific {@link Range} accepting decreasing range (lower is superior to upper).
+ *
+ * @author <a href="mailto:pierre.guilet@obeo.fr">Pierre Guilet</a>
+ *
+ */
+public class DecreasingRange extends Range {
+
+ private static final String METHOD_NOT_SUPPORTED_MESSAGE = "This range does not support this method."; //$NON-NLS-1$
+
+ /**
+ * Initialize the range with given bounds.
+ *
+ * @param lower
+ * the lower bound
+ * @param upper
+ * the upper bound.
+ */
+ public DecreasingRange(int lower, int upper) {
+ this.lower = lower;
+ this.upper = upper;
+ }
+
+ @Override
+ public Range shifted(int distance) {
+ if (isEmpty()) {
+ return Range.EMPTY_RANGE;
+ } else {
+ return new DecreasingRange(lower + distance, upper + distance);
+ }
+ }
+
+ @Override
+ public int clamp(int value) {
+ throw new UnsupportedOperationException(METHOD_NOT_SUPPORTED_MESSAGE);
+ }
+
+ @Override
+ public boolean includes(int value) {
+ throw new UnsupportedOperationException(METHOD_NOT_SUPPORTED_MESSAGE);
+ }
+
+ @Override
+ public boolean includes(int value, boolean excludeLowerBounds, boolean excludeUpperBounds) {
+ throw new UnsupportedOperationException(METHOD_NOT_SUPPORTED_MESSAGE);
+ }
+
+ @Override
+ public int middleValue() {
+ throw new UnsupportedOperationException(METHOD_NOT_SUPPORTED_MESSAGE);
+ }
+
+ @Override
+ public Range union(Range other) {
+ throw new UnsupportedOperationException(METHOD_NOT_SUPPORTED_MESSAGE);
+ }
+
+ @Override
+ public Range intersection(Range other) {
+ throw new UnsupportedOperationException(METHOD_NOT_SUPPORTED_MESSAGE);
+ }
+
+ @Override
+ public boolean intersects(Range other) {
+ throw new UnsupportedOperationException(METHOD_NOT_SUPPORTED_MESSAGE);
+ }
+
+ @Override
+ public boolean includes(Range other) {
+ throw new UnsupportedOperationException(METHOD_NOT_SUPPORTED_MESSAGE);
+ }
+
+ @Override
+ public boolean includesOneBoundOnly(Range other) {
+ throw new UnsupportedOperationException(METHOD_NOT_SUPPORTED_MESSAGE);
+ }
+
+ @Override
+ public boolean includesAtLeastOneBound(Range other) {
+ throw new UnsupportedOperationException(METHOD_NOT_SUPPORTED_MESSAGE);
+ }
+
+ @Override
+ public Range grown(int distance) {
+ throw new UnsupportedOperationException(METHOD_NOT_SUPPORTED_MESSAGE);
+ }
+
+ @Override
+ public Range shrinked(int distance) {
+ throw new UnsupportedOperationException(METHOD_NOT_SUPPORTED_MESSAGE);
+ }
+
+ @Override
+ public double getProportionalLocation(int n) {
+ throw new UnsupportedOperationException(METHOD_NOT_SUPPORTED_MESSAGE);
+ }
+
+ @Override
+ public boolean validatesBoundsAreDifferent(Range other) {
+ throw new UnsupportedOperationException(METHOD_NOT_SUPPORTED_MESSAGE);
+ }
+
+}
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 0150bfed42..51f9d7a78e 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010, 2017 THALES GLOBAL SERVICES and others.
+ * Copyright (c) 2010, 2019 THALES GLOBAL SERVICES and others.
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
@@ -15,26 +15,39 @@ package org.eclipse.sirius.diagram.sequence.util;
import java.text.MessageFormat;
import org.eclipse.sirius.diagram.sequence.Messages;
+import org.eclipse.sirius.diagram.sequence.business.internal.util.DecreasingRange;
import com.google.common.base.Preconditions;
/**
- * Represents a closed interval between two numbers. The starting and ending
- * points of the range are considered inside the interval.
+ * Represents a closed interval between two numbers. The starting and ending points of the range are considered inside
+ * the interval.
*
* @author pcdavid
*/
public class Range {
/**
- * A sentinel object to represent the empty range. It is technically not
- * empty but this instance is treated specially.
+ * A sentinel object to represent the empty range. It is technically not empty but this instance is treated
+ * specially.
*/
- private static final Range EMPTY_RANGE = new Range(0, 0);
+ protected static final Range EMPTY_RANGE = new Range(0, 0);
- private final int lower;
+ /**
+ * the lower bound of the range.
+ */
+ protected int lower;
+
+ /**
+ * the upper bound of the range.
+ */
+ protected int upper;
- private final int upper;
+ /**
+ * Default constructor to be used by {@link DecreasingRange}.
+ */
+ public Range() {
+ }
/**
* Constructor.
@@ -51,8 +64,7 @@ public class Range {
}
/**
- * Returns the single Range instance which represents an empty range (
- * <code>null</code> object pattern).
+ * Returns the single Range instance which represents an empty range ( <code>null</code> object pattern).
*
* @return an empty range, which contains no element.
*/
@@ -110,37 +122,31 @@ public class Range {
}
/**
- * Returns the lower bound of this range, or <code>NaN</code> if the range
- * is empty.
+ * Returns the lower bound of this range, or <code>NaN</code> if the range is empty.
*
- * @return the lower bound of this range, or <code>NaN</code> if the range
- * is empty.
+ * @return the lower bound of this range, or <code>NaN</code> if the range is empty.
*/
public int getLowerBound() {
return isEmpty() ? Integer.MIN_VALUE : lower;
}
/**
- * Returns the upper bound of this range, or <code>NaN</code> if the range
- * is empty.
+ * Returns the upper bound of this range, or <code>NaN</code> if the range is empty.
*
- * @return the upper bound of this range, or <code>NaN</code> if the range
- * is empty.
+ * @return the upper bound of this range, or <code>NaN</code> if the range is empty.
*/
public int getUpperBound() {
return isEmpty() ? Integer.MIN_VALUE : upper;
}
/**
- * Constrain a value inside this range. If the specified value if less than
- * this range's lower bound (resp. greater than this range's upper bound),
- * returns the lower bound (resp. the upper bound). Otherwise return the
- * value itself.
+ * Constrain a value inside this range. If the specified value if less than this range's lower bound (resp. greater
+ * than this range's upper bound), returns the lower bound (resp. the upper bound). Otherwise return the value
+ * itself.
*
* @param value
* the value to constrain.
- * @return the value closest to the specified input value which is inside
- * the range.
+ * @return the value closest to the specified input value which is inside the range.
*/
public int clamp(int value) {
final int result;
@@ -222,9 +228,8 @@ public class Range {
}
/**
- * Returns a new range which is the union of this range and the other. The
- * union range is the smallest range which includes all the elements of both
- * initial ranges.
+ * Returns a new range which is the union of this range and the other. The union range is the smallest range which
+ * includes all the elements of both initial ranges.
*
* @param other
* the other range.
@@ -270,8 +275,7 @@ public class Range {
*
* @param other
* the other range.
- * @return <code>true</code> if this range intersects with
- * <code>other</code>.
+ * @return <code>true</code> if this range intersects with <code>other</code>.
*/
public boolean intersects(Range other) {
return !intersection(other).isEmpty();
@@ -282,44 +286,38 @@ public class Range {
*
* @param other
* the other range to test for inclusion.
- * @return <code>true</code> if <code>other</code> is included in this
- * range.
+ * @return <code>true</code> if <code>other</code> is included in this range.
*/
public boolean includes(Range other) {
return this.intersection(other).equals(other);
}
/**
- * Tests whether only one bound of the specified range is included inside
- * this one.
+ * Tests whether only one bound of the specified range is included inside this one.
*
* @param other
* the other range to test for inclusion.
- * @return <code>true</code> if <code>other</code> is included in this
- * range.
+ * @return <code>true</code> if <code>other</code> is included in this range.
*/
public boolean includesOneBoundOnly(Range other) {
return (this.includes(other.getLowerBound()) && !this.includes(other.getUpperBound())) || (!this.includes(other.getLowerBound()) && this.includes(other.getUpperBound()));
}
/**
- * Tests whether only one bound of the specified range is included inside
- * this one.
+ * Tests whether only one bound of the specified range is included inside this one.
*
* @param other
* the other range to test for inclusion.
- * @return <code>true</code> if <code>other</code> is included in this
- * range.
+ * @return <code>true</code> if <code>other</code> is included in this range.
*/
public boolean includesAtLeastOneBound(Range other) {
return includes(other) || includesOneBoundOnly(other);
}
/**
- * Returns a new range corresponding to this range shifted by the specified
- * distance (which can be positive or negative). Shifting an empty range
- * produces an empty range. Otherwise the resulting range has the same width
- * as the original.
+ * Returns a new range corresponding to this range shifted by the specified distance (which can be positive or
+ * negative). Shifting an empty range produces an empty range. Otherwise the resulting range has the same width as
+ * the original.
*
* @param distance
* the distance to shift this range.
@@ -334,11 +332,9 @@ public class Range {
}
/**
- * Returns a new range corresponding to this range grown by the specified
- * distance (which must be positive). Growing an empty range produces an
- * empty range. Otherwise the resulting range has a bigger width than
- * original (+ 2 * distance). The middle value of this range is kept
- * constant.
+ * Returns a new range corresponding to this range grown by the specified distance (which must be positive). Growing
+ * an empty range produces an empty range. Otherwise the resulting range has a bigger width than original (+ 2 *
+ * distance). The middle value of this range is kept constant.
*
* @param distance
* the positive distance to grow this range.
@@ -354,11 +350,9 @@ public class Range {
}
/**
- * Returns a new range corresponding to this range shrinked by the specified
- * distance (which must be positive). Shrinking an empty range produces an
- * empty range. Otherwise the resulting range has a smaller width than
- * original (- 2 * distance). The middle value of this range is kept
- * constant.
+ * Returns a new range corresponding to this range shrinked by the specified distance (which must be positive).
+ * Shrinking an empty range produces an empty range. Otherwise the resulting range has a smaller width than original
+ * (- 2 * distance). The middle value of this range is kept constant.
*
* @param distance
* the positive distance to shrink this range.
@@ -375,15 +369,13 @@ public class Range {
}
/**
- * Returns a percentage of how much the given absolute number is inside this
- * range.
+ * Returns a percentage of how much the given absolute number is inside this range.
*
* @param n
* an integer.
- * @return a number between 0.0 and 1.0 representing how much <code>n</code>
- * is inside this range (0.0 meaning n is the range's lower bound or
- * below, 1.0 meaning n is the range's upper bound or above), or
- * Double.NaN if this range is empty.
+ * @return a number between 0.0 and 1.0 representing how much <code>n</code> is inside this range (0.0 meaning n is
+ * the range's lower bound or below, 1.0 meaning n is the range's upper bound or above), or Double.NaN if
+ * this range is empty.
*/
public double getProportionalLocation(int n) {
double result = Double.NaN;
@@ -400,13 +392,11 @@ public class Range {
}
/**
- * Validates that this range bounds does not match any bounds of the other
- * range.
+ * Validates that this range bounds does not match any bounds of the other range.
*
* @param other
* the other range.
- * @return if this range bounds does not match any bounds of the other
- * range.
+ * @return if this range bounds does not match any bounds of the other range.
*/
public boolean validatesBoundsAreDifferent(Range other) {
return getLowerBound() != other.getLowerBound() && getLowerBound() != other.getUpperBound() && getUpperBound() != other.getLowerBound() && getUpperBound() != other.getUpperBound();
diff --git a/plugins/org.eclipse.sirius.diagram.ui/plugin.properties b/plugins/org.eclipse.sirius.diagram.ui/plugin.properties
index 717d34653b..e917a32cc6 100644
--- a/plugins/org.eclipse.sirius.diagram.ui/plugin.properties
+++ b/plugins/org.eclipse.sirius.diagram.ui/plugin.properties
@@ -1,5 +1,5 @@
# ====================================================================
-# Copyright (c) 2007, 2018 THALES GLOBAL SERVICES.
+# Copyright (c) 2007, 2019 THALES GLOBAL SERVICES.
# This program and the accompanying materials
# are made available under the terms of the Eclipse Public License 2.0
# which accompanies this distribution, and is available at
@@ -982,6 +982,7 @@ Identifier_invalidNullObject = {0} cannot be null
InitializeHiddenElementsCommand_label = Initialize hidden elements
InitializeLayoutCommand_label = Initialize layout
InsertBlankSpace_cmdName = Insert blank space
+RemoveBlankSpace_cmdName = Remove blank space
ItemProvider_elementBasedEdge = Element Based Edge
ItemProvider_foregroundBackgroundLabel = {0} {1} to {2}
ItemProvider_relationBasedEdge = Relation Based Edge
diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/editor/SiriusBlankSpacesDragTracker.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/editor/SiriusBlankSpacesDragTracker.java
index 22dbb59cba..517edbecb5 100644
--- a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/editor/SiriusBlankSpacesDragTracker.java
+++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/editor/SiriusBlankSpacesDragTracker.java
@@ -42,8 +42,8 @@ import org.eclipse.sirius.ext.draw2d.figure.InsertBlankSpaceGuide;
import org.eclipse.swt.graphics.Cursor;
/**
- * A specific {@link SimpleDragTracker} to insert vertical blank space in diagram representation. This tracker is used
- * when Ctrl+shift key is pressed when user makes a selection or when doing a selection from the ruler.
+ * A specific {@link SimpleDragTracker} to insert or remove vertical blank space in diagram representation. This tracker
+ * is used when Ctrl+shift key is pressed when user makes a selection or when doing a selection from the ruler.
*
* @author <a href="mailto:laurent.redor@obeo.fr">Laurent Redor</a>
* @author <a href="mailto:pierre.guilet@obeo.fr">Pierre Guilet</a>
@@ -57,7 +57,7 @@ public class SiriusBlankSpacesDragTracker extends SimpleDragTracker {
protected AbstractGraphicalEditPart source;
/**
- * The location where the end-user starts to define the zone to insert blank space.
+ * The location where the end-user starts to define the zone to insert or remove blank space.
*/
private int startLocation;
@@ -67,12 +67,12 @@ public class SiriusBlankSpacesDragTracker extends SimpleDragTracker {
private int startLocationForFeedback;
/**
- * The location where the end-user ends to define the zone to insert blank space.
+ * The location where the end-user ends to define the zone to insert or remove blank space.
*/
private int endLocation;
/**
- * The feedback figure representing the blank space to insert.
+ * The feedback figure representing the blank space to insert or remove.
*/
private InsertBlankSpaceGuide blankSpaceGuide;
@@ -99,11 +99,11 @@ public class SiriusBlankSpacesDragTracker extends SimpleDragTracker {
Command result = UnexecutableCommand.INSTANCE;
// The case (startLocation == 0 && endLocation == 0) corresponds to the case where the user do the first click
// (without moving).
- if ((startLocation == 0 && endLocation == 0) || (startLocation != 0 && endLocation >= startLocation)) {
+ if ((startLocation == 0 && endLocation == 0) || (startLocation != 0 && endLocation != startLocation)) {
if (isHorizontal(source)) {
- result = createInsertHorizontalBlankSpaceCommand(startLocation, endLocation - startLocation, diagramViewer);
+ result = createInsertOrRemoveHorizontalBlankSpaceCommand(startLocation, endLocation - startLocation, diagramViewer);
} else {
- result = createInsertVerticalBlankSpaceCommand(startLocation, endLocation - startLocation, diagramViewer);
+ result = createInsertOrRemoveVerticalBlankSpaceCommand(startLocation, endLocation - startLocation, diagramViewer);
}
}
return result;
@@ -158,6 +158,11 @@ public class SiriusBlankSpacesDragTracker extends SimpleDragTracker {
} else {
bounds.y = startLocationForFeedback;
bounds.height = getCurrentPositionZoomed() - startLocationForFeedback;
+ if (bounds.height < 0) {
+ // from bottom to top
+ bounds.y = bounds.y + bounds.height;
+ bounds.height = Math.abs(bounds.height);
+ }
}
blankSpaceGuide.setBounds(bounds);
}
@@ -237,11 +242,15 @@ public class SiriusBlankSpacesDragTracker extends SimpleDragTracker {
@Override
protected String getCommandName() {
- return Messages.InsertBlankSpace_cmdName;
+ if (startLocation > endLocation) {
+ return Messages.RemoveBlankSpace_cmdName;
+ } else {
+ return Messages.InsertBlankSpace_cmdName;
+ }
}
/**
- * Returns a drag tracker allowing to add blank in diagram representation.
+ * Returns a drag tracker allowing to add or remove blank in diagram representation.
*
* @param graphicalEditPart
* the edit part from which
@@ -253,7 +262,7 @@ public class SiriusBlankSpacesDragTracker extends SimpleDragTracker {
* true if the CTRL key must be down to return a drag tracker, false otherwise.
* @param shiftKeyRequirement
* true if the SHIFT key must be down to return a drag tracker, false otherwise.
- * @return a drag tracker allowing to add blank in diagram representation.
+ * @return a drag tracker allowing to add or remove blank in diagram representation.
*/
public static DragTracker getDragTracker(AbstractGraphicalEditPart graphicalEditPart, GraphicalViewer diagramViewer, Request request, boolean controlKeyRequirement, boolean shiftKeyRequirement) {
DragTracker result = null;
@@ -264,9 +273,9 @@ public class SiriusBlankSpacesDragTracker extends SimpleDragTracker {
} else if ((!controlKeyRequirement || selectionRequest.isControlKeyPressed()) && (!shiftKeyRequirement || selectionRequest.isShiftKeyPressed())) {
try {
if (isHorizontal(graphicalEditPart)) {
- createInsertHorizontalBlankSpaceCommand(0, 0, diagramViewer);
+ createInsertOrRemoveHorizontalBlankSpaceCommand(0, 0, diagramViewer);
} else {
- createInsertVerticalBlankSpaceCommand(0, 0, diagramViewer);
+ createInsertOrRemoveVerticalBlankSpaceCommand(0, 0, diagramViewer);
}
result = new SiriusBlankSpacesDragTracker(graphicalEditPart, diagramViewer);
} catch (UnsupportedOperationException e) {
@@ -278,19 +287,19 @@ public class SiriusBlankSpacesDragTracker extends SimpleDragTracker {
}
/**
- * Create a command that inserts horizontal blank space in a diagram by shifting nodes. It is currently not
- * implemented in Sirius core, probably done later.
+ * Create a command that inserts or removes horizontal blank space in a diagram by shifting nodes. It is currently
+ * not implemented in Sirius core, probably done later.
*
* @param startLocation
- * the initial location in pixel to insert blank space
- * @param spaceToInsert
- * the number of pixels to insert
+ * the initial location in pixel to insert or removes blank space
+ * @param spaceToInsertOrRemove
+ * the number of pixels to insert or remove
* @param diagramViewer
* the diagram viewer where the drag will occur.
- * @return a command that inserts vertical blank space in a diagram by shifting nodes.
+ * @return a command that inserts or removes vertical blank space in a diagram by shifting nodes.
*/
- private static Command createInsertHorizontalBlankSpaceCommand(int startLocation, int spaceToInsert, GraphicalViewer diagramViewer) {
- return createInsertBlankSpaceCommand(startLocation, spaceToInsert, true, diagramViewer);
+ private static Command createInsertOrRemoveHorizontalBlankSpaceCommand(int startLocation, int spaceToInsertOrRemove, GraphicalViewer diagramViewer) {
+ return createInsertOrRemoveBlankSpaceCommand(startLocation, spaceToInsertOrRemove, true, diagramViewer);
}
/**
@@ -304,16 +313,16 @@ public class SiriusBlankSpacesDragTracker extends SimpleDragTracker {
* the diagram viewer where the drag will occur.
* @return a command that inserts vertical blank space in a diagram by shifting nodes.
*/
- private static Command createInsertVerticalBlankSpaceCommand(int startLocation, int spaceToInsert, GraphicalViewer diagramViewer) {
- return createInsertBlankSpaceCommand(startLocation, spaceToInsert, false, diagramViewer);
+ private static Command createInsertOrRemoveVerticalBlankSpaceCommand(int startLocation, int spaceToInsert, GraphicalViewer diagramViewer) {
+ return createInsertOrRemoveBlankSpaceCommand(startLocation, spaceToInsert, false, diagramViewer);
}
/**
- * Returns true if horizontal blank must be added. False otherwise.
+ * Returns true if horizontal blank must be added or removed. False if vertical space must be added or removed.
*
* @param editPart
- * the edit part from which blank addition is done.
- * @return true if horizontal blank must be added. False otherwise.
+ * the edit part from which blank addition or removal is done.
+ * @return true if horizontal blank must be added or removed. False if vertical space must be added or removed.
*/
private static boolean isHorizontal(AbstractGraphicalEditPart editPart) {
boolean isHorizontal = false;
@@ -326,19 +335,19 @@ public class SiriusBlankSpacesDragTracker extends SimpleDragTracker {
}
/**
- * Create a command that inserts vertical blank space in a diagram by shifting nodes.
+ * Create a command that inserts or removes vertical blank space in a diagram by shifting nodes.
*
* @param startLocation
* the initial location in pixel to insert blank space
- * @param spaceToInsert
+ * @param spaceToInsertOrRemove
* the number of pixels to insert
* @param horizontal
- * true if the blank space must be inserted horizontally, false otherwise
+ * true if the blank space must be inserted or removed horizontally, false otherwise
* @param diagramViewer
* the diagram viewer where the drag will occur.
* @return a command to add space.
*/
- private static Command createInsertBlankSpaceCommand(int startLocation, int spaceToInsert, boolean horizontal, GraphicalViewer diagramViewer) {
+ private static Command createInsertOrRemoveBlankSpaceCommand(int startLocation, int spaceToInsertOrRemove, boolean horizontal, GraphicalViewer diagramViewer) {
if (diagramViewer.getRootEditPart().getContents() instanceof IGraphicalEditPart) {
IGraphicalEditPart diagramEditPart = (IGraphicalEditPart) diagramViewer.getRootEditPart().getContents();
TransactionalEditingDomain ted = diagramEditPart.getEditingDomain();
@@ -352,7 +361,7 @@ public class SiriusBlankSpacesDragTracker extends SimpleDragTracker {
throw new UnsupportedOperationException(Messages.UndoRedoCapableEMFCommandFactory_insertHorizontalBlankSpaceNotImplemented);
} else {
org.eclipse.emf.common.command.Command command = diagramEditor.getEmfCommandFactoryProvider().getCommandFactory(ted)
- .buildInsertVerticalBlankSpaceCommand((DDiagram) diagramEditPart.getNotationView().getElement(), startLocation, spaceToInsert);
+ .buildInsertOrRemoveVerticalBlankSpaceCommand((DDiagram) diagramEditPart.getNotationView().getElement(), startLocation, spaceToInsertOrRemove);
return new ICommandProxy(new GMFCommandWrapper(ted, command));
}
}
diff --git a/plugins/org.eclipse.sirius.diagram.ui/src/org/eclipse/sirius/diagram/ui/provider/Messages.java b/plugins/org.eclipse.sirius.diagram.ui/src/org/eclipse/sirius/diagram/ui/provider/Messages.java
index ff59fe8291..af7d3abd11 100644
--- a/plugins/org.eclipse.sirius.diagram.ui/src/org/eclipse/sirius/diagram/ui/provider/Messages.java
+++ b/plugins/org.eclipse.sirius.diagram.ui/src/org/eclipse/sirius/diagram/ui/provider/Messages.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2015, 2018 Obeo and THALES GLOBAL SERVICES.
+ * Copyright (c) 2015, 2019 Obeo and THALES GLOBAL SERVICES.
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
@@ -1594,6 +1594,9 @@ public final class Messages {
@TranslatableMessage
public static String ChangeEditModeAction_ChangeFailure;
+ @TranslatableMessage
+ public static String RemoveBlankSpace_cmdName;
+
// CHECKSTYLE:ON
private Messages() {
// Prevents instanciation.
diff --git a/plugins/org.eclipse.sirius.diagram/src-core/org/eclipse/sirius/diagram/tools/api/command/IDiagramCommandFactory.java b/plugins/org.eclipse.sirius.diagram/src-core/org/eclipse/sirius/diagram/tools/api/command/IDiagramCommandFactory.java
index 42219d3242..f4c59953ea 100644
--- a/plugins/org.eclipse.sirius.diagram/src-core/org/eclipse/sirius/diagram/tools/api/command/IDiagramCommandFactory.java
+++ b/plugins/org.eclipse.sirius.diagram/src-core/org/eclipse/sirius/diagram/tools/api/command/IDiagramCommandFactory.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2018 THALES GLOBAL SERVICES.
+ * Copyright (c) 2007, 2019 THALES GLOBAL SERVICES.
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
@@ -58,15 +58,13 @@ public interface IDiagramCommandFactory extends ICommandFactory {
/**
* Create a command that executes the operation of a {@link BehaviorTool}.
* <p>
- * The operations of a {@link BehaviorTool} are executed on the
- * <code>rootObject</code> parameter. If the
- * <code>executeFromRootContainer</code> is <code>true</code> the operations
- * are executed on the root container of <code>rootObject</code>.
+ * The operations of a {@link BehaviorTool} are executed on the <code>rootObject</code> parameter. If the
+ * <code>executeFromRootContainer</code> is <code>true</code> the operations are executed on the root container of
+ * <code>rootObject</code>.
* </p>
* <p>
- * Finally, if the <code>deepProcess</code> parameter is <code>true</code>,
- * the operations are executing on all children (with a deep path) according
- * to the {@link BehaviorTool#getDomainClass()} and the
+ * Finally, if the <code>deepProcess</code> parameter is <code>true</code>, the operations are executing on all
+ * children (with a deep path) according to the {@link BehaviorTool#getDomainClass()} and the
* {@link BehaviorTool#getPrecondition()}.
* </p>
*
@@ -75,8 +73,7 @@ public interface IDiagramCommandFactory extends ICommandFactory {
* @param tool
* the behavior.
* @param executeFromRootContainer
- * if <code>true</code> the tool is applied on the root container
- * of <code>rootObject</code>.
+ * if <code>true</code> the tool is applied on the root container of <code>rootObject</code>.
* @param deepProcess
* if <code>true</code>
* @return return the command that executes a behavior.
@@ -87,12 +84,11 @@ public interface IDiagramCommandFactory extends ICommandFactory {
* Create a command that creates a node.
*
* @param container
- * container element in which the command should put the created
- * node.
+ * container element in which the command should put the created node.
* @param tool
* {@link NodeCreationDescription} used to build the command.
- * @return a command able to create the node and putting it in the
- * container, corresponding to the {@link NodeCreationDescription}.
+ * @return a command able to create the node and putting it in the container, corresponding to the
+ * {@link NodeCreationDescription}.
*/
Command buildCreateNodeCommandFromTool(DDiagramElementContainer container, NodeCreationDescription tool);
@@ -100,13 +96,12 @@ public interface IDiagramCommandFactory extends ICommandFactory {
* Create a command that creates a node.
*
* @param node
- * the node container in which the command should put the created
- * node.
+ * the node container in which the command should put the created node.
* @param tool
*
* the {@link NodeCreationDescription} used to build the command.
- * @return a command able to create the node and putting it around the node,
- * corresponding to the {@link NodeCreationDescription}.
+ * @return a command able to create the node and putting it around the node, corresponding to the
+ * {@link NodeCreationDescription}.
*/
Command buildCreateNodeCommandFromTool(DNode node, NodeCreationDescription tool);
@@ -114,50 +109,43 @@ public interface IDiagramCommandFactory extends ICommandFactory {
* Create a command that create a node and put it in the viewpoint.
*
* @param diagram
- * the viewpoint in which the command should put the created
- * node.
+ * the viewpoint in which the command should put the created node.
* @param tool
* the {@link NodeCreationDescription} used to build the command.
- * @return a command able to create the node and putting it into the
- * viewpoint, corresponding to the {@link NodeCreationDescription}.
+ * @return a command able to create the node and putting it into the viewpoint, corresponding to the
+ * {@link NodeCreationDescription}.
*/
Command buildCreateNodeCommandFromTool(DDiagram diagram, NodeCreationDescription tool);
/**
* Create a command that is able to execute the operations of a
- * {@link org.eclipse.sirius.viewpoint.description.tool.SelectionWizardDescription}
- * .
+ * {@link org.eclipse.sirius.viewpoint.description.tool.SelectionWizardDescription} .
*
* @param tool
* the tool, it must be a
- * {@link org.eclipse.sirius.viewpoint.description.tool.SelectionWizardDescription}
- * .
+ * {@link org.eclipse.sirius.viewpoint.description.tool.SelectionWizardDescription} .
* @param dContainer
* the clicked designer container.
* @param selectedElement
* the selected element.
* @return a command that is able to execute the operations of
- * {@link org.eclipse.sirius.viewpoint.description.tool.SelectionWizardDescription}
- * .
+ * {@link org.eclipse.sirius.viewpoint.description.tool.SelectionWizardDescription} .
*/
Command buildSelectionWizardCommandFromTool(SelectionWizardDescription tool, DSemanticDecorator dContainer, Collection<EObject> selectedElement);
/**
* Create a command that is able to execute the operations of a
- * {@link org.eclipse.sirius.viewpoint.description.tool.PaneBasedSelectionWizardDescription}
- * .
+ * {@link org.eclipse.sirius.viewpoint.description.tool.PaneBasedSelectionWizardDescription} .
*
* @param tool
* the tool, it must be a
- * {@link org.eclipse.sirius.viewpoint.description.tool.PaneBasedSelectionWizardDescription}
- * .
+ * {@link org.eclipse.sirius.viewpoint.description.tool.PaneBasedSelectionWizardDescription} .
* @param dContainer
* the clicked designer container.
* @param selectedElement
* the selected element.
* @return a command that is able to execute the operations of
- * {@link org.eclipse.sirius.viewpoint.description.tool.PaneBasedSelectionWizardDescription}
- * .
+ * {@link org.eclipse.sirius.viewpoint.description.tool.PaneBasedSelectionWizardDescription} .
*/
Command buildPaneBasedSelectionWizardCommandFromTool(PaneBasedSelectionWizardDescription tool, DSemanticDecorator dContainer, Collection<EObject> selectedElement);
@@ -166,9 +154,8 @@ public interface IDiagramCommandFactory extends ICommandFactory {
* {@link org.eclipse.sirius.description.tool.JavaActionMenuItem}.
*
* @param tool
- * the tool, it must be a
- * {@link org.eclipse.sirius.description.tool.JavaActionMenuItem}
- * , the action to launch.
+ * the tool, it must be a {@link org.eclipse.sirius.description.tool.JavaActionMenuItem} , the action to
+ * launch.
* @param selectedViews
* the clicked designer container.
* @param javaAction
@@ -183,9 +170,8 @@ public interface IDiagramCommandFactory extends ICommandFactory {
* {@link org.eclipse.sirius.description.tool.OperationMenuItem}.
*
* @param tool
- * the tool, it must be a
- * {@link org.eclipse.sirius.description.tool.OperationMenuItem}
- * , the operation to launch.
+ * the tool, it must be a {@link org.eclipse.sirius.description.tool.OperationMenuItem} , the operation
+ * to launch.
* @param selectedViews
* the clicked designer container.
*
@@ -277,16 +263,14 @@ public interface IDiagramCommandFactory extends ICommandFactory {
Command buildPasteCommandFromTool(DSemanticDecorator dContainer, EObject copiedElement, PasteDescription tool);
/**
- * Create a command able to execute an action when double clicking on an
- * element.
+ * Create a command able to execute an action when double clicking on an element.
*
* @param dDiagramElement
* the element that can be double clicked.
*
* @param tool
* the tool that describes the operation.
- * @return a command able to execute a defined action when double clicking
- * on dDiagramElement.
+ * @return a command able to execute a defined action when double clicking on dDiagramElement.
*/
Command buildDoubleClickOnElementCommandFromTool(DDiagramElement dDiagramElement, DoubleClickDescription tool);
@@ -302,15 +286,13 @@ public interface IDiagramCommandFactory extends ICommandFactory {
Command buildCreateContainerCommandFromTool(DDiagram diagram, ContainerCreationDescription tool);
/**
- * Create a command that is able to create a container into the specified
- * container.
+ * Create a command that is able to create a container into the specified container.
*
* @param nodeContainer
* the parent container.
* @param tool
* the tool that describes how to create the new container.
- * @return a command that is able to create a container into the specified
- * container.
+ * @return a command that is able to create a container into the specified container.
*/
Command buildCreateContainerCommandFromTool(DDiagramElementContainer nodeContainer, ContainerCreationDescription tool);
@@ -328,8 +310,7 @@ public interface IDiagramCommandFactory extends ICommandFactory {
*
* @param element
* element to delete.
- * @return a command that delete the DDiagramElement without deleting the
- * semantic one.
+ * @return a command that delete the DDiagramElement without deleting the semantic one.
*/
Command buildDeleteFromDiagramCommand(DDiagramElement element);
@@ -343,8 +324,7 @@ public interface IDiagramCommandFactory extends ICommandFactory {
Command buildDeleteDiagramElement(DDiagramElement element);
/**
- * Build a direct edit label command using the corresponding tool
- * description.
+ * Build a direct edit label command using the corresponding tool description.
*
* @param repElement
* : the element on which the label should be changed.
@@ -352,8 +332,7 @@ public interface IDiagramCommandFactory extends ICommandFactory {
* : the tool description.
* @param newValue
* : the new label value
- * @return : a command which prepare the model request interpreter and set
- * the new label.
+ * @return : a command which prepare the model request interpreter and set the new label.
*/
Command buildDirectEditLabelFromTool(DRepresentationElement repElement, DirectEditLabel directEditTool, String newValue);
@@ -398,8 +377,7 @@ public interface IDiagramCommandFactory extends ICommandFactory {
*
* @param diagramElement
* the diagram element for which you want to reveal the label.
- * @return a command that is able to reveal the label of one diagram
- * element.
+ * @return a command that is able to reveal the label of one diagram element.
*/
Command buildRevealLabelCommand(DDiagramElement diagramElement);
@@ -429,8 +407,7 @@ public interface IDiagramCommandFactory extends ICommandFactory {
* @param semanticElement
* the element from which the diagram will be created.
* @param monitor
- * a {@link IProgressMonitor} to show progression of
- * {@link DDiagram} creation
+ * a {@link IProgressMonitor} to show progression of {@link DDiagram} creation
* @return a command that is able to create a diagram.
*/
DCommand buildCreateDiagramFromDescription(DiagramDescription description, EObject semanticElement, IProgressMonitor monitor);
@@ -455,13 +432,12 @@ public interface IDiagramCommandFactory extends ICommandFactory {
* the view the tool has been invoked on.
* @param toolDesc
* the description of the tool.
- * @return a command which executes the behavior specified in the tool in
- * the context of the view.
+ * @return a command which executes the behavior specified in the tool in the context of the view.
*/
Command buildGenericToolCommandFromTool(EObject containerView, ToolDescription toolDesc);
/**
- * Create a command that shifts nodes to insert vertical blank space in a diagram.
+ * Create a command that shifts nodes to insert or remove vertical blank space in a diagram.
*
* @param diagram
* the diagram in which insert blank space
@@ -472,5 +448,5 @@ public interface IDiagramCommandFactory extends ICommandFactory {
*
* @return a command able to insert blank space (move all elements).
*/
- Command buildInsertVerticalBlankSpaceCommand(DDiagram diagram, int startX, int spaceToInsert);
+ Command buildInsertOrRemoveVerticalBlankSpaceCommand(DDiagram diagram, int startX, int spaceToInsert);
}
diff --git a/plugins/org.eclipse.sirius.diagram/src-core/org/eclipse/sirius/diagram/tools/internal/command/UndoRedoCapableEMFCommandFactory.java b/plugins/org.eclipse.sirius.diagram/src-core/org/eclipse/sirius/diagram/tools/internal/command/UndoRedoCapableEMFCommandFactory.java
index 9725986bb3..881d48e7cf 100644
--- a/plugins/org.eclipse.sirius.diagram/src-core/org/eclipse/sirius/diagram/tools/internal/command/UndoRedoCapableEMFCommandFactory.java
+++ b/plugins/org.eclipse.sirius.diagram/src-core/org/eclipse/sirius/diagram/tools/internal/command/UndoRedoCapableEMFCommandFactory.java
@@ -669,7 +669,7 @@ public class UndoRedoCapableEMFCommandFactory extends AbstractCommandFactory imp
}
@Override
- public Command buildInsertVerticalBlankSpaceCommand(DDiagram diagram, int startY, int spaceToInsert) {
+ public Command buildInsertOrRemoveVerticalBlankSpaceCommand(DDiagram diagram, int startY, int spaceToInsert) {
// Not implemented in "standard" diagram
throw new UnsupportedOperationException(Messages.UndoRedoCapableEMFCommandFactory_insertVerticalBlankSpaceNotImplemented);
}
diff --git a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html
index 77424e619e..381229ff23 100644
--- a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html
+++ b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html
@@ -16,6 +16,9 @@
<a href="#sirius6.2.0">Changes in Sirius 6.2.0</a>
<ol style="list-style: disc;">
<li>
+ <a href="#UserVisibleChanges">User-Visible Changes</a>
+ </li>
+ <li>
<a href="#DeveloperVisibleChanges">Developer-Visible Changes</a>
</li>
</ol>
@@ -24,7 +27,7 @@
<a href="#sirius6.1.2">Changes in Sirius 6.1.2</a>
<ol style="list-style: disc;">
<li>
- <a href="#UserVisibleChanges">User-Visible Changes</a>
+ <a href="#UserVisibleChanges2">User-Visible Changes</a>
</li>
<li>
<a href="#DeveloperVisibleChanges2">Developer-Visible Changes</a>
@@ -43,7 +46,7 @@
<a href="#sirius6.1.0">Changes in Sirius 6.1.0</a>
<ol style="list-style: disc;">
<li>
- <a href="#UserVisibleChanges2">User-Visible Changes</a>
+ <a href="#UserVisibleChanges3">User-Visible Changes</a>
</li>
<li>
<a href="#SpecifierVisibleChanges">Specifier-Visible Changes</a>
@@ -57,7 +60,7 @@
<a href="#sirius6.0.0">Changes in Sirius 6.0.0</a>
<ol style="list-style: disc;">
<li>
- <a href="#UserVisibleChanges3">User-Visible Changes</a>
+ <a href="#UserVisibleChanges4">User-Visible Changes</a>
</li>
<li>
<a href="#SpecifierVisibleChanges2">Specifier-Visible Changes</a>
@@ -71,7 +74,7 @@
<a href="#sirius5.1.1">Changes in Sirius 5.1.1</a>
<ol style="list-style: disc;">
<li>
- <a href="#UserVisibleChanges4">User-Visible Changes</a>
+ <a href="#UserVisibleChanges5">User-Visible Changes</a>
</li>
<li>
<a href="#DeveloperVisibleChanges5">Developer-Visible Changes</a>
@@ -82,7 +85,7 @@
<a href="#sirius5.1.0">Changes in Sirius 5.1.0</a>
<ol style="list-style: disc;">
<li>
- <a href="#UserVisibleChanges5">User-Visible Changes</a>
+ <a href="#UserVisibleChanges6">User-Visible Changes</a>
</li>
<li>
<a href="#SpecifierVisibleChanges3">Specifier-Visible Changes</a>
@@ -99,6 +102,12 @@
<a href="Release_Notes_Previous.html">the release notes from previous versions</a> for details about older releases.
</p>
<h2 id="sirius6.2.0">Changes in Sirius 6.2.0</h2>
+ <h3 id="UserVisibleChanges">User-Visible Changes</h3>
+ <ul>
+ <li><span class="label label-success">Added</span> On sequence diagrams, it is now possible to remove vertical blank spaces on standard edition mode by dragging the mouse from bottom to top anywhere in the canvas with the Ctrl+Shift keys pressed. This
+ <a href="user/sequences/Sequence%20Diagrams.html#remove_vertical_blank_space">feature</a> was here since version 6.0.0 but was only accessible through the ruler.
+ </li>
+ </ul>
<h3 id="DeveloperVisibleChanges">Developer-Visible Changes</h3>
<h4 id="Changesinorg.eclipse.sirius">Changes in
<code>org.eclipse.sirius</code>
@@ -122,6 +131,10 @@
<ul>
<li><span class="label label-info">Added</span> The extension point org.eclipse.sirius.diagram.customBundledImageShape has been created in order to provide custom shape to the bundled image style. This extension point offers more flexibility on the specification of the svg tags and attributes holding the color, border color and border size information than the extension point org.eclipse.sirius.diagram.bundledImageShape.</li>
<li><span class="label label-info">Modified</span> The extension point org.eclipse.sirius.diagram.bundledImageShape has been marked as deprecated. Shapes provided by this extension point still work.</li>
+ <li><span class="label label-info">Modified</span> The method
+ <code>org.eclipse.sirius.diagram.tools.api.command.IDiagramCommandFactory.buildInsertVerticalBlankSpaceCommand(DDiagram, int, int)</code> has been renamed to
+ <code>org.eclipse.sirius.diagram.tools.api.command.IDiagramCommandFactory.buildInsertOrRemoveVerticalBlankSpaceCommand(DDiagram, int, int)</code> because it handles now both addition and removal.
+ </li>
<li><span class="label label-info">Modified</span> Method
<em>getAllEdgeMappings</em> defined in
<code>org.eclipse.sirius.diagram.business.internal.metamodel.helper.ContentHelper</code> has been moved in a new class called
@@ -294,8 +307,23 @@
<code>SessionEditor</code> as an additional parameter to allow implementation to decide if it should provide an additional page or not.
</li>
</ul>
+ <h4 id="Changesinorg.eclipse.sirius.diagram.sequence">Changes in
+ <code>org.eclipse.sirius.diagram.sequence</code>
+ </h4>
+ <ul>
+ <li><span class="label label-success">Added</span> A new translatable message
+ <code>org.eclipse.sirius.diagram.sequence.Messages.VerticalSpaceReduction_operationName</code> has been added. It&#8217;s key is
+ <code>VerticalSpaceReduction_operationName</code> and its default value is
+ <code>Auto-reduction of {0}</code>. It is used when reducing spaces in sequence diagram.
+ </li>
+ <li><span class="label label-success">Added</span> A new translatable message
+ <code>org.eclipse.sirius.diagram.ui.provider.Messages.RemoveBlankSpace_cmdName</code> has been added. It&#8217;s key is
+ <code>RemoveBlankSpace_cmdName</code> and its default value is
+ <code>Remove blank space</code>. It is used when removing spaces in sequence diagram.
+ </li>
+ </ul>
<h2 id="sirius6.1.2">Changes in Sirius 6.1.2</h2>
- <h3 id="UserVisibleChanges">User-Visible Changes</h3>
+ <h3 id="UserVisibleChanges2">User-Visible Changes</h3>
<ul>
<li><span class="label label-info">Modified</span> Invalid representations, that are either representations which semantic target does not exist anymore or representations that can not be retrieved anymore, are grayed in the Model Explorer and the only available action is
<em>Delete</em>. It was previously the case only for representations which semantic target does not exist anymore.
@@ -383,7 +411,7 @@
<a href="https://www.eclipse.org/legal/epl-2.0/faq.php">the official FAQ</a> for details about the difference between EPL v1.0 (which was used before) and v2.0.
</li>
</ul>
- <h3 id="UserVisibleChanges2">User-Visible Changes</h3>
+ <h3 id="UserVisibleChanges3">User-Visible Changes</h3>
<ul>
<li><span class="label label-success">Added</span> A new preference has been added in the Sirius preference panel. It allows Sirius to ask the user if he wants to save session resources after an automatic migration. If the new preference is ticked, the pop-up will only appear for session opening caused by a direct action of the user (i.e. opening a diagram or unfolding the resources in the model explorer). You can refer to the
<a href="user/general/Modeling%20Project.html#Migration">user documentation </a> for more details.
@@ -717,7 +745,7 @@
</li>
</ul>
<h2 id="sirius6.0.0">Changes in Sirius 6.0.0</h2>
- <h3 id="UserVisibleChanges3">User-Visible Changes</h3>
+ <h3 id="UserVisibleChanges4">User-Visible Changes</h3>
<ul>
<li><span class="label label-success">Added</span> A new feature allows user to insert vertical blank space in sequence diagram. You can refer to the
<a href="user/sequences/Sequence%20Diagrams.html#insert_vertical_blank_space">user documentation </a> for more details.
@@ -970,7 +998,7 @@
</ul>
<h4 id="TranslationKeysChanges">Translation Keys Changes</h4>
<h2 id="sirius5.1.1">Changes in Sirius 5.1.1</h2>
- <h3 id="UserVisibleChanges4">User-Visible Changes</h3>
+ <h3 id="UserVisibleChanges5">User-Visible Changes</h3>
<ul>
<li><span class="label label-info">Modified</span> When exporting a diagram as an image, it is now possible to choose an image size level. Before this, a preference called
<em>AutoScale</em> was available and when it was enable, the diagram was scaled to the maximum size safely allowed by the system. Now, a new preference named
@@ -1055,7 +1083,7 @@
</ul>
<p>testcase.</p>
<h2 id="sirius5.1.0">Changes in Sirius 5.1.0</h2>
- <h3 id="UserVisibleChanges5">User-Visible Changes</h3>
+ <h3 id="UserVisibleChanges6">User-Visible Changes</h3>
<ul>
<li><span class="label label-success">Added</span> When exporting a diagram as an image, it is now possible to choose whether or not the diagram should be scaled. If disabled, the diagram will be exported with its normal size (equivalent to a 100% zoom level). If auto-scaling is enabled, the diagram will be scaled to the maximum size safely allowed by the system (this can be different on different OSes). Note that when auto-scaling is enabled, the image files produced may be larger than without. When exporting very large diagrams it is also possible that the diagram will be scaled
<em>down</em> (i.e. with a zoom level smaller than 100%). Enabling auto-scaling can be chosen on a case by case basis from the export dialog; the initial value in the dialog can be controlled by a new preference available in the
diff --git a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile
index fd3159486d..03f498ce58 100644
--- a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile
+++ b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile
@@ -6,6 +6,10 @@ This document contains the release notes for recent major releases of Sirius. Se
h2(#sirius6.2.0). Changes in Sirius 6.2.0
+h3. User-Visible Changes
+
+* <span class="label label-success">Added</span> On sequence diagrams, it is now possible to remove vertical blank spaces on standard edition mode by dragging the mouse from bottom to top anywhere in the canvas with the Ctrl+Shift keys pressed. This "feature":user/sequences/Sequence%20Diagrams.html#remove_vertical_blank_space was here since version 6.0.0 but was only accessible through the ruler.
+
h3. Developer-Visible Changes
h4. Changes in @org.eclipse.sirius@
@@ -21,6 +25,7 @@ h4. Changes in @org.eclipse.sirius.diagram@
* <span class="label label-info">Added</span> The extension point org.eclipse.sirius.diagram.customBundledImageShape has been created in order to provide custom shape to the bundled image style. This extension point offers more flexibility on the specification of the svg tags and attributes holding the color, border color and border size information than the extension point org.eclipse.sirius.diagram.bundledImageShape.
* <span class="label label-info">Modified</span> The extension point org.eclipse.sirius.diagram.bundledImageShape has been marked as deprecated. Shapes provided by this extension point still work.
+* <span class="label label-info">Modified</span> The method @org.eclipse.sirius.diagram.tools.api.command.IDiagramCommandFactory.buildInsertVerticalBlankSpaceCommand(DDiagram, int, int)@ has been renamed to @org.eclipse.sirius.diagram.tools.api.command.IDiagramCommandFactory.buildInsertOrRemoveVerticalBlankSpaceCommand(DDiagram, int, int)@ because it handles now both addition and removal.
* <span class="label label-info">Modified</span> Method _getAllEdgeMappings_ defined in @org.eclipse.sirius.diagram.business.internal.metamodel.helper.ContentHelper@ has been moved in a new class called @org.eclipse.sirius.diagram.business.internal.metamodel.helper.ContentLayerHelper@ to ensure method to be independent from pure Sirius code.
* <span class="label label-danger">Removed</span> EOperations and features have been removed from the metamodel @diagram.ecore@. This is the ones that are computed outside of EMF environment with dependencies to IInterpreter or that are deprecated. The following EOperations have been removed/replaced:
** @DEdge.isRootFolding@ has been removed
@@ -66,6 +71,12 @@ h4. Changes in @org.eclipse.sirius.ui.editor@
* <span class="label label-info">Modified</span> The method @org.eclipse.sirius.ui.editor.api.pages.PageProvider.provides()@ now takes the @SessionEditor@ as an additional parameter to allow implementation to decide if it should provide an additional page or not.
+h4. Changes in @org.eclipse.sirius.diagram.sequence@
+
+* <span class="label label-success">Added</span> A new translatable message @org.eclipse.sirius.diagram.sequence.Messages.VerticalSpaceReduction_operationName@ has been added. It's key is @VerticalSpaceReduction_operationName@ and its default value is @Auto-reduction of {0}@. It is used when reducing spaces in sequence diagram.
+* <span class="label label-success">Added</span> A new translatable message @org.eclipse.sirius.diagram.ui.provider.Messages.RemoveBlankSpace_cmdName@ has been added. It's key is @RemoveBlankSpace_cmdName@ and its default value is @Remove blank space@. It is used when removing spaces in sequence diagram.
+
+
h2(#sirius6.1.2). Changes in Sirius 6.1.2
h3. User-Visible Changes
diff --git a/plugins/org.eclipse.sirius.doc/doc/user/sequences/Sequence Diagrams.html b/plugins/org.eclipse.sirius.doc/doc/user/sequences/Sequence Diagrams.html
index 154cdf0fa5..9935c87daa 100644
--- a/plugins/org.eclipse.sirius.doc/doc/user/sequences/Sequence Diagrams.html
+++ b/plugins/org.eclipse.sirius.doc/doc/user/sequences/Sequence Diagrams.html
@@ -28,6 +28,9 @@
<li>
<a href="#insert_vertical_blank_space">Manually insert vertical blank space</a>
</li>
+ <li>
+ <a href="#remove_vertical_blank_space">Manually remove vertical blank space</a>
+ </li>
</ol>
</li>
<li>
@@ -144,7 +147,7 @@
<p>It is also possible to manually insert vertical blank space to facilitate the organization of messages or to add new events in a sequence diagram. </p>
<p>This feature is available in two different contexts: </p>
<ul>
- <li>on the vertical ruler by dragging the mouse with the Ctrl key pressed.</li>
+ <li>on the vertical ruler by dragging the mouse from top to bottom with the Ctrl key pressed.</li>
</ul>
<p>Below, an example where user inserts blank space before message m3:
<br/>
@@ -155,7 +158,24 @@
<a href="../diagrams/Diagrams.html#RulersGrid">Rulers &amp; Grid</a> chapter.
</p>
<ul>
- <li>on standard edition mode by dragging the mouse anywhere in the canvas with the Ctrl+Shift keys pressed.</li>
+ <li>on standard edition mode by dragging the mouse from top to bottom anywhere in the canvas with the Ctrl+Shift keys pressed.</li>
+ </ul>
+ <h3 id="remove_vertical_blank_space">Manually remove vertical blank space</h3>
+ <p>It is also possible to manually remove vertical blank space to facilitate the organization of messages. </p>
+ <p>This feature is available in two different contexts: </p>
+ <ul>
+ <li>on the vertical ruler by dragging the mouse from bottom to top with the Ctrl key pressed.</li>
+ </ul>
+ <p>Below, an example where user removes blank space before message m3:
+ <br/>
+ <img alt="Example where user removes blank space in message m7" title="Example where user removes blank space in message m7" border="0" src="images/remove_vertical_blank_space.png"/>
+ </p>
+ <p>To show ruler, you need to check the option
+ <em>Show Ruler</em> as explained in
+ <a href="../diagrams/Diagrams.html#RulersGrid">Rulers &amp; Grid</a> chapter.
+ </p>
+ <ul>
+ <li>on standard edition mode by dragging the mouse from bottom to top anywhere in the canvas with the Ctrl+Shift keys pressed.</li>
</ul>
<h2 id="elements">Sequence Diagram Elements</h2>
<p>This section presents each type of elements specific to sequence diagrams which are supported by Sirius, and their specificities (if any). Note that not all sequence diagrams will support all kinds of elements; this depends on the diagram&#8217;s configuration.</p>
diff --git a/plugins/org.eclipse.sirius.doc/doc/user/sequences/Sequence Diagrams.textile b/plugins/org.eclipse.sirius.doc/doc/user/sequences/Sequence Diagrams.textile
index 7563477b6a..f20d0373d9 100644
--- a/plugins/org.eclipse.sirius.doc/doc/user/sequences/Sequence Diagrams.textile
+++ b/plugins/org.eclipse.sirius.doc/doc/user/sequences/Sequence Diagrams.textile
@@ -49,13 +49,27 @@ It is also possible to manually insert vertical blank space to facilitate the or
This feature is available in two different contexts:
-* on the vertical ruler by dragging the mouse with the Ctrl key pressed.
+* on the vertical ruler by dragging the mouse from top to bottom with the Ctrl key pressed.
Below, an example where user inserts blank space before message m3:
!images/insert_vertical_blank_space.png(Example where user inserts blank space before message m3)!
To show ruler, you need to check the option _Show Ruler_ as explained in "Rulers & Grid":../diagrams/Diagrams.html#RulersGrid chapter.
-* on standard edition mode by dragging the mouse anywhere in the canvas with the Ctrl+Shift keys pressed.
+* on standard edition mode by dragging the mouse from top to bottom anywhere in the canvas with the Ctrl+Shift keys pressed.
+
+h3(#remove_vertical_blank_space). Manually remove vertical blank space
+
+It is also possible to manually remove vertical blank space to facilitate the organization of messages.
+
+This feature is available in two different contexts:
+
+* on the vertical ruler by dragging the mouse from bottom to top with the Ctrl key pressed.
+Below, an example where user removes blank space before message m3:
+!images/remove_vertical_blank_space.png(Example where user removes blank space in message m7)!
+
+To show ruler, you need to check the option _Show Ruler_ as explained in "Rulers & Grid":../diagrams/Diagrams.html#RulersGrid chapter.
+
+* on standard edition mode by dragging the mouse from bottom to top anywhere in the canvas with the Ctrl+Shift keys pressed.
h2(#elements). Sequence Diagram Elements
diff --git a/plugins/org.eclipse.sirius.doc/doc/user/sequences/images/remove_vertical_blank_space.png b/plugins/org.eclipse.sirius.doc/doc/user/sequences/images/remove_vertical_blank_space.png
new file mode 100644
index 0000000000..830880b95d
--- /dev/null
+++ b/plugins/org.eclipse.sirius.doc/doc/user/sequences/images/remove_vertical_blank_space.png
Binary files differ
diff --git a/plugins/org.eclipse.sirius.ui.debug/src/org/eclipse/sirius/ui/debug/SiriusDebugView.java b/plugins/org.eclipse.sirius.ui.debug/src/org/eclipse/sirius/ui/debug/SiriusDebugView.java
index 036f9dfce3..4b7439dd13 100644
--- a/plugins/org.eclipse.sirius.ui.debug/src/org/eclipse/sirius/ui/debug/SiriusDebugView.java
+++ b/plugins/org.eclipse.sirius.ui.debug/src/org/eclipse/sirius/ui/debug/SiriusDebugView.java
@@ -108,7 +108,7 @@ import org.eclipse.sirius.diagram.sequence.business.internal.elements.ISequenceE
import org.eclipse.sirius.diagram.sequence.business.internal.elements.ISequenceElementAccessor;
import org.eclipse.sirius.diagram.sequence.business.internal.elements.ISequenceEvent;
import org.eclipse.sirius.diagram.sequence.business.internal.elements.Lifeline;
-import org.eclipse.sirius.diagram.sequence.business.internal.operation.VerticalSpaceExpansion;
+import org.eclipse.sirius.diagram.sequence.business.internal.operation.VerticalSpaceExpansionOrReduction;
import org.eclipse.sirius.diagram.sequence.ordering.EventEnd;
import org.eclipse.sirius.diagram.sequence.ui.tool.api.SequenceDiagramLayout;
import org.eclipse.sirius.diagram.sequence.ui.tool.internal.edit.part.ISequenceEventEditPart;
@@ -1134,7 +1134,7 @@ public class SiriusDebugView extends AbstractDebugView {
final SequenceDiagramEditPart sdep = (SequenceDiagramEditPart) selection;
TransactionalEditingDomain ted = sdep.getEditingDomain();
RecordingCommand verticalSpaceExpansion = CommandFactory.createRecordingCommand(ted,
- new VerticalSpaceExpansion(sdep.getSequenceDiagram(), new Range(start, start + size), 0, Collections.<ISequenceEvent> emptyList()));
+ new VerticalSpaceExpansionOrReduction(sdep.getSequenceDiagram(), new Range(start, start + size), 0, Collections.<ISequenceEvent> emptyList()));
sdep.getEditingDomain().getCommandStack().execute(verticalSpaceExpansion);
}
});
@@ -1163,7 +1163,7 @@ public class SiriusDebugView extends AbstractDebugView {
final SequenceDiagramEditPart sdep = (SequenceDiagramEditPart) selection;
TransactionalEditingDomain ted = sdep.getEditingDomain();
RecordingCommand verticalSpaceExpansion = CommandFactory.createRecordingCommand(ted,
- new VerticalSpaceExpansion(sdep.getSequenceDiagram(), new Range(0, 0), 0, Lists.<ISequenceEvent> newArrayList()));
+ new VerticalSpaceExpansionOrReduction(sdep.getSequenceDiagram(), new Range(0, 0), 0, Lists.<ISequenceEvent> newArrayList()));
sdep.getEditingDomain().getCommandStack().execute(verticalSpaceExpansion);
}
});

Back to the top