diff options
author | Christian W. Damus | 2018-06-25 21:10:27 +0000 |
---|---|---|
committer | Remi Schnekenburger | 2018-07-05 14:18:30 +0000 |
commit | 8ba78ef5f3941027769e6c537f078d173177a979 (patch) | |
tree | f39500114f2c62038f329c89f807cc81f3895fc7 /plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse | |
parent | 5163156b2c88ede0d999db2f54181a417ec475a4 (diff) | |
download | org.eclipse.papyrus-8ba78ef5f3941027769e6c537f078d173177a979.tar.gz org.eclipse.papyrus-8ba78ef5f3941027769e6c537f078d173177a979.tar.xz org.eclipse.papyrus-8ba78ef5f3941027769e6c537f078d173177a979.zip |
Bug 507479: [SequenceDiagram] Choose lifelines covered by a combined
fragment
Implement properties view for the InteractionFragment::covered
property of combined fragments and interaction operands. Restrict
the selection of covered lifelines to lifelines in the same interaction.
Add warning constraints for consistency of lifelines covered by
- interaction operand as compared to lifelines covered by the
fragments that it owns
- combined fragment as compared to lifelines covered by fragments
of its operands
Update the automatic validation (if the preference is set) of an
interaction operand that has has its owned fragments recomputed to
encompass the entire containing combined fragment, to handle the
impact on its lifeline coverage consistency constraint.
Update headers & plugin version
Change-Id: I340c816a3d62b38b2e811daa90b4d5c0c1fb5493
Signed-off-by: Christian W. Damus <give.a.damus@gmail.com>
Diffstat (limited to 'plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse')
2 files changed, 39 insertions, 13 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/ComputeOwnerHelper.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/ComputeOwnerHelper.java index e85d91dee02..b26b92d07ca 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/ComputeOwnerHelper.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/ComputeOwnerHelper.java @@ -9,7 +9,7 @@ * Contributors: * CEA LIST - Initial API and implementation * Mickaƫl ADAM (ALL4TEC) mickael.adam@all4tec.net - Bug 525369 - * Christian W. Damus - bug 533679 + * Christian W. Damus - bugs 533679, 507479 *****************************************************************************/ package org.eclipse.papyrus.uml.diagram.sequence.referencialgrilling; @@ -29,6 +29,7 @@ import org.eclipse.gmf.runtime.notation.DecorationNode; import org.eclipse.papyrus.uml.diagram.sequence.part.UMLDiagramEditorPlugin; import org.eclipse.papyrus.uml.diagram.sequence.util.LogOptions; import org.eclipse.papyrus.uml.diagram.sequence.validation.AsyncValidateCommand; +import org.eclipse.uml2.uml.CombinedFragment; import org.eclipse.uml2.uml.Element; import org.eclipse.uml2.uml.ExecutionOccurrenceSpecification; import org.eclipse.uml2.uml.ExecutionSpecification; @@ -154,7 +155,14 @@ public class ComputeOwnerHelper implements IComputeOwnerHelper { existedFragments.addAll(interactionOperand.getFragments()); grid.execute(new SetCommand(domain, interactionOperand, UMLPackage.eINSTANCE.getInteractionOperand_Fragment(), existedFragments)); - AsyncValidateCommand.get(interactionOperand) + // Asynchronously re-validate the whole combined fragment in case of + // dependencies between operands and the check for consistency between + // lifeline coverage of the combined fragment as compared to the lifeline + // coverage of the fragments of its operands + Optional<CombinedFragment> cfrag = Optional.of(interactionOperand) + .map(Element::getOwner).filter(CombinedFragment.class::isInstance) + .map(CombinedFragment.class::cast); + cfrag.flatMap(AsyncValidateCommand::get) .ifPresent(grid::execute); } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/validation/AsyncValidateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/validation/AsyncValidateCommand.java index e85ba137ed2..f9cdfdbf06c 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/validation/AsyncValidateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/validation/AsyncValidateCommand.java @@ -19,6 +19,7 @@ import java.util.List; import java.util.Map; import java.util.Objects; import java.util.Optional; +import java.util.function.Supplier; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -38,11 +39,11 @@ import org.eclipse.papyrus.uml.diagram.sequence.command.AsynchronousCommand; import org.eclipse.papyrus.uml.diagram.sequence.part.UMLDiagramEditorPlugin; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; +import org.eclipse.uml2.uml.CombinedFragment; import org.eclipse.uml2.uml.ExecutionSpecification; import org.eclipse.uml2.uml.InteractionOperand; import org.eclipse.uml2.uml.Message; import org.eclipse.uml2.uml.MessageEnd; -import org.eclipse.uml2.uml.NamedElement; import org.eclipse.uml2.uml.OccurrenceSpecification; import org.eclipse.uml2.uml.util.UMLSwitch; @@ -71,8 +72,15 @@ public class AsyncValidateCommand extends AsynchronousCommand implements INonDir ValidateSubtreeCommand cmd = new UMLSwitch<ValidateSubtreeCommand>() { @Override + public ValidateSubtreeCommand caseCombinedFragment(CombinedFragment cfrag) { + return new ValidateCombinedFragmentCommand(cfrag, + () -> Stream.concat(messages(cfrag), nonOwnedExecutions(cfrag))); + } + + @Override public ValidateSubtreeCommand caseInteractionOperand(InteractionOperand operand) { - return new ValidateOperandCommand(operand); + return new ValidateCombinedFragmentCommand(operand, + () -> Stream.concat(messages(operand), nonOwnedExecutions(operand))); } @Override @@ -118,17 +126,27 @@ public class AsyncValidateCommand extends AsynchronousCommand implements INonDir .orElseGet(() -> findExecutionWith(occurrence, false)); } + static Stream<Message> messages(CombinedFragment cfrag) { + return cfrag.getOperands().stream().flatMap(AsyncValidateCommand::messages) + .distinct(); + } + + static Stream<ExecutionSpecification> nonOwnedExecutions(CombinedFragment cfrag) { + return cfrag.getOperands().stream().flatMap(AsyncValidateCommand::nonOwnedExecutions) + .distinct(); + } + // // Nested types // - private static class ValidateOperandCommand extends ValidateSubtreeCommand { - private final InteractionOperand operand; + private static class ValidateCombinedFragmentCommand extends ValidateSubtreeCommand { + private final Supplier<Stream<? extends EObject>> dependenciesSupplier; - ValidateOperandCommand(InteractionOperand operand) { - super(operand, new OperandDiagnostician()); + ValidateCombinedFragmentCommand(EObject root, Supplier<Stream<? extends EObject>> dependenciesSupplier) { + super(root, new OperandDiagnostician()); - this.operand = operand; + this.dependenciesSupplier = dependenciesSupplier; } @Override @@ -139,12 +157,12 @@ public class AsyncValidateCommand extends AsynchronousCommand implements INonDir // final Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); if (resource != null) { if (validateElement != null) { - // In an interaction operand, we validate also the messages and execution - // specifications that are at least partially within it. We have to be + // In a combined fragment or an interaction operand, we validate also the + // messages and execution specifications (provided generically as "dependencies") + // that are at least partially within some operand in scope. We have to be // careful about also removing existing markers for these related elements // because the Diagnostician isn't responsible for that - List<NamedElement> others = Stream.concat(messages(operand), nonOwnedExecutions(operand)) - .collect(Collectors.toList()); + List<? extends EObject> others = dependenciesSupplier.get().collect(Collectors.toList()); int markersToCreate = diagnostic.getChildren().size(); SubMonitor sub = SubMonitor.convert(monitor, 1 + others.size() + markersToCreate); |