Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse')
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/LifelineVerticalLabelCellEditorLocator.java6
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/Messages.java86
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/OperationForbiddenException.java1
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/AbstractChangeLifelineTypeCommand.java12
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/AddOccurrenceSpecificationInCompactLifelineCommand.java39
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/CreateTickCommand.java22
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/CustomDurationConstraintCreateCommand.java14
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/CustomDurationObservationCreateCommand.java14
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/CustomGeneralOrderingCreateCommand.java10
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/CustomMessageCreateCommand.java46
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/CustomMessageReorientCommand.java32
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/CustomTimeConstraintCreateCommand.java12
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/CustomTimeObservationCreateCommand.java10
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/DeleteStateDefinitionCommand.java7
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/RefreshCommandForUndo.java1
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/SwitchLifelineCommand.java246
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/ToggleTimeRulerVisibility.java36
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/ValidateInteractionCommand.java8
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomCompactLifelineCompartmentEditPart.java65
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomCompactLifelineEditPartCN.java18
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomCompactLifelineTimeRulerCompartmentEditPartCN.java4
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomCompactStateInvariantEditPartCN.java9
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomCompactStateInvariantNameEditPart.java4
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomDestructionOccurrenceSpecificationEditPartCN.java1
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomDestructionOccurrenceSpecificationLabelEditPart.java3
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomDurationConstraintEditPart.java1
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomDurationObservationEditPart.java1
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomFreeTimeRulerCompartmentEditPart.java29
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomFreeTimingRulerEditPart.java16
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomFullLifelineEditPartCN.java18
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomFullLifelineStateDefinitionCompartmentEditPartCN.java13
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomFullLifelineTimeRulerCompartmentEditPartCN.java4
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomFullLifelineTimelineCompartmentEditPartCN.java98
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomFullStateInvariantEditPartCN.java28
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomFullStateInvariantVerticalLineEditPart.java3
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomGateEditPart.java1
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomGeneralOrderingEditPart.java1
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomInteractionCompartmentEditPartTN.java28
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomInteractionEditPartTN.java36
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomMessageFoundEditPart.java2
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomMessageLostEditPart.java2
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomMessageOccurrenceSpecificationEditPartCN.java1
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomMessageOccurrenceSpecificationLabelEditPart.java3
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomOccurrenceSpecificationEditPartCN.java1
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomOccurrenceSpecificationLabelEditPart.java3
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomStateDefinitionEditPart.java18
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomStateDefinitionLabelEditPart.java6
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomTickEditPart.java1
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomTimeConstraintEditPart.java1
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomTimeObservationEditPart.java1
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomTimeRulerCompartmentEditPartCN.java4
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomTimingDiagramEditPart.java7
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomUMLEditPartFactory.java7
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/AbstractTimelineLayoutPolicy.java245
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomCompactLifelineCompartmentItemSemanticEditPolicyCN.java16
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomCompactLifelineCompartmentLayoutEditPolicy.java68
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomCompactLifelineItemSemanticEditPolicyCN.java4
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomCompactStateInvariantItemSemanticEditPolicy.java10
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomDestructionOccurrenceSpecificationItemSemanticEditPolicy.java7
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomFullLifelineItemSemanticEditPolicyCN.java4
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomFullLifelineStateDefinitionCompartmentLayoutEditPolicy.java2
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomFullLifelineTimelineCompartmentItemSemanticEditPolicyCN.java16
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomFullStateInvariantItemSemanticEditPolicy.java10
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomGateItemSemanticEditPolicy.java7
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomInteractionCompartmentCreationEditPolicy.java28
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomInteractionCompartmentItemSemanticEditPolicy.java6
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomInteractionCreationEditPolicy.java21
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomLifelineCompartmentGraphicalNodeEditPolicy.java31
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomLifelineNameEditPolicy.java11
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomMessageOccurrenceSpecificationItemSemanticEditPolicy.java11
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomOccurrenceSpecificationItemSemanticEditPolicy.java9
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomTimelineCompartmentLayoutEditPolicy.java129
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomTimingDiagramCreationEditPolicy.java8
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/ExternalLabelPrimaryDragRoleEditPolicy.java9
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/FirstEventRefreshEditPolicy.java19
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/GenericListCompartmentLayoutEditPolicy.java47
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/LayoutEditPolicyForLabel.java6
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/SelectionOnlyLayoutEditPolicy.java1
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/TimeRulerVisibilityRefreshEditPolicy.java18
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/TimingDiagramDragDropEditPolicy.java140
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/AbstractMessageFigure.java23
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/CompactLifelineFigure.java16
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/CompactStateFigure.java48
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/CustomInteractionRectangleFigure.java3
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/EllipseDecoration.java4
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/FullLifelineFigure.java30
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/GeneralOrderingHorizontalFigure.java6
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/InvisibleRectangleFigure.java4
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/LifelineFigure.java20
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/LifelineVerticalLabel.java7
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/MessageDeleteFigure.java1
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/MessageSyncFigure.java1
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/SmallSquareFigure.java1
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/StateDefinitionFigure.java2
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/TimeRulerFigure.java1
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/VerticalLabel.java30
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/VerticalMarkFigure.java1
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/helper/TimingDiagramLinkMappingHelper.java2
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/helper/advice/DefaultTypeHelperAdvice.java10
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/helper/advice/GateHelperAdvice.java10
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/helper/advice/OccurrenceSpecificationHelperAdvice.java12
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/helper/advice/StateInvariantHelperAdvice.java10
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/layouts/FillLayout.java9
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/layouts/TimeRulerLayout.java2
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parsers/CompactStateInvariantNameParser.java22
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parsers/ConstraintParser.java63
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parsers/OccurrenceSpecificationNameParser.java15
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parsers/StateDefinitionParser.java21
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/AbstractTwoPointCreationTool.java51
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/CustomPaletteFactory.java96
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/DestructionOccurrenceSpecificationCreationTool.java11
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/DurationCreationTool.java6
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/FloatingMessageAnchor.java6
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/GeneralOrderingCreationTool.java2
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/OccurrenceSpecificationCreationTool.java8
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/PropertyDiagramUpdater.java64
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/SpecificTypeCreationTool.java26
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/providers/CustomEditPolicyProvider.java16
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/providers/StereotypePropertiesEditPartProvider.java10
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/Constants.java5
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/DropUtils.java114
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/EcoreUtils.java55
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/EditPartUtils.java40
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/FigureUtils.java39
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/GateUtils.java7
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/GeneralOrderingUtils.java14
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/InteractionUtils.java8
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/LifelineUtils.java79
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/MessageUtils.java108
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/ModelValidationUtils.java89
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/OccurrenceSpecificationUtils.java175
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/RequestUtils.java23
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/StateDefinitionUtils.java84
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/StateInvariantUtils.java162
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/TickUtils.java53
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/TimeElementUtils.java26
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/TimeRulerUtils.java45
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/Utils.java50
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/ViewUtils.java83
139 files changed, 1973 insertions, 1879 deletions
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/LifelineVerticalLabelCellEditorLocator.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/LifelineVerticalLabelCellEditorLocator.java
index fc2ae319a2a..77599c26567 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/LifelineVerticalLabelCellEditorLocator.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/LifelineVerticalLabelCellEditorLocator.java
@@ -28,16 +28,16 @@ public class LifelineVerticalLabelCellEditorLocator implements CellEditorLocator
}
public void relocate(final CellEditor celleditor) {
- final Text text = (Text) celleditor.getControl();
+ final Text text = (Text)celleditor.getControl();
// position the cell editor at the top of the vertical text
final Rectangle rect = this.figure.getBounds().getCopy();
rect.y -= text.getBounds().height + 5;
this.figure.translateToAbsolute(rect);
- if (!text.getFont().isDisposed()) {
+ if(!text.getFont().isDisposed()) {
final int avr = FigureUtilities.getFontMetrics(text.getFont()).getAverageCharWidth();
rect.setSize(new Dimension(text.computeSize(SWT.DEFAULT, SWT.DEFAULT)).expand(avr * 2, 0));
}
- if (!rect.equals(new Rectangle(text.getBounds()))) {
+ if(!rect.equals(new Rectangle(text.getBounds()))) {
text.setBounds(rect.x, rect.y, rect.width, rect.height);
}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/Messages.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/Messages.java
index b434f971936..9f03e2f79a9 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/Messages.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/Messages.java
@@ -13,91 +13,177 @@ package org.eclipse.papyrus.uml.diagram.timing.custom;
import org.eclipse.osgi.util.NLS;
public class Messages extends NLS {
+
private static final String BUNDLE_NAME = "org.eclipse.papyrus.uml.diagram.timing.custom.messages"; //$NON-NLS-1$
+
public static String AbstractTimelineLayoutPolicy_MoveOccurrenceSpecification;
+
public static String AbstractTimelineLayoutPolicy_UpdateLocationOfTimeElements;
+
public static String AddOccurrenceSpecificationInCompactLifelineCommand_CreateOccurrenceSpecification;
+
public static String ChangeLifelineFromCompactToFull_commandLabel;
+
public static String ChangeLifelineFromFullToCompact_commandLabel;
+
public static String CompactStateInvariantNameParser_SetStateInvariantName;
+
public static String CompactStateInvariantNameParser_Unnamed;
+
public static String CustomCompactLifelifeCompactStateInvariantCreationEditPolicy_CreateStateInvariant;
+
public static String CustomCompactLifelifeCompactStateInvariantCreationEditPolicy_InitializeStateInvariant;
+
public static String CustomCompactLifelineCompartmentLayoutEditPolicy_MoveElement;
+
public static String CustomCompactLifelineCompartmentLayoutEditPolicy_MoveOccurrenceSpecification;
+
public static String CustomCompactLifelineCompartmentLayoutEditPolicy_ResizeStateInvariant;
+
public static String CustomCompactStateInvariantEditPartCN_CreateOccurrenceSpecification;
+
public static String CustomFullLifelineStateDefinitionCompartmentCreationEditPolicy_CreateStateDefinition;
+
public static String CustomFullLifelineStateDefinitionCompartmentCreationEditPolicy_InitializeStateDefinition;
+
public static String CustomFullLifelineStateDefinitionCompartmentEditPartCN_AddStateDefinitionsHere;
+
public static String CustomFullStateInvariantEditPartCN_CreateOccurrenceSpecification;
+
public static String hideStateInvariant;
+
public static String CustomInteractionCompartmentCreationEditPolicy_CreateCompactLifeline;
+
public static String CustomInteractionCompartmentCreationEditPolicy_CreateFullLifeline;
+
public static String CustomInteractionCreationEditPolicy_CreateGate;
+
public static String CustomInteractionCreationEditPolicy_PositionGate;
+
public static String CustomLifelineCompartmentGraphicalNodeEditPolicy_SetMessageFoundSourceLocation;
+
public static String CustomLifelineCompartmentGraphicalNodeEditPolicy_SetMessageLostTargetLocation;
+
public static String OccurrenceSpecificationUtils_DestroyOccurrenceSpecification;
+
public static String OccurrenceSpecificationUtils_HideOccurrenceSpecification;
+
public static String LifelineUtils_CreationOccurrence;
+
public static String LifelineUtils_DestructionOccurrence;
+
public static String LifelineUtils_UpdateFragmentNames;
+
public static String LifelineUtils_UpdateLifelineFragmentNames;
+
public static String CustomPaletteFactory_SetFoundMessageTarget;
+
public static String CustomPaletteFactory_SetLostMessageOrigin;
+
public static String CustomStateDefinitionEditPart_DeleteStateDefinition;
+
public static String CustomTimelineCompartmentLayoutEditPolicy_MoveOccurrenceSpecification;
+
public static String CustomTimelineCompartmentLayoutEditPolicy_MoveStateInvariant;
+
public static String CustomTimelineCompartmentLayoutEditPolicy_MoveVerticalLine;
+
public static String CustomTimelineCompartmentLayoutEditPolicy_UpdateStateInvariant;
+
public static String CutAndInsertOccurrenceSpecificationCommand_CreateOccurrenceSpecification;
+
public static String CutAndInsertOccurrenceSpecificationCompactLifelineCommand_CreateOccurrenceSpecification;
+
public static String DeleteStateDefinitionCommand_DeleteStateDefinition;
+
public static String DestructionOccurrenceSpecificationCreationTool_CreateDestructionOccurrenceSpecification;
+
public static String DropUtils_DropElement;
+
public static String DropUtils_DropGate;
+
public static String DurationCreationTool_ClickEndElement;
+
public static String DurationCreationTool_ClickStartElement;
+
public static String ModelValidationUtils_CoveredByFragmentsWereReOrdered;
+
public static String ModelValidationUtils_FragmentsFoundAfterDestructionOccurrenceSpecification;
+
public static String ModelValidationUtils_FragmentsRemovedAfterDestructionOccurrenceSpecification;
+
public static String ModelValidationUtils_MissingOccurrenceSpecificationAdded;
+
public static String ModelValidationUtils_MissingOccurrenceSpecificationFound;
+
public static String ModelValidationUtils_ModelValidation;
+
public static String OccurrenceSpecificationCreationTool_CreateOccurrenceSpecification;
+
public static String OccurrenceSpecificationHelperAdvice_DestroyOccurrenceSpecification;
+
public static String OccurrenceSpecificationNameParser_SetOccurrenceSpecificationName;
+
public static String StateDefinitionParser_SetStateDefinitionName;
+
public static String StateDefinitionParser_Unnamed;
+
public static String StateDefinitionUtils_State;
+
public static String StateInvariantHelperAdvice_DestroyStateInvariant;
+
public static String SwitchLifelineCommand_createLifelineFragments;
+
public static String SwitchLifelineCommand_CreateLinkedElements;
+
public static String SwitchLifelineCommand_CreateTimeRuler;
+
public static String SwitchLifelineCommand_createMessages;
+
public static String SwitchLifelineCommand_createStateDefinitions;
+
public static String SwitchLifelineCommand_NameUnnamedStateInvariants;
+
public static String SwitchLifelineCommand_ReAssociateTicks;
+
public static String SwitchLifelineCommand_switchLifeline;
+
public static String SwitchLifelineCommand_unnamed;
+
public static String CreateTickCommand_attachTick;
+
public static String CreateTickCommand_CreateTick;
+
public static String ConstraintParser_SetConstraint;
+
public static String GateHelperAdvice_DestroyGate;
+
public static String GeneralOrderingCreationTool_ClickAfter;
+
public static String GeneralOrderingCreationTool_ClickBefore;
+
public static String TimingDiagramDragDropEditPolicy_Drop;
+
public static String TimingDiagramDragDropEditPolicy_DropLifeline;
+
public static String TimingDiagramDragDropEditPolicy_DropLifelineFragments;
+
public static String TimingDiagramDragDropEditPolicy_DropMessage;
+
public static String TimingDiagramDragDropEditPolicy_DropStateDefinitions;
+
public static String ToggleTimeRulerVisibility_ToggleTimeRulerVisibility;
+
public static String UmlTimingDiagramForMultiEditor_editorOpeningErrorMessage;
+
public static String UmlTimingDiagramForMultiEditor_editorOpeningErrorTitle;
+
public static String ValidateInteractionCommand_ValidateInteraction;
+
public static String ViewUtils_MoveView;
+
public static String CustomTimeRulerCreationEditPolicy_CreateFreeTimeRuler;
+
public static String CustomTimingDiagramCreationEditPolicy_CreateInteraction;
static {
// initialize resource bundle
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/OperationForbiddenException.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/OperationForbiddenException.java
index 40c36fd4a13..8d5c9eddacf 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/OperationForbiddenException.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/OperationForbiddenException.java
@@ -10,6 +10,7 @@ package org.eclipse.papyrus.uml.diagram.timing.custom;
/** An exception indicating that the operation that was asked should not be performed, as it is not allowed. */
public class OperationForbiddenException extends Exception {
+
private static final long serialVersionUID = -4972361328078373414L;
public OperationForbiddenException() {
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/AbstractChangeLifelineTypeCommand.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/AbstractChangeLifelineTypeCommand.java
index 0279a88cf7e..45000ab0f89 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/AbstractChangeLifelineTypeCommand.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/AbstractChangeLifelineTypeCommand.java
@@ -37,9 +37,9 @@ public abstract class AbstractChangeLifelineTypeCommand extends AbstractTransact
* Constructor of this command
*
* @param domain
- * the transactional editing domain to execute the transaction
+ * the transactional editing domain to execute the transaction
* @param lifelineEditPart
- * the editpart that will be transformed
+ * the editpart that will be transformed
* @param changeLifelineFromCompactToFull_commandLabel
*/
public AbstractChangeLifelineTypeCommand(final TransactionalEditingDomain domain, final IGraphicalEditPart lifelineEditPart, final String commandLabel) {
@@ -52,15 +52,15 @@ public abstract class AbstractChangeLifelineTypeCommand extends AbstractTransact
final EditPart parentEditPart = this.lifelineEditPart.getParent();
// creation of the node
final UMLViewProvider umlViewProvider = new UMLViewProvider();
- final Lifeline lifeline = (Lifeline) this.lifelineEditPart.resolveSemanticElement();
+ final Lifeline lifeline = (Lifeline)this.lifelineEditPart.resolveSemanticElement();
final View view = this.lifelineEditPart.getNotationView();
- final View containerView = (View) view.eContainer();
+ final View containerView = (View)view.eContainer();
final int index = containerView.getChildren().indexOf(view);
final Node lifelineNode = createTargetLifelineView(umlViewProvider, lifeline, containerView, index);
- lifelineNode.setLayoutConstraint(((Node) this.lifelineEditPart.getNotationView()).getLayoutConstraint());
+ lifelineNode.setLayoutConstraint(((Node)this.lifelineEditPart.getNotationView()).getLayoutConstraint());
// copy all EAnnotations
final Iterator<EAnnotation> iter = this.lifelineEditPart.getNotationView().getEAnnotations().iterator();
- while (iter.hasNext()) {
+ while(iter.hasNext()) {
final EAnnotation annotation = EcoreUtil.copy(iter.next());
lifelineNode.getEAnnotations().add(annotation);
}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/AddOccurrenceSpecificationInCompactLifelineCommand.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/AddOccurrenceSpecificationInCompactLifelineCommand.java
index 2db0f492767..5ffe7ffd3fd 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/AddOccurrenceSpecificationInCompactLifelineCommand.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/AddOccurrenceSpecificationInCompactLifelineCommand.java
@@ -36,39 +36,40 @@ import org.eclipse.uml2.uml.UMLFactory;
/** This command adds an OccurrenceSpecification at a given Location. */
public class AddOccurrenceSpecificationInCompactLifelineCommand extends AbstractTransactionalCommand {
+
private final CompactStateInvariantEditPartCN compactStateInvariantEditPartCN;
+
private final Point location;
+
private final CompactLifelineEditPartCN lifelineEditPart;
+
private final Lifeline lifeline;
/**
* @param fullStateInvariantEditPartCN
- * the state invariant on top of which to put the OccurrenceSpecification
+ * the state invariant on top of which to put the OccurrenceSpecification
* @param location
- * where the user clicked: the horizontal coordinate indicates where to insert the
- * OccurrenceSpecification
+ * where the user clicked: the horizontal coordinate indicates where to insert the
+ * OccurrenceSpecification
*/
public AddOccurrenceSpecificationInCompactLifelineCommand(final CompactStateInvariantEditPartCN compactStateInvariantEditPartCN, final Point location) {
- super(getEditingDomain(compactStateInvariantEditPartCN), Messages.AddOccurrenceSpecificationInCompactLifelineCommand_CreateOccurrenceSpecification,
- null);
+ super(getEditingDomain(compactStateInvariantEditPartCN), Messages.AddOccurrenceSpecificationInCompactLifelineCommand_CreateOccurrenceSpecification, null);
this.compactStateInvariantEditPartCN = compactStateInvariantEditPartCN;
this.location = location;
- this.lifelineEditPart = (CompactLifelineEditPartCN) EditPartUtils.findParentEditPartWithId(this.compactStateInvariantEditPartCN,
- CompactLifelineEditPartCN.VISUAL_ID);
- this.lifeline = (Lifeline) ((View) this.lifelineEditPart.getModel()).getElement();
+ this.lifelineEditPart = (CompactLifelineEditPartCN)EditPartUtils.findParentEditPartWithId(this.compactStateInvariantEditPartCN, CompactLifelineEditPartCN.VISUAL_ID);
+ this.lifeline = (Lifeline)((View)this.lifelineEditPart.getModel()).getElement();
}
private static TransactionalEditingDomain getEditingDomain(final CompactStateInvariantEditPartCN compactStateInvariantEditPart) {
- final StateInvariant stateInvariant = (StateInvariant) ((View) compactStateInvariantEditPart.getModel()).getElement();
+ final StateInvariant stateInvariant = (StateInvariant)((View)compactStateInvariantEditPart.getModel()).getElement();
return TransactionUtil.getEditingDomain(stateInvariant);
}
@Override
protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
- final CompactLifelineCompartmentEditPartCN timelineCompartmentEditPart = (CompactLifelineCompartmentEditPartCN) EditPartUtils
- .findFirstChildEditPartWithId(this.lifelineEditPart, CompactLifelineCompartmentEditPartCN.VISUAL_ID);
+ final CompactLifelineCompartmentEditPartCN timelineCompartmentEditPart = (CompactLifelineCompartmentEditPartCN)EditPartUtils.findFirstChildEditPartWithId(this.lifelineEditPart, CompactLifelineCompartmentEditPartCN.VISUAL_ID);
- final View timelineCompartmentView = (View) timelineCompartmentEditPart.getModel();
+ final View timelineCompartmentView = (View)timelineCompartmentEditPart.getModel();
// translate the coordinates
final Point pt = new Point(this.location);
@@ -76,12 +77,11 @@ public class AddOccurrenceSpecificationInCompactLifelineCommand extends Abstract
pt.translate(timelineCompartmentEditPart.getFigure().getBounds().getTopLeft().getNegated());
// find where to insert the OccurrenceSpecification
- final int insertionIndexInCompartment = OccurrenceSpecificationUtils.findInsertionIndexFor(pt, timelineCompartmentView,
- timelineCompartmentEditPart.getViewer());
+ final int insertionIndexInCompartment = OccurrenceSpecificationUtils.findInsertionIndexFor(pt, timelineCompartmentView, timelineCompartmentEditPart.getViewer());
final int insertionIndexInFragments;
final int insertionIndexInCoveredBys;
- if (insertionIndexInCompartment < timelineCompartmentView.getChildren().size()) {
- final View view = (View) timelineCompartmentView.getChildren().get(insertionIndexInCompartment);
+ if(insertionIndexInCompartment < timelineCompartmentView.getChildren().size()) {
+ final View view = (View)timelineCompartmentView.getChildren().get(insertionIndexInCompartment);
final EObject element = view.getElement();
insertionIndexInFragments = this.lifeline.getInteraction().getFragments().indexOf(element);
insertionIndexInCoveredBys = this.lifeline.getCoveredBys().indexOf(element);
@@ -92,12 +92,12 @@ public class AddOccurrenceSpecificationInCompactLifelineCommand extends Abstract
// create the occurrence specification at the right index
final OccurrenceSpecification newOccurrenceSpecification = UMLFactory.eINSTANCE.createOccurrenceSpecification();
- if (insertionIndexInFragments == -1) {
+ if(insertionIndexInFragments == -1) {
this.lifeline.getInteraction().getFragments().add(newOccurrenceSpecification);
} else {
this.lifeline.getInteraction().getFragments().add(insertionIndexInFragments, newOccurrenceSpecification);
}
- if (insertionIndexInCoveredBys == -1) {
+ if(insertionIndexInCoveredBys == -1) {
this.lifeline.getCoveredBys().add(newOccurrenceSpecification);
} else {
this.lifeline.getCoveredBys().add(insertionIndexInCoveredBys, newOccurrenceSpecification);
@@ -106,8 +106,7 @@ public class AddOccurrenceSpecificationInCompactLifelineCommand extends Abstract
// create the View for the occurrence specification
final UMLViewProvider umlViewProvider = new UMLViewProvider();
- final Node occurrenceSpecificationView = umlViewProvider.createOccurrenceSpecification_12(newOccurrenceSpecification, timelineCompartmentView,
- insertionIndexInCompartment, true, PreferencesHint.USE_DEFAULTS);
+ final Node occurrenceSpecificationView = umlViewProvider.createOccurrenceSpecification_12(newOccurrenceSpecification, timelineCompartmentView, insertionIndexInCompartment, true, PreferencesHint.USE_DEFAULTS);
final Location loc = NotationFactory.eINSTANCE.createLocation();
loc.setX(pt.x);
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/CreateTickCommand.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/CreateTickCommand.java
index 074020c0e99..638957b0d83 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/CreateTickCommand.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/CreateTickCommand.java
@@ -45,12 +45,11 @@ public class CreateTickCommand extends GraphicalCommandHandler {
protected Command getCommand() throws ExecutionException {
final CompoundCommand cmd = new CompoundCommand(Messages.CreateTickCommand_attachTick);
final ISelection selection = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService().getSelection();
- if (!selection.isEmpty() && selection instanceof IStructuredSelection) {
- final IStructuredSelection structSelection = (IStructuredSelection) selection;
- for (final Object object : structSelection.toArray()) {
- if (object instanceof OccurrenceSpecificationEditPartCN || object instanceof MessageOccurrenceSpecificationEditPartCN
- || object instanceof DestructionOccurrenceSpecificationEditPartCN) {
- cmd.add(attachTick((GraphicalEditPart) object));
+ if(!selection.isEmpty() && selection instanceof IStructuredSelection) {
+ final IStructuredSelection structSelection = (IStructuredSelection)selection;
+ for(final Object object : structSelection.toArray()) {
+ if(object instanceof OccurrenceSpecificationEditPartCN || object instanceof MessageOccurrenceSpecificationEditPartCN || object instanceof DestructionOccurrenceSpecificationEditPartCN) {
+ cmd.add(attachTick((GraphicalEditPart)object));
}
}
}
@@ -59,21 +58,22 @@ public class CreateTickCommand extends GraphicalCommandHandler {
private static Command attachTick(final GraphicalEditPart osEditPart) {
final IGraphicalEditPart tickContainer = TimeRulerUtils.findClosestTimeRuler(osEditPart);
- if (tickContainer == null) {
+ if(tickContainer == null) {
Activator.log.error("No tick container found", new Exception()); //$NON-NLS-1$
return UnexecutableCommand.INSTANCE;
}
- final View tickContainerView = (View) tickContainer.getModel();
+ final View tickContainerView = (View)tickContainer.getModel();
final TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(osEditPart.getEditingDomain());
- final Node osView = (Node) osEditPart.getModel();
- final OccurrenceSpecification os = (OccurrenceSpecification) osView.getElement();
+ final Node osView = (Node)osEditPart.getModel();
+ final OccurrenceSpecification os = (OccurrenceSpecification)osView.getElement();
// if the Lifeline or Interaction compartment already contains a tick for this occurrence,
// then don't let a duplicate be created
- if (TickUtils.containsTickFor(tickContainerView, os)) {
+ if(TickUtils.containsTickFor(tickContainerView, os)) {
return UnexecutableCommand.INSTANCE;
}
final AbstractTransactionalCommand createTickCommand = new AbstractTransactionalCommand(editingDomain, Messages.CreateTickCommand_CreateTick, null) {
+
@Override
protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
final UMLViewProvider umlViewProvider = new UMLViewProvider();
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/CustomDurationConstraintCreateCommand.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/CustomDurationConstraintCreateCommand.java
index cc0d371d2ba..c7bb7f9abb5 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/CustomDurationConstraintCreateCommand.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/CustomDurationConstraintCreateCommand.java
@@ -39,23 +39,23 @@ public class CustomDurationConstraintCreateCommand extends EditElementCommand {
@Override
protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
- final CreateElementRequest request = (CreateElementRequest) getRequest();
- final EditPart firstTarget = (EditPart) request.getParameter(AbstractTwoPointCreationTool.FIRST_TARGET);
- final EditPart secondTarget = (EditPart) request.getParameter(AbstractTwoPointCreationTool.SECOND_TARGET);
+ final CreateElementRequest request = (CreateElementRequest)getRequest();
+ final EditPart firstTarget = (EditPart)request.getParameter(AbstractTwoPointCreationTool.FIRST_TARGET);
+ final EditPart secondTarget = (EditPart)request.getParameter(AbstractTwoPointCreationTool.SECOND_TARGET);
final DurationConstraint durationConstraint = UMLFactory.eINSTANCE.createDurationConstraint();
- final NamedElement firstTargetElement = (NamedElement) ((View) firstTarget.getModel()).getElement();
- final NamedElement secondTargetElement = (NamedElement) ((View) secondTarget.getModel()).getElement();
+ final NamedElement firstTargetElement = (NamedElement)((View)firstTarget.getModel()).getElement();
+ final NamedElement secondTargetElement = (NamedElement)((View)secondTarget.getModel()).getElement();
final Package containingPackage = EcoreUtils.getContaining(request.getContainer(), Package.class);
- if (containingPackage == null) {
+ if(containingPackage == null) {
return CommandResult.newErrorCommandResult("The container must be in a Package"); //$NON-NLS-1$
}
containingPackage.getPackagedElements().add(durationConstraint);
durationConstraint.getConstrainedElements().clear();
durationConstraint.getFirstEvents().clear();
- if (firstTargetElement == secondTargetElement) {
+ if(firstTargetElement == secondTargetElement) {
durationConstraint.getConstrainedElements().add(firstTargetElement);
} else {
durationConstraint.getConstrainedElements().add(firstTargetElement);
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/CustomDurationObservationCreateCommand.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/CustomDurationObservationCreateCommand.java
index 71812171bd3..ef85b9bd198 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/CustomDurationObservationCreateCommand.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/CustomDurationObservationCreateCommand.java
@@ -36,23 +36,23 @@ public class CustomDurationObservationCreateCommand extends EditElementCommand {
@Override
protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
- final CreateElementRequest request = (CreateElementRequest) getRequest();
- final EditPart firstTarget = (EditPart) request.getParameter(AbstractTwoPointCreationTool.FIRST_TARGET);
- final EditPart secondTarget = (EditPart) request.getParameter(AbstractTwoPointCreationTool.SECOND_TARGET);
+ final CreateElementRequest request = (CreateElementRequest)getRequest();
+ final EditPart firstTarget = (EditPart)request.getParameter(AbstractTwoPointCreationTool.FIRST_TARGET);
+ final EditPart secondTarget = (EditPart)request.getParameter(AbstractTwoPointCreationTool.SECOND_TARGET);
final DurationObservation durationObservation = UMLFactory.eINSTANCE.createDurationObservation();
- final NamedElement firstTargetElement = (NamedElement) ((View) firstTarget.getModel()).getElement();
- final NamedElement secondTargetElement = (NamedElement) ((View) secondTarget.getModel()).getElement();
+ final NamedElement firstTargetElement = (NamedElement)((View)firstTarget.getModel()).getElement();
+ final NamedElement secondTargetElement = (NamedElement)((View)secondTarget.getModel()).getElement();
final Package containingPackage = EcoreUtils.getContaining(request.getContainer(), Package.class);
- if (containingPackage == null) {
+ if(containingPackage == null) {
return CommandResult.newErrorCommandResult("The container must be in a Package"); //$NON-NLS-1$
}
containingPackage.getPackagedElements().add(durationObservation);
durationObservation.getEvents().clear();
durationObservation.getFirstEvents().clear();
- if (firstTargetElement == secondTargetElement) {
+ if(firstTargetElement == secondTargetElement) {
durationObservation.getEvents().add(firstTargetElement);
} else {
durationObservation.getEvents().add(firstTargetElement);
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/CustomGeneralOrderingCreateCommand.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/CustomGeneralOrderingCreateCommand.java
index 5c34f5e06ac..4a9dc0661dc 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/CustomGeneralOrderingCreateCommand.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/CustomGeneralOrderingCreateCommand.java
@@ -34,13 +34,13 @@ public class CustomGeneralOrderingCreateCommand extends EditElementCommand {
@Override
protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
- final CreateElementRequest request = (CreateElementRequest) getRequest();
- final EditPart firstTarget = (EditPart) request.getParameter(AbstractTwoPointCreationTool.FIRST_TARGET);
- final EditPart secondTarget = (EditPart) request.getParameter(AbstractTwoPointCreationTool.SECOND_TARGET);
+ final CreateElementRequest request = (CreateElementRequest)getRequest();
+ final EditPart firstTarget = (EditPart)request.getParameter(AbstractTwoPointCreationTool.FIRST_TARGET);
+ final EditPart secondTarget = (EditPart)request.getParameter(AbstractTwoPointCreationTool.SECOND_TARGET);
final GeneralOrdering generalOrdering = UMLFactory.eINSTANCE.createGeneralOrdering();
- final OccurrenceSpecification beforeOccurrence = (OccurrenceSpecification) ((View) firstTarget.getModel()).getElement();
- final OccurrenceSpecification afterOccurrence = (OccurrenceSpecification) ((View) secondTarget.getModel()).getElement();
+ final OccurrenceSpecification beforeOccurrence = (OccurrenceSpecification)((View)firstTarget.getModel()).getElement();
+ final OccurrenceSpecification afterOccurrence = (OccurrenceSpecification)((View)secondTarget.getModel()).getElement();
beforeOccurrence.getGeneralOrderings().add(generalOrdering);
generalOrdering.setBefore(beforeOccurrence);
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/CustomMessageCreateCommand.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/CustomMessageCreateCommand.java
index af6a8cd7782..567b3ebfe8b 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/CustomMessageCreateCommand.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/CustomMessageCreateCommand.java
@@ -37,9 +37,13 @@ import org.eclipse.uml2.uml.UMLFactory;
public class CustomMessageCreateCommand extends EditElementCommand {
private final Interaction interaction;
+
private final EObject source;
+
private final EObject target;
+
private final MessageKind messageKind;
+
private final MessageSort messageSort;
public CustomMessageCreateCommand(final CreateRelationshipRequest request) {
@@ -53,38 +57,38 @@ public class CustomMessageCreateCommand extends EditElementCommand {
@Override
public boolean canExecute() {
- if (this.source == null && this.target == null) {
+ if(this.source == null && this.target == null) {
return false;
}
// no create or destroy Message to a Gate
- if (this.target instanceof Gate && (this.messageSort == MessageSort.CREATE_MESSAGE_LITERAL || this.messageSort == MessageSort.DELETE_MESSAGE_LITERAL)) {
+ if(this.target instanceof Gate && (this.messageSort == MessageSort.CREATE_MESSAGE_LITERAL || this.messageSort == MessageSort.DELETE_MESSAGE_LITERAL)) {
return false;
}
// no create message can target a destruction
- if (this.messageSort == MessageSort.CREATE_MESSAGE_LITERAL && this.target instanceof DestructionOccurrenceSpecification) {
+ if(this.messageSort == MessageSort.CREATE_MESSAGE_LITERAL && this.target instanceof DestructionOccurrenceSpecification) {
return false;
}
- if (this.messageKind == MessageKind.FOUND_LITERAL) {
- if (this.source != null && !(this.source instanceof Lifeline)) {
+ if(this.messageKind == MessageKind.FOUND_LITERAL) {
+ if(this.source != null && !(this.source instanceof Lifeline)) {
return false;
}
- } else if (this.source != null && !(MessageUtils.isPotentialMessageEnd(this.source))) {
+ } else if(this.source != null && !(MessageUtils.isPotentialMessageEnd(this.source))) {
return false;
}
- if (this.messageKind == MessageKind.LOST_LITERAL) {
- if (this.target != null && !(this.target instanceof Lifeline)) {
+ if(this.messageKind == MessageKind.LOST_LITERAL) {
+ if(this.target != null && !(this.target instanceof Lifeline)) {
return false;
}
- } else if (this.target != null && !(MessageUtils.isPotentialMessageEnd(this.target))) {
+ } else if(this.target != null && !(MessageUtils.isPotentialMessageEnd(this.target))) {
return false;
}
- if (this.source == null) {
+ if(this.source == null) {
return true; // link creation is in progress; source is not defined yet
}
- if (this.interaction == null) {
+ if(this.interaction == null) {
return false;
}
return true;
@@ -92,28 +96,26 @@ public class CustomMessageCreateCommand extends EditElementCommand {
@Override
protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
- if (!canExecute()) {
+ if(!canExecute()) {
throw new ExecutionException("Invalid arguments in create link command"); //$NON-NLS-1$
}
final boolean destruction = this.messageSort == MessageSort.DELETE_MESSAGE_LITERAL;
final boolean creation = this.messageSort == MessageSort.CREATE_MESSAGE_LITERAL;
- if (destruction) {
- OccurrenceSpecificationUtils.deleteEverythingAfter((OccurrenceSpecification) this.target, null);
+ if(destruction) {
+ OccurrenceSpecificationUtils.deleteEverythingAfter((OccurrenceSpecification)this.target, null);
}
- if (creation) {
- OccurrenceSpecificationUtils.deleteEverythingBefore((OccurrenceSpecification) this.target, null);
+ if(creation) {
+ OccurrenceSpecificationUtils.deleteEverythingBefore((OccurrenceSpecification)this.target, null);
}
// a "found" message comes from nowhere
- final MessageEnd messageSource = this.messageKind == MessageKind.FOUND_LITERAL ? null : MessageUtils.convertToMessageOccurrenceSpecification(
- this.source, false);
+ final MessageEnd messageSource = this.messageKind == MessageKind.FOUND_LITERAL ? null : MessageUtils.convertToMessageOccurrenceSpecification(this.source, false);
// a "lost" message goes to nowhere
- final MessageEnd messageTarget = this.messageKind == MessageKind.LOST_LITERAL ? null : MessageUtils.convertToMessageOccurrenceSpecification(
- this.target, destruction);
+ final MessageEnd messageTarget = this.messageKind == MessageKind.LOST_LITERAL ? null : MessageUtils.convertToMessageOccurrenceSpecification(this.target, destruction);
- if (!MessageUtils.isValidMessage(this.messageSort, this.messageKind, messageSource, messageTarget)) {
+ if(!MessageUtils.isValidMessage(this.messageSort, this.messageKind, messageSource, messageTarget)) {
throw new ExecutionException("Invalid Message"); //$NON-NLS-1$
}
@@ -124,7 +126,7 @@ public class CustomMessageCreateCommand extends EditElementCommand {
newMessage.setMessageSort(this.messageSort);
newMessage.setName(""); //$NON-NLS-1$
- ((CreateElementRequest) getRequest()).setNewElement(newMessage);
+ ((CreateElementRequest)getRequest()).setNewElement(newMessage);
return CommandResult.newOKCommandResult(newMessage);
}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/CustomMessageReorientCommand.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/CustomMessageReorientCommand.java
index 3bcb15cdac6..27d6f58fc78 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/CustomMessageReorientCommand.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/CustomMessageReorientCommand.java
@@ -38,7 +38,9 @@ import org.eclipse.uml2.uml.OccurrenceSpecification;
public class CustomMessageReorientCommand extends EditElementCommand {
private final int reorientDirection;
+
private final EObject newEnd;
+
private final EditPartViewer viewer;
public CustomMessageReorientCommand(final ReorientRelationshipRequest request, final EditPartViewer viewer) {
@@ -50,14 +52,14 @@ public class CustomMessageReorientCommand extends EditElementCommand {
@Override
public boolean canExecute() {
- if (!(getElementToEdit() instanceof Message)) {
+ if(!(getElementToEdit() instanceof Message)) {
return false;
}
- final Message message = (Message) getElementToEdit();
+ final Message message = (Message)getElementToEdit();
final EObject source;
final EObject target;
- if (this.reorientDirection == ReorientRequest.REORIENT_SOURCE) {
+ if(this.reorientDirection == ReorientRequest.REORIENT_SOURCE) {
source = this.newEnd;
target = message.getReceiveEvent();
} else {
@@ -71,36 +73,36 @@ public class CustomMessageReorientCommand extends EditElementCommand {
@Override
protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
- if (!canExecute()) {
+ if(!canExecute()) {
throw new ExecutionException("Invalid arguments in reorient link command"); //$NON-NLS-1$
}
final boolean reorientSource = this.reorientDirection == ReorientRequest.REORIENT_SOURCE;
final boolean reorientTarget = this.reorientDirection == ReorientRequest.REORIENT_TARGET;
- final Message message = (Message) getElementToEdit();
+ final Message message = (Message)getElementToEdit();
final boolean destruction = reorientTarget && message.getMessageSort() == MessageSort.DELETE_MESSAGE_LITERAL;
final boolean creation = reorientTarget && message.getMessageSort() == MessageSort.CREATE_MESSAGE_LITERAL;
final MessageEnd newMessageEnd = MessageUtils.convertToMessageOccurrenceSpecification(this.newEnd, destruction);
- if (reorientSource) {
+ if(reorientSource) {
message.setSendEvent(newMessageEnd);
- } else if (reorientTarget) {
+ } else if(reorientTarget) {
message.setReceiveEvent(newMessageEnd);
}
- if (destruction || creation) {
+ if(destruction || creation) {
// save the parent View while the message is still in it
final Set<View> parentInteractionViews = findParentInteractionViews(newMessageEnd);
// destroying the old target of the message will also delete the Message View
- if (destruction) {
- OccurrenceSpecificationUtils.deleteEverythingAfter((OccurrenceSpecification) newMessageEnd, null);
+ if(destruction) {
+ OccurrenceSpecificationUtils.deleteEverythingAfter((OccurrenceSpecification)newMessageEnd, null);
}
- if (creation) {
- OccurrenceSpecificationUtils.deleteEverythingBefore((OccurrenceSpecification) newMessageEnd, null);
+ if(creation) {
+ OccurrenceSpecificationUtils.deleteEverythingBefore((OccurrenceSpecification)newMessageEnd, null);
}
// re-create the Message View that was deleted by GMF
- for (final View parentInteractionView : parentInteractionViews) {
+ for(final View parentInteractionView : parentInteractionViews) {
DropUtils.getDropMessageCommand(message, parentInteractionView, this.viewer).execute(new NullProgressMonitor(), null);
}
}
@@ -111,9 +113,9 @@ public class CustomMessageReorientCommand extends EditElementCommand {
private Set<View> findParentInteractionViews(final EObject eObject) {
final List<View> views = DiagramEditPartsUtil.findViews(eObject, this.viewer);
final Set<View> interactionViews = new HashSet<View>();
- for (final View view : views) {
+ for(final View view : views) {
final View interactionView = ViewUtils.findSuperViewWithId(view, InteractionEditPartTN.VISUAL_ID);
- if (interactionView != null) {
+ if(interactionView != null) {
interactionViews.add(interactionView);
}
}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/CustomTimeConstraintCreateCommand.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/CustomTimeConstraintCreateCommand.java
index c9a2785295e..1cce0cd04f0 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/CustomTimeConstraintCreateCommand.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/CustomTimeConstraintCreateCommand.java
@@ -41,18 +41,18 @@ public class CustomTimeConstraintCreateCommand extends EditElementCommand {
@Override
protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
final TimeConstraint timeConstraint = UMLFactory.eINSTANCE.createTimeConstraint();
- final CreateElementRequest request = (CreateElementRequest) getRequest();
- final EditPart originalTarget = (EditPart) request.getParameter(CustomPaletteFactory.ORIGINAL_TARGET);
- final NamedElement targetElement = (NamedElement) ((View) originalTarget.getModel()).getElement();
+ final CreateElementRequest request = (CreateElementRequest)getRequest();
+ final EditPart originalTarget = (EditPart)request.getParameter(CustomPaletteFactory.ORIGINAL_TARGET);
+ final NamedElement targetElement = (NamedElement)((View)originalTarget.getModel()).getElement();
// TODO: firstEvent depending on the click location relative to the originalTarget EditPart figure
final Package containingPackage = EcoreUtils.getContaining(request.getContainer(), Package.class);
- if (containingPackage == null) {
+ if(containingPackage == null) {
return CommandResult.newErrorCommandResult("The container must be in a Package"); //$NON-NLS-1$
}
final Interaction containingInteraction = EcoreUtils.getContaining(request.getContainer(), Interaction.class);
- if (containingInteraction == null) {
+ if(containingInteraction == null) {
return CommandResult.newErrorCommandResult("The container must be in an Interaction"); //$NON-NLS-1$
}
@@ -77,7 +77,7 @@ public class CustomTimeConstraintCreateCommand extends EditElementCommand {
minExpr.setValue("t1"); //$NON-NLS-1$
maxExpr.setValue("t2"); //$NON-NLS-1$
- ((CreateElementRequest) getRequest()).setNewElement(timeConstraint);
+ ((CreateElementRequest)getRequest()).setNewElement(timeConstraint);
return CommandResult.newOKCommandResult(timeConstraint);
}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/CustomTimeObservationCreateCommand.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/CustomTimeObservationCreateCommand.java
index 7940b48ed69..e0bc540df0d 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/CustomTimeObservationCreateCommand.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/CustomTimeObservationCreateCommand.java
@@ -37,19 +37,19 @@ public class CustomTimeObservationCreateCommand extends EditElementCommand {
@Override
protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
final TimeObservation timeObservation = UMLFactory.eINSTANCE.createTimeObservation();
- final CreateElementRequest request = (CreateElementRequest) getRequest();
- final EditPart originalTarget = (EditPart) request.getParameter(CustomPaletteFactory.ORIGINAL_TARGET);
- final NamedElement targetElement = (NamedElement) ((View) originalTarget.getModel()).getElement();
+ final CreateElementRequest request = (CreateElementRequest)getRequest();
+ final EditPart originalTarget = (EditPart)request.getParameter(CustomPaletteFactory.ORIGINAL_TARGET);
+ final NamedElement targetElement = (NamedElement)((View)originalTarget.getModel()).getElement();
// TODO: firstEvent depending on the click location relative to the originalTarget EditPart figure
final Package containingPackage = EcoreUtils.getContaining(request.getContainer(), Package.class);
- if (containingPackage == null) {
+ if(containingPackage == null) {
return CommandResult.newErrorCommandResult("The container must be in a Package"); //$NON-NLS-1$
}
containingPackage.getPackagedElements().add(timeObservation);
timeObservation.setEvent(targetElement);
- ((CreateElementRequest) getRequest()).setNewElement(timeObservation);
+ ((CreateElementRequest)getRequest()).setNewElement(timeObservation);
return CommandResult.newOKCommandResult(timeObservation);
}
}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/DeleteStateDefinitionCommand.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/DeleteStateDefinitionCommand.java
index 1753111e906..2e06ea6c57d 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/DeleteStateDefinitionCommand.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/DeleteStateDefinitionCommand.java
@@ -26,15 +26,16 @@ import org.eclipse.uml2.uml.Lifeline;
public class DeleteStateDefinitionCommand extends AbstractTransactionalCommand {
private final String id;
+
private final Lifeline lifeline;
/**
* @param id
- * the id of the state definition to delete
+ * the id of the state definition to delete
* @param lifeline
- * the lifeline
+ * the lifeline
* @param domain
- * the editing domain
+ * the editing domain
*/
public DeleteStateDefinitionCommand(final String id, final Lifeline lifeline, final TransactionalEditingDomain domain) {
super(domain, Messages.DeleteStateDefinitionCommand_DeleteStateDefinition, null);
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/RefreshCommandForUndo.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/RefreshCommandForUndo.java
index 2c2ac1bf28b..8fafa31ecb0 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/RefreshCommandForUndo.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/RefreshCommandForUndo.java
@@ -10,7 +10,6 @@
*****************************************************************************/
package org.eclipse.papyrus.uml.diagram.timing.custom.edit.commands;
-import org.eclipse.draw2d.IFigure;
import org.eclipse.gef.GraphicalEditPart;
/**
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/SwitchLifelineCommand.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/SwitchLifelineCommand.java
index 8ab9fcef2ee..885f22fc316 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/SwitchLifelineCommand.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/SwitchLifelineCommand.java
@@ -77,10 +77,10 @@ public class SwitchLifelineCommand extends GraphicalCommandHandler {
private Command switchLifeline(final IGraphicalEditPart lifelineEditPart) {
final EditPartViewer viewer = lifelineEditPart.getViewer();
- final View lifelineView = (View) lifelineEditPart.getModel();
+ final View lifelineView = (View)lifelineEditPart.getModel();
final View timeRulerCompartmentView = ViewUtils.findTimeRulerCompartmentView(lifelineView);
final boolean timeRulerVisible = timeRulerCompartmentView.isVisible();
- final Lifeline lifeline = (Lifeline) lifelineView.getElement();
+ final Lifeline lifeline = (Lifeline)lifelineView.getElement();
final CompoundCommand cc = new CompoundCommand(Messages.SwitchLifelineCommand_switchLifeline);
// we need to re-associate ticks in the Interaction time ruler to their new OccurrenceSpecification Views
@@ -88,8 +88,8 @@ public class SwitchLifelineCommand extends GraphicalCommandHandler {
// we need to re-create ticks in the Lifeline time ruler (since they get destroyed when destroying the Lifeline)
final Map<OccurrenceSpecification, String> lifelineTicksAssociations = computeLifelineTicksAssociations(lifelineView);
- if (lifelineEditPart instanceof CompactLifelineEditPartCN) {
- cc.add(new RefreshCommandForUndo((GraphicalEditPart) lifelineEditPart.getParent()));
+ if(lifelineEditPart instanceof CompactLifelineEditPartCN) {
+ cc.add(new RefreshCommandForUndo((GraphicalEditPart)lifelineEditPart.getParent()));
cc.add(new ICommandProxy(getNameUnnamedStateInvariants(lifeline)));
final ICommand createCommand = new ChangeLifelineFromCompactToFull(getEditingDomain(), lifelineEditPart);
cc.add(new ICommandProxy(createCommand));
@@ -100,13 +100,13 @@ public class SwitchLifelineCommand extends GraphicalCommandHandler {
cc.add(new ICommandProxy(getLifelineTicksCreationCommand(createCommand, lifelineTicksAssociations)));
addDestroyViewsAndEdgesRecursivelyCommand(cc, lifelineView);
// we need to create the EditParts corresponding to the MessageEnd Views before trying to reconnect Messages
- cc.add(new RefreshCommandForDo((GraphicalEditPart) lifelineEditPart.getParent()));
+ cc.add(new RefreshCommandForDo((GraphicalEditPart)lifelineEditPart.getParent()));
cc.add(new ICommandProxy(getMessagesCreationCommand(createCommand, viewer)));
cc.add(new ICommandProxy(getLinkedElementsCreationCommand(createCommand, viewer)));
- cc.add(new RefreshCommandForDo((GraphicalEditPart) lifelineEditPart.getParent()));
+ cc.add(new RefreshCommandForDo((GraphicalEditPart)lifelineEditPart.getParent()));
return cc;
- } else if (lifelineEditPart instanceof FullLifelineEditPartCN) {
- cc.add(new RefreshCommandForUndo((GraphicalEditPart) lifelineEditPart.getParent()));
+ } else if(lifelineEditPart instanceof FullLifelineEditPartCN) {
+ cc.add(new RefreshCommandForUndo((GraphicalEditPart)lifelineEditPart.getParent()));
final ICommand createCommand = new ChangeLifelineFromFullToCompact(getEditingDomain(), lifelineEditPart);
cc.add(new ICommandProxy(createCommand));
cc.add(new ICommandProxy(getFreeTimeRulerCreationCommand(createCommand, timeRulerVisible)));
@@ -115,10 +115,10 @@ public class SwitchLifelineCommand extends GraphicalCommandHandler {
cc.add(new ICommandProxy(getLifelineTicksCreationCommand(createCommand, lifelineTicksAssociations)));
addDestroyViewsAndEdgesRecursivelyCommand(cc, lifelineView);
// we need to create the EditParts corresponding to the MessageEnd Views before trying to reconnect Messages
- cc.add(new RefreshCommandForDo((GraphicalEditPart) lifelineEditPart.getParent()));
+ cc.add(new RefreshCommandForDo((GraphicalEditPart)lifelineEditPart.getParent()));
cc.add(new ICommandProxy(getMessagesCreationCommand(createCommand, viewer)));
cc.add(new ICommandProxy(getLinkedElementsCreationCommand(createCommand, viewer)));
- cc.add(new RefreshCommandForDo((GraphicalEditPart) lifelineEditPart.getParent()));
+ cc.add(new RefreshCommandForDo((GraphicalEditPart)lifelineEditPart.getParent()));
return cc;
}
throw new IllegalArgumentException("expected a Lifeline edit part"); //$NON-NLS-1$
@@ -130,9 +130,9 @@ public class SwitchLifelineCommand extends GraphicalCommandHandler {
final View timelineCompartmentView = ViewUtils.findChildTimelineCompartmentView(lifelineView);
@SuppressWarnings("unchecked")
final EList<View> children = timelineCompartmentView.getChildren();
- for (final View child : children) {
- if (ViewUtils.isViewFor(child, UMLPackage.eINSTANCE.getOccurrenceSpecification())) {
- final OccurrenceSpecification occurrenceSpecification = (OccurrenceSpecification) child.getElement();
+ for(final View child : children) {
+ if(ViewUtils.isViewFor(child, UMLPackage.eINSTANCE.getOccurrenceSpecification())) {
+ final OccurrenceSpecification occurrenceSpecification = (OccurrenceSpecification)child.getElement();
final List<Node> associatedTickViews = TickUtils.getAssociatedTickViews(child);
map.put(occurrenceSpecification, associatedTickViews);
}
@@ -151,9 +151,9 @@ public class SwitchLifelineCommand extends GraphicalCommandHandler {
final View timeRulerCompartment = ViewUtils.findFirstChildViewWithId(lifelineView, FreeTimeRulerCompartmentEditPart.VISUAL_ID);
@SuppressWarnings("unchecked")
final EList<View> children = timeRulerCompartment.getChildren();
- for (final View tickView : children) {
+ for(final View tickView : children) {
final Node associatedOccurrenceView = TickUtils.getAssociatedOccurrenceView(tickView);
- final OccurrenceSpecification occurrenceSpecification = (OccurrenceSpecification) associatedOccurrenceView.getElement();
+ final OccurrenceSpecification occurrenceSpecification = (OccurrenceSpecification)associatedOccurrenceView.getElement();
final String description = getTickLabelDescription(tickView);
map.put(occurrenceSpecification, description);
}
@@ -162,12 +162,12 @@ public class SwitchLifelineCommand extends GraphicalCommandHandler {
protected static void setTickLabelDescription(final Node tickNode, final String tickName) {
final View labelView = ViewUtils.findFirstChildViewWithId(tickNode, TickNameEditPart.VISUAL_ID);
- if (labelView != null) {
+ if(labelView != null) {
@SuppressWarnings("unchecked")
final EList<Style> styles = labelView.getStyles();
- for (final Object style : styles) {
- if (style instanceof DescriptionStyle) {
- final DescriptionStyle descriptionStyle = (DescriptionStyle) style;
+ for(final Object style : styles) {
+ if(style instanceof DescriptionStyle) {
+ final DescriptionStyle descriptionStyle = (DescriptionStyle)style;
descriptionStyle.setDescription(tickName);
}
}
@@ -176,12 +176,12 @@ public class SwitchLifelineCommand extends GraphicalCommandHandler {
private static String getTickLabelDescription(final View tickView) {
final View labelView = ViewUtils.findFirstChildViewWithId(tickView, TickNameEditPart.VISUAL_ID);
- if (labelView != null) {
+ if(labelView != null) {
@SuppressWarnings("unchecked")
final EList<Style> styles = labelView.getStyles();
- for (final Object style : styles) {
- if (style instanceof DescriptionStyle) {
- final DescriptionStyle descriptionStyle = (DescriptionStyle) style;
+ for(final Object style : styles) {
+ if(style instanceof DescriptionStyle) {
+ final DescriptionStyle descriptionStyle = (DescriptionStyle)style;
return descriptionStyle.getDescription();
}
}
@@ -192,22 +192,23 @@ public class SwitchLifelineCommand extends GraphicalCommandHandler {
/** Re-associates Interaction time ruler ticks to their new OccurrenceSpecification Views. */
private ICommand getTicksAssociationCommand(final ICommand createCommand, final Map<OccurrenceSpecification, List<Node>> ticksAssociations) {
return new AbstractTransactionalCommand(getEditingDomain(), Messages.SwitchLifelineCommand_ReAssociateTicks, null, null) {
+
@Override
protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
- final View lifelineView = (View) createCommand.getCommandResult().getReturnValue();
- if (lifelineView == null) {
+ final View lifelineView = (View)createCommand.getCommandResult().getReturnValue();
+ if(lifelineView == null) {
return CommandResult.newErrorCommandResult("Parent Lifeline not found"); //$NON-NLS-1$
}
final View timelineCompartmentView = ViewUtils.findChildTimelineCompartmentView(lifelineView);
@SuppressWarnings("unchecked")
final EList<View> children = timelineCompartmentView.getChildren();
- for (final View child : children) {
- if (ViewUtils.isViewFor(child, UMLPackage.eINSTANCE.getOccurrenceSpecification())) {
- final OccurrenceSpecification occurrenceSpecification = (OccurrenceSpecification) child.getElement();
+ for(final View child : children) {
+ if(ViewUtils.isViewFor(child, UMLPackage.eINSTANCE.getOccurrenceSpecification())) {
+ final OccurrenceSpecification occurrenceSpecification = (OccurrenceSpecification)child.getElement();
final List<Node> tickNodes = ticksAssociations.get(occurrenceSpecification);
- if (tickNodes != null) {
- for (final Node tickNode : tickNodes) {
- TickUtils.associateTickNodeToOccurrenceNode(tickNode, (Node) child, true);
+ if(tickNodes != null) {
+ for(final Node tickNode : tickNodes) {
+ TickUtils.associateTickNodeToOccurrenceNode(tickNode, (Node)child, true);
}
}
}
@@ -220,22 +221,22 @@ public class SwitchLifelineCommand extends GraphicalCommandHandler {
/** Re-creates Lifeline time ruler ticks, and associate them to their new OccurrenceSpecification Views. */
private ICommand getLifelineTicksCreationCommand(final ICommand createCommand, final Map<OccurrenceSpecification, String> lifelineTicksAssociations) {
return new AbstractTransactionalCommand(getEditingDomain(), Messages.SwitchLifelineCommand_ReAssociateTicks, null, null) {
+
@Override
protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
- final View lifelineView = (View) createCommand.getCommandResult().getReturnValue();
- if (lifelineView == null) {
+ final View lifelineView = (View)createCommand.getCommandResult().getReturnValue();
+ if(lifelineView == null) {
return CommandResult.newErrorCommandResult("Parent Lifeline not found"); //$NON-NLS-1$
}
final View timeRulerCompartment = ViewUtils.findFirstChildViewWithId(lifelineView, FreeTimeRulerCompartmentEditPart.VISUAL_ID);
final View timelineCompartmentView = ViewUtils.findChildTimelineCompartmentView(lifelineView);
final UMLViewProvider umlViewProvider = new UMLViewProvider();
- for (final Entry<OccurrenceSpecification, String> entry : lifelineTicksAssociations.entrySet()) {
+ for(final Entry<OccurrenceSpecification, String> entry : lifelineTicksAssociations.entrySet()) {
final OccurrenceSpecification occurrenceSpecification = entry.getKey();
final Node occurrenceView = findOccurrenceView(occurrenceSpecification, timelineCompartmentView);
final String tickName = entry.getValue();
- final Node tickNode = umlViewProvider.createNode_26(null, timeRulerCompartment, ViewUtil.APPEND, true,
- UMLDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT);
+ final Node tickNode = umlViewProvider.createNode_26(null, timeRulerCompartment, ViewUtil.APPEND, true, UMLDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT);
setTickLabelDescription(tickNode, tickName);
TickUtils.associateTickNodeToOccurrenceNode(tickNode, occurrenceView, false);
}
@@ -248,9 +249,9 @@ public class SwitchLifelineCommand extends GraphicalCommandHandler {
protected static Node findOccurrenceView(final OccurrenceSpecification occurrenceSpecification, final View timelineCompartmentView) {
@SuppressWarnings("unchecked")
final EList<View> children = timelineCompartmentView.getChildren();
- for (final View child : children) {
- if (child.getElement() == occurrenceSpecification) {
- return (Node) child;
+ for(final View child : children) {
+ if(child.getElement() == occurrenceSpecification) {
+ return (Node)child;
}
}
return null;
@@ -262,20 +263,21 @@ public class SwitchLifelineCommand extends GraphicalCommandHandler {
*/
private ICommand getNameUnnamedStateInvariants(final Lifeline lifeline) {
return new AbstractTransactionalCommand(getEditingDomain(), Messages.SwitchLifelineCommand_NameUnnamedStateInvariants, null, null) {
+
@Override
protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
final EList<InteractionFragment> coveredBys = lifeline.getCoveredBys();
boolean containsUnnamedStateInvariants = false;
- for (final InteractionFragment interactionFragment : coveredBys) {
- if (interactionFragment instanceof StateInvariant) {
- final StateInvariant stateInvariant = (StateInvariant) interactionFragment;
- if (StateInvariantUtils.getInnerStateInvariantName(stateInvariant) == null) {
+ for(final InteractionFragment interactionFragment : coveredBys) {
+ if(interactionFragment instanceof StateInvariant) {
+ final StateInvariant stateInvariant = (StateInvariant)interactionFragment;
+ if(StateInvariantUtils.getInnerStateInvariantName(stateInvariant) == null) {
containsUnnamedStateInvariants = true;
StateInvariantUtils.setInnerStateInvariantName(stateInvariant, Messages.SwitchLifelineCommand_unnamed);
}
}
}
- if (containsUnnamedStateInvariants) {
+ if(containsUnnamedStateInvariants) {
StateDefinitionUtils.updateStateDefinitionNamesForCompactLifeline(lifeline);
}
return CommandResult.newOKCommandResult();
@@ -286,17 +288,17 @@ public class SwitchLifelineCommand extends GraphicalCommandHandler {
private static void addDestroyViewsAndEdgesRecursivelyCommand(final CompoundCommand cc, final View view) {
@SuppressWarnings("unchecked")
final EList<View> children = view.getChildren();
- for (final View childView : children) {
+ for(final View childView : children) {
addDestroyViewsAndEdgesRecursivelyCommand(cc, childView);
}
@SuppressWarnings("unchecked")
final EList<Edge> sourceEdges = view.getSourceEdges();
@SuppressWarnings("unchecked")
final EList<Edge> targetEdges = view.getTargetEdges();
- for (final Edge edge : sourceEdges) {
+ for(final Edge edge : sourceEdges) {
cc.add(new ICommandProxy(new DestroyElementCommand(new DestroyElementRequest(edge, false))));
}
- for (final Edge edge : targetEdges) {
+ for(final Edge edge : targetEdges) {
cc.add(new ICommandProxy(new DestroyElementCommand(new DestroyElementRequest(edge, false))));
}
cc.add(new ICommandProxy(new DestroyElementCommand(new DestroyElementRequest(view, false))));
@@ -305,25 +307,26 @@ public class SwitchLifelineCommand extends GraphicalCommandHandler {
private ICommand getMessagesCreationCommand(final ICommand createCommand, final EditPartViewer viewer) {
return new AbstractTransactionalCommand(getEditingDomain(), Messages.SwitchLifelineCommand_createMessages, null, null) {
+
@Override
protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
- final View lifelineView = (View) createCommand.getCommandResult().getReturnValue();
- if (lifelineView == null) {
+ final View lifelineView = (View)createCommand.getCommandResult().getReturnValue();
+ if(lifelineView == null) {
return CommandResult.newErrorCommandResult("Parent Lifeline not found"); //$NON-NLS-1$
}
- final Lifeline lifeline = (Lifeline) lifelineView.getElement();
+ final Lifeline lifeline = (Lifeline)lifelineView.getElement();
// find Messages linked to fragments in the Lifeline
- final EReference[] references = new EReference[] { UMLPackage.eINSTANCE.getMessage_ReceiveEvent(), UMLPackage.eINSTANCE.getMessage_SendEvent() };
- final Class<?>[] expectedClasses = new Class<?>[] { Message.class };
+ final EReference[] references = new EReference[]{ UMLPackage.eINSTANCE.getMessage_ReceiveEvent(), UMLPackage.eINSTANCE.getMessage_SendEvent() };
+ final Class<?>[] expectedClasses = new Class<?>[]{ Message.class };
final EList<InteractionFragment> coveredBys = lifeline.getCoveredBys();
final Set<EObject> referencingElements = new HashSet<EObject>();
- for (final InteractionFragment interactionFragment : coveredBys) {
+ for(final InteractionFragment interactionFragment : coveredBys) {
referencingElements.addAll(Utils.findReferencingElements(interactionFragment, references, expectedClasses));
}
// drop the Messages
- for (final EObject referencingElement : referencingElements) {
- final Message referencingMessage = (Message) referencingElement;
+ for(final EObject referencingElement : referencingElements) {
+ final Message referencingMessage = (Message)referencingElement;
executeCommand(DropUtils.getDropMessageCommand(referencingMessage, lifelineView, viewer));
}
return CommandResult.newOKCommandResult();
@@ -333,43 +336,41 @@ public class SwitchLifelineCommand extends GraphicalCommandHandler {
private ICommand getLinkedElementsCreationCommand(final ICommand createCommand, final EditPartViewer viewer) {
return new AbstractTransactionalCommand(getEditingDomain(), Messages.SwitchLifelineCommand_CreateLinkedElements, null, null) {
+
@Override
protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
- final View lifelineView = (View) createCommand.getCommandResult().getReturnValue();
- if (lifelineView == null) {
+ final View lifelineView = (View)createCommand.getCommandResult().getReturnValue();
+ if(lifelineView == null) {
return CommandResult.newErrorCommandResult("Parent Lifeline not found"); //$NON-NLS-1$
}
// find time elements and general orderings linked to fragments in the Lifeline
- final EReference[] references = new EReference[] { UMLPackage.eINSTANCE.getGeneralOrdering_Before(),
- UMLPackage.eINSTANCE.getGeneralOrdering_After(), UMLPackage.eINSTANCE.getDurationObservation_Event(),
- UMLPackage.eINSTANCE.getTimeObservation_Event(), UMLPackage.eINSTANCE.getConstraint_ConstrainedElement() };
- final Class<?>[] expectedClasses = new Class<?>[] { GeneralOrdering.class, TimeObservation.class, DurationObservation.class,
- TimeConstraint.class, DurationConstraint.class };
+ final EReference[] references = new EReference[]{ UMLPackage.eINSTANCE.getGeneralOrdering_Before(), UMLPackage.eINSTANCE.getGeneralOrdering_After(), UMLPackage.eINSTANCE.getDurationObservation_Event(), UMLPackage.eINSTANCE.getTimeObservation_Event(), UMLPackage.eINSTANCE.getConstraint_ConstrainedElement() };
+ final Class<?>[] expectedClasses = new Class<?>[]{ GeneralOrdering.class, TimeObservation.class, DurationObservation.class, TimeConstraint.class, DurationConstraint.class };
- final Lifeline lifeline = (Lifeline) lifelineView.getElement();
+ final Lifeline lifeline = (Lifeline)lifelineView.getElement();
final EList<InteractionFragment> coveredBys = lifeline.getCoveredBys();
final Set<EObject> referencingElements = new HashSet<EObject>();
- for (final InteractionFragment interactionFragment : coveredBys) {
+ for(final InteractionFragment interactionFragment : coveredBys) {
referencingElements.addAll(Utils.findReferencingElements(interactionFragment, references, expectedClasses));
}
// drop the elements
- for (final EObject eObject : referencingElements) {
- if (eObject instanceof TimeObservation) {
- final TimeObservation timeObservation = (TimeObservation) eObject;
+ for(final EObject eObject : referencingElements) {
+ if(eObject instanceof TimeObservation) {
+ final TimeObservation timeObservation = (TimeObservation)eObject;
executeCommand(DropUtils.getDropTimeObservationCommand(timeObservation, lifelineView, viewer));
- } else if (eObject instanceof TimeConstraint) {
- final TimeConstraint timeConstraint = (TimeConstraint) eObject;
+ } else if(eObject instanceof TimeConstraint) {
+ final TimeConstraint timeConstraint = (TimeConstraint)eObject;
executeCommand(DropUtils.getDropTimeConstraintCommand(timeConstraint, lifelineView, viewer));
- } else if (eObject instanceof DurationObservation) {
- final DurationObservation durationObservation = (DurationObservation) eObject;
+ } else if(eObject instanceof DurationObservation) {
+ final DurationObservation durationObservation = (DurationObservation)eObject;
executeCommand(DropUtils.getDropDurationObservationCommand(durationObservation, lifelineView, viewer));
- } else if (eObject instanceof DurationConstraint) {
- final DurationConstraint durationConstraint = (DurationConstraint) eObject;
+ } else if(eObject instanceof DurationConstraint) {
+ final DurationConstraint durationConstraint = (DurationConstraint)eObject;
executeCommand(DropUtils.getDropDurationConstraintCommand(durationConstraint, lifelineView, viewer));
- } else if (eObject instanceof GeneralOrdering) {
- final GeneralOrdering generalOrdering = (GeneralOrdering) eObject;
+ } else if(eObject instanceof GeneralOrdering) {
+ final GeneralOrdering generalOrdering = (GeneralOrdering)eObject;
executeCommand(DropUtils.getDropGeneralOrderingCommand(generalOrdering, lifelineView, viewer));
}
}
@@ -381,16 +382,17 @@ public class SwitchLifelineCommand extends GraphicalCommandHandler {
private ICommand getStateDefinitionCreationForFullLifelineCommand(final Lifeline lifeline, final ICommand createCommand) {
return new AbstractTransactionalCommand(getEditingDomain(), Messages.SwitchLifelineCommand_createStateDefinitions, null, null) {
+
@Override
protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
- final View lifelineView = (View) createCommand.getCommandResult().getReturnValue();
- if (lifelineView == null) {
+ final View lifelineView = (View)createCommand.getCommandResult().getReturnValue();
+ if(lifelineView == null) {
return CommandResult.newErrorCommandResult("Parent Lifeline not found"); //$NON-NLS-1$
}
final View stateDefinitionCompartmentView = ViewUtils.findStateDefinitionCompartmentView(lifelineView);
final List<String> stateDefinitionIds = StateDefinitionUtils.getStateDefinitionIds(lifeline);
- for (final String stateDefinitionId : stateDefinitionIds) {
+ for(final String stateDefinitionId : stateDefinitionIds) {
final String stateDefinitionName = StateDefinitionUtils.getStateDefinitionName(stateDefinitionId, lifeline);
// create the View for the state definition
@@ -409,10 +411,11 @@ public class SwitchLifelineCommand extends GraphicalCommandHandler {
private ICommand getFreeTimeRulerCreationCommand(final ICommand createCommand, final boolean timeRulerVisible) {
return new AbstractTransactionalCommand(getEditingDomain(), Messages.SwitchLifelineCommand_CreateTimeRuler, null) {
+
@Override
protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
- final View lifelineView = (View) createCommand.getCommandResult().getReturnValue();
- if (lifelineView == null) {
+ final View lifelineView = (View)createCommand.getCommandResult().getReturnValue();
+ if(lifelineView == null) {
return CommandResult.newErrorCommandResult("Parent Lifeline not found"); //$NON-NLS-1$
}
TimeRulerUtils.createFreeTimeRuler(lifelineView);
@@ -427,11 +430,12 @@ public class SwitchLifelineCommand extends GraphicalCommandHandler {
private ICommand getFragmentsCreationForCompactLifelineCommand(final Lifeline lifeline, final ICommand createCommand) {
return new AbstractTransactionalCommand(getEditingDomain(), Messages.SwitchLifelineCommand_createLifelineFragments, null, null) {
+
@Override
protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
- final View lifelineView = (View) createCommand.getCommandResult().getReturnValue();
- if (lifelineView == null) {
+ final View lifelineView = (View)createCommand.getCommandResult().getReturnValue();
+ if(lifelineView == null) {
return CommandResult.newErrorCommandResult("Parent Lifeline not found"); //$NON-NLS-1$
}
final UMLViewProvider umlViewProvider = new UMLViewProvider();
@@ -439,41 +443,37 @@ public class SwitchLifelineCommand extends GraphicalCommandHandler {
String previousStateInvariantName = ""; //$NON-NLS-1$
int indexInCompartment = 0;
int x = CustomCompactLifelineCompartmentEditPart.FIRST_STATE_OFFSET;
- for (final InteractionFragment fragment : lifeline.getCoveredBys()) {
+ for(final InteractionFragment fragment : lifeline.getCoveredBys()) {
final Location loc = NotationFactory.eINSTANCE.createLocation();
loc.setX(x);
loc.setY(0);
- if (fragment instanceof StateInvariant) {
- final StateInvariant stateInvariant = (StateInvariant) fragment;
+ if(fragment instanceof StateInvariant) {
+ final StateInvariant stateInvariant = (StateInvariant)fragment;
final String stateInvariantName = StateInvariantUtils.getInnerStateInvariantName(stateInvariant);
- if (!Utils.safeEquals(stateInvariantName, previousStateInvariantName)) {
- umlViewProvider.createStateInvariant_28(stateInvariant, stateInvariantCompartmentView, indexInCompartment, true,
- PreferencesHint.USE_DEFAULTS);
+ if(!Utils.safeEquals(stateInvariantName, previousStateInvariantName)) {
+ umlViewProvider.createStateInvariant_28(stateInvariant, stateInvariantCompartmentView, indexInCompartment, true, PreferencesHint.USE_DEFAULTS);
indexInCompartment++;
x += 60;
}
previousStateInvariantName = stateInvariantName;
- } else if (fragment instanceof DestructionOccurrenceSpecification) {
- final DestructionOccurrenceSpecification occurrence = (DestructionOccurrenceSpecification) fragment;
- final Node occurrenceSpecificationView = umlViewProvider.createDestructionOccurrenceSpecification_27(occurrence,
- stateInvariantCompartmentView, indexInCompartment, true, PreferencesHint.USE_DEFAULTS);
+ } else if(fragment instanceof DestructionOccurrenceSpecification) {
+ final DestructionOccurrenceSpecification occurrence = (DestructionOccurrenceSpecification)fragment;
+ final Node occurrenceSpecificationView = umlViewProvider.createDestructionOccurrenceSpecification_27(occurrence, stateInvariantCompartmentView, indexInCompartment, true, PreferencesHint.USE_DEFAULTS);
indexInCompartment++;
occurrenceSpecificationView.setLayoutConstraint(loc);
x += 10;
- } else if (fragment instanceof MessageOccurrenceSpecification) {
- final MessageOccurrenceSpecification occurrence = (MessageOccurrenceSpecification) fragment;
- final Node occurrenceSpecificationView = umlViewProvider.createMessageOccurrenceSpecification_13(occurrence,
- stateInvariantCompartmentView, indexInCompartment, true, PreferencesHint.USE_DEFAULTS);
+ } else if(fragment instanceof MessageOccurrenceSpecification) {
+ final MessageOccurrenceSpecification occurrence = (MessageOccurrenceSpecification)fragment;
+ final Node occurrenceSpecificationView = umlViewProvider.createMessageOccurrenceSpecification_13(occurrence, stateInvariantCompartmentView, indexInCompartment, true, PreferencesHint.USE_DEFAULTS);
indexInCompartment++;
occurrenceSpecificationView.setLayoutConstraint(loc);
x += 10;
- } else if (fragment instanceof OccurrenceSpecification) {
- final OccurrenceSpecification occurrence = (OccurrenceSpecification) fragment;
- final Node occurrenceSpecificationView = umlViewProvider.createOccurrenceSpecification_12(occurrence, stateInvariantCompartmentView,
- indexInCompartment, true, PreferencesHint.USE_DEFAULTS);
+ } else if(fragment instanceof OccurrenceSpecification) {
+ final OccurrenceSpecification occurrence = (OccurrenceSpecification)fragment;
+ final Node occurrenceSpecificationView = umlViewProvider.createOccurrenceSpecification_12(occurrence, stateInvariantCompartmentView, indexInCompartment, true, PreferencesHint.USE_DEFAULTS);
indexInCompartment++;
occurrenceSpecificationView.setLayoutConstraint(loc);
x += 10;
@@ -488,10 +488,11 @@ public class SwitchLifelineCommand extends GraphicalCommandHandler {
private ICommand getFragmentsCreationForFullLifelineCommand(final Lifeline lifeline, final ICommand createCommand) {
return new AbstractTransactionalCommand(getEditingDomain(), Messages.SwitchLifelineCommand_createLifelineFragments, null, null) {
+
@Override
protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
- final View lifelineView = (View) createCommand.getCommandResult().getReturnValue();
- if (lifelineView == null) {
+ final View lifelineView = (View)createCommand.getCommandResult().getReturnValue();
+ if(lifelineView == null) {
return CommandResult.newErrorCommandResult("Parent Lifeline not found"); //$NON-NLS-1$
}
final View timelineCompartmentView = ViewUtils.findFullLifelineCompartmentView(lifelineView);
@@ -503,25 +504,25 @@ public class SwitchLifelineCommand extends GraphicalCommandHandler {
String previousStateInvariantName = ""; //$NON-NLS-1$
StateInvariant previousStateInvariant = null;
boolean needStateInvariant = false;
- for (final InteractionFragment fragment : fragments) {
+ for(final InteractionFragment fragment : fragments) {
final Location loc = NotationFactory.eINSTANCE.createLocation();
loc.setX(x);
loc.setY(0);
// we always need a StateInvariant between OccurrenceSpecifications
// (otherwise we would be leaving a gap in the timeline)
- if (!(fragment instanceof StateInvariant) && needStateInvariant && previousStateInvariant != null) {
+ if(!(fragment instanceof StateInvariant) && needStateInvariant && previousStateInvariant != null) {
umlViewProvider.createStateInvariant_11(previousStateInvariant, timelineCompartmentView, -1, true, PreferencesHint.USE_DEFAULTS);
}
- if (fragment instanceof StateInvariant) {
- if (!firstStateInvariant) {
+ if(fragment instanceof StateInvariant) {
+ if(!firstStateInvariant) {
// add a vertical line
umlViewProvider.createNode_39(null, timelineCompartmentView, -1, true, PreferencesHint.USE_DEFAULTS);
}
- final StateInvariant stateInvariant = (StateInvariant) fragment;
+ final StateInvariant stateInvariant = (StateInvariant)fragment;
final String stateInvariantName = StateInvariantUtils.getInnerStateInvariantName(stateInvariant);
- if (Utils.safeEquals(stateInvariantName, previousStateInvariantName)) {
+ if(Utils.safeEquals(stateInvariantName, previousStateInvariantName)) {
x += 10;
} else {
x += 25;
@@ -532,27 +533,24 @@ public class SwitchLifelineCommand extends GraphicalCommandHandler {
previousStateInvariantName = stateInvariantName;
previousStateInvariant = stateInvariant;
needStateInvariant = false;
- } else if (fragment instanceof DestructionOccurrenceSpecification) {
- final DestructionOccurrenceSpecification destructionOccurrenceSpecification = (DestructionOccurrenceSpecification) fragment;
+ } else if(fragment instanceof DestructionOccurrenceSpecification) {
+ final DestructionOccurrenceSpecification destructionOccurrenceSpecification = (DestructionOccurrenceSpecification)fragment;
// create the View for the occurrence specification
- final Node occurrenceSpecificationView = umlViewProvider.createDestructionOccurrenceSpecification_27(
- destructionOccurrenceSpecification, timelineCompartmentView, -1, true, PreferencesHint.USE_DEFAULTS);
+ final Node occurrenceSpecificationView = umlViewProvider.createDestructionOccurrenceSpecification_27(destructionOccurrenceSpecification, timelineCompartmentView, -1, true, PreferencesHint.USE_DEFAULTS);
occurrenceSpecificationView.setLayoutConstraint(loc);
needStateInvariant = false;
x += 10;
- } else if (fragment instanceof MessageOccurrenceSpecification) {
- final MessageOccurrenceSpecification occurrenceSpecification = (MessageOccurrenceSpecification) fragment;
+ } else if(fragment instanceof MessageOccurrenceSpecification) {
+ final MessageOccurrenceSpecification occurrenceSpecification = (MessageOccurrenceSpecification)fragment;
// create the View for the occurrence specification
- final Node occurrenceSpecificationView = umlViewProvider.createMessageOccurrenceSpecification_13(occurrenceSpecification,
- timelineCompartmentView, -1, true, PreferencesHint.USE_DEFAULTS);
+ final Node occurrenceSpecificationView = umlViewProvider.createMessageOccurrenceSpecification_13(occurrenceSpecification, timelineCompartmentView, -1, true, PreferencesHint.USE_DEFAULTS);
occurrenceSpecificationView.setLayoutConstraint(loc);
needStateInvariant = true;
x += 10;
- } else if (fragment instanceof OccurrenceSpecification) {
- final OccurrenceSpecification occurrenceSpecification = (OccurrenceSpecification) fragment;
+ } else if(fragment instanceof OccurrenceSpecification) {
+ final OccurrenceSpecification occurrenceSpecification = (OccurrenceSpecification)fragment;
// create the View for the occurrence specification
- final Node occurrenceSpecificationView = umlViewProvider.createOccurrenceSpecification_12(occurrenceSpecification,
- timelineCompartmentView, -1, true, PreferencesHint.USE_DEFAULTS);
+ final Node occurrenceSpecificationView = umlViewProvider.createOccurrenceSpecification_12(occurrenceSpecification, timelineCompartmentView, -1, true, PreferencesHint.USE_DEFAULTS);
occurrenceSpecificationView.setLayoutConstraint(loc);
needStateInvariant = true;
x += 10;
@@ -560,7 +558,7 @@ public class SwitchLifelineCommand extends GraphicalCommandHandler {
}
// we always need the timeline to end with a StateInvariant
- if (needStateInvariant && previousStateInvariant != null) {
+ if(needStateInvariant && previousStateInvariant != null) {
umlViewProvider.createStateInvariant_11(previousStateInvariant, timelineCompartmentView, -1, true, PreferencesHint.USE_DEFAULTS);
}
@@ -573,8 +571,8 @@ public class SwitchLifelineCommand extends GraphicalCommandHandler {
protected Command getCommand() throws ExecutionException {
final CompoundCommand cmd = new CompoundCommand(Messages.SwitchLifelineCommand_switchLifeline);
final List<IGraphicalEditPart> selectedElements = getSelectedElements();
- for (final IGraphicalEditPart selectedElement : selectedElements) {
- if (selectedElement instanceof FullLifelineEditPartCN || selectedElement instanceof CompactLifelineEditPartCN) {
+ for(final IGraphicalEditPart selectedElement : selectedElements) {
+ if(selectedElement instanceof FullLifelineEditPartCN || selectedElement instanceof CompactLifelineEditPartCN) {
cmd.add(switchLifeline(selectedElement));
}
}
@@ -582,7 +580,7 @@ public class SwitchLifelineCommand extends GraphicalCommandHandler {
}
protected static void executeCommand(final ICommand command) throws ExecutionException {
- if (command.canExecute()) {
+ if(command.canExecute()) {
command.execute(new NullProgressMonitor(), null);
} else {
Activator.log.warn("Cannot execute command for lifeline switch: " + command.getLabel()); //$NON-NLS-1$
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/ToggleTimeRulerVisibility.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/ToggleTimeRulerVisibility.java
index 7f4897fa944..edb24a1c7b3 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/ToggleTimeRulerVisibility.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/ToggleTimeRulerVisibility.java
@@ -42,11 +42,11 @@ public class ToggleTimeRulerVisibility extends GraphicalCommandHandler {
final List<IGraphicalEditPart> selectedElements = getSelectedElements();
boolean first = true;
InteractionEditPartTN interactionEditPart = null;
- for (final IGraphicalEditPart selectedEditPart : selectedElements) {
- if (selectedEditPart instanceof FullLifelineEditPartCN || selectedEditPart instanceof CompactLifelineEditPartCN) {
- if (first) {
- interactionEditPart = (InteractionEditPartTN) EditPartUtils.findParentEditPartWithId(selectedEditPart, InteractionEditPartTN.VISUAL_ID);
- if (interactionEditPart != null) {
+ for(final IGraphicalEditPart selectedEditPart : selectedElements) {
+ if(selectedEditPart instanceof FullLifelineEditPartCN || selectedEditPart instanceof CompactLifelineEditPartCN) {
+ if(first) {
+ interactionEditPart = (InteractionEditPartTN)EditPartUtils.findParentEditPartWithId(selectedEditPart, InteractionEditPartTN.VISUAL_ID);
+ if(interactionEditPart != null) {
cmd.add(new RefreshCommandForUndo(interactionEditPart));
first = false;
}
@@ -54,30 +54,30 @@ public class ToggleTimeRulerVisibility extends GraphicalCommandHandler {
cmd.add(toggleTimeRulerVisibility(selectedEditPart));
}
}
- if (interactionEditPart != null) {
+ if(interactionEditPart != null) {
cmd.add(new RefreshCommandForDo(interactionEditPart));
}
return cmd;
}
private Command toggleTimeRulerVisibility(final IGraphicalEditPart object) {
- return new ICommandProxy(
- new AbstractTransactionalCommand(getEditingDomain(), Messages.ToggleTimeRulerVisibility_ToggleTimeRulerVisibility, null, null) {
- @Override
- protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
- final LifelineEditPart lifelineEditPart = (LifelineEditPart) object;
- final View lifelineView = (View) lifelineEditPart.getModel();
- final View timeRulerCompartmentView = ViewUtils.findTimeRulerCompartmentView(lifelineView);
- timeRulerCompartmentView.setVisible(!timeRulerCompartmentView.isVisible());
- return CommandResult.newOKCommandResult();
- }
- });
+ return new ICommandProxy(new AbstractTransactionalCommand(getEditingDomain(), Messages.ToggleTimeRulerVisibility_ToggleTimeRulerVisibility, null, null) {
+
+ @Override
+ protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
+ final LifelineEditPart lifelineEditPart = (LifelineEditPart)object;
+ final View lifelineView = (View)lifelineEditPart.getModel();
+ final View timeRulerCompartmentView = ViewUtils.findTimeRulerCompartmentView(lifelineView);
+ timeRulerCompartmentView.setVisible(!timeRulerCompartmentView.isVisible());
+ return CommandResult.newOKCommandResult();
+ }
+ });
}
protected static final LifelineFigure getLifelineFigure(final IFigure figure) {
LifelineFigure result = null;
result = FigureUtils.findChildFigureInstance(figure, FullLifelineFigure.class);
- if (result == null) {
+ if(result == null) {
result = FigureUtils.findChildFigureInstance(figure, CompactLifelineFigure.class);
}
return result;
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/ValidateInteractionCommand.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/ValidateInteractionCommand.java
index 1200f2ce82d..ceb23345c42 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/ValidateInteractionCommand.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/ValidateInteractionCommand.java
@@ -22,15 +22,16 @@ import org.eclipse.uml2.uml.Interaction;
public class ValidateInteractionCommand extends AbstractTransactionalCommand {
private final Interaction interaction;
+
private final boolean interactive;
/**
* @param domain
- * the editing domain
+ * the editing domain
* @param interaction
- * the interaction to validate
+ * the interaction to validate
* @param interactive
- * whether to display notifications to the user, and ask for confirmation using dialog boxes
+ * whether to display notifications to the user, and ask for confirmation using dialog boxes
*/
public ValidateInteractionCommand(final TransactionalEditingDomain domain, final Interaction interaction, final boolean interactive) {
super(domain, Messages.ValidateInteractionCommand_ValidateInteraction, null);
@@ -42,6 +43,7 @@ public class ValidateInteractionCommand extends AbstractTransactionalCommand {
protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
final boolean[] result = new boolean[1];
Display.getDefault().syncExec(new Runnable() {
+
public void run() {
result[0] = validate();
}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomCompactLifelineCompartmentEditPart.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomCompactLifelineCompartmentEditPart.java
index 905b81b0061..9a8ebc130f1 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomCompactLifelineCompartmentEditPart.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomCompactLifelineCompartmentEditPart.java
@@ -45,16 +45,17 @@ public class CustomCompactLifelineCompartmentEditPart extends CompactLifelineCom
@Override
public IFigure createFigure() {
- final ResizableCompartmentFigure figure = (ResizableCompartmentFigure) super.createFigure();
+ final ResizableCompartmentFigure figure = (ResizableCompartmentFigure)super.createFigure();
figure.setBorder(null);
figure.getScrollPane().setBorder(null);
figure.setLayoutManager(new FillLayout());
figure.getContentPane().setLayoutManager(new FreeFormLayoutEx() {
+
@Override
public void layout(final IFigure container) {
// reset the layout so that the BorderItemsAwareFreeFormLayer fills its parent FreeformViewport
- if (!(container.getParent().getLayoutManager() instanceof FillLayout)) {
+ if(!(container.getParent().getLayoutManager() instanceof FillLayout)) {
container.getParent().setLayoutManager(new FillLayout());
}
@@ -74,20 +75,20 @@ public class CustomCompactLifelineCompartmentEditPart extends CompactLifelineCom
boolean destruction = false;
int destructionX = Integer.MAX_VALUE;
- for (int i = 0; i < children.size(); i++) {
+ for(int i = 0; i < children.size(); i++) {
final IFigure child = children.get(i);
final CrossFigure crossFigure = FigureUtils.findChildFigureInstance(child, CrossFigure.class);
- if (crossFigure != null) {
- final Rectangle constraint = (Rectangle) getConstraint(child);
+ if(crossFigure != null) {
+ final Rectangle constraint = (Rectangle)getConstraint(child);
destruction = true;
destructionX = constraint.x;
}
}
IFigure nextChild = null;
- for (int i = 0; i < children.size(); i++) {
+ for(int i = 0; i < children.size(); i++) {
final IFigure child = children.get(i);
- if (i < children.size() - 1) {
+ if(i < children.size() - 1) {
nextChild = children.get(i + 1);
} else {
nextChild = null;
@@ -97,17 +98,16 @@ public class CustomCompactLifelineCompartmentEditPart extends CompactLifelineCom
final CompactStateFigure stateInvariantFigure = FigureUtils.findChildFigureInstance(child, CompactStateFigure.class);
final VerticalMarkFigure verticalMarkFigure = FigureUtils.findChildFigureInstance(child, VerticalMarkFigure.class);
final DimensioningArrowFigure dimensioningArrowFigure = FigureUtils.findChildFigureInstance(figure, DimensioningArrowFigure.class);
- final GeneralOrderingHorizontalFigure generalOrderingHorizontalFigure = FigureUtils.findChildFigureInstance(figure,
- GeneralOrderingHorizontalFigure.class);
+ final GeneralOrderingHorizontalFigure generalOrderingHorizontalFigure = FigureUtils.findChildFigureInstance(figure, GeneralOrderingHorizontalFigure.class);
// This is the bounds that the user tries to set. We further constrain these bounds.
- final Rectangle constraint = (Rectangle) getConstraint(child);
+ final Rectangle constraint = (Rectangle)getConstraint(child);
// OccurrenceSpecification, MessageOccurrenceSpecification or DestructionOccurrenceSpecification
- if (occurrenceFigure != null) {
+ if(occurrenceFigure != null) {
final Dimension preferredSize = occurrenceFigure.getPreferredSize();
- if (nextChild != null && FigureUtils.findChildFigureInstance(nextChild, CompactStateFigure.class) != null) {
+ if(nextChild != null && FigureUtils.findChildFigureInstance(nextChild, CompactStateFigure.class) != null) {
// this is an occurrence specification marking a state change
// => center it vertically
child.setBounds(new Rectangle(constraint.x, centerY - preferredSize.height / 2, preferredSize.width, preferredSize.height));
@@ -123,12 +123,11 @@ public class CustomCompactLifelineCompartmentEditPart extends CompactLifelineCom
// let the user move the OccurrenceSpecification near the top or bottom of the
// StateInvariant on top of which it appears, and snap it to this position
- final int halfHeight = CompactStateFigure.computeHalfHeightAtAbscissa(posX - currentStateInvariantX + SmallSquareFigure.RADIUS,
- currentStateInvariantWidth, currentStateInvariantHeight, currentStateInvariantInfinite);
+ final int halfHeight = CompactStateFigure.computeHalfHeightAtAbscissa(posX - currentStateInvariantX + SmallSquareFigure.RADIUS, currentStateInvariantWidth, currentStateInvariantHeight, currentStateInvariantInfinite);
final int topPos = centerY - halfHeight - SmallSquareFigure.RADIUS;
final int bottomPos = centerY + halfHeight - SmallSquareFigure.RADIUS - 1;
int posY;
- if (Math.abs(constraint.y - topPos) < Math.abs(constraint.y - bottomPos)) {
+ if(Math.abs(constraint.y - topPos) < Math.abs(constraint.y - bottomPos)) {
posY = topPos;
} else {
posY = bottomPos;
@@ -139,18 +138,18 @@ public class CustomCompactLifelineCompartmentEditPart extends CompactLifelineCom
}
}
// StateInvariant
- else if (stateInvariantFigure != null) {
+ else if(stateInvariantFigure != null) {
final Dimension preferredSize = stateInvariantFigure.getPreferredSize();
final int height = Math.min(preferredSize.height, clientArea.height);
final int width;
// the StateInvariant stops where the next state change occurrence begins
final IFigure nextStateChangeOccurrence = findNextStateChangeOccurrence(children, i + 1);
- if (nextStateChangeOccurrence != null) {
+ if(nextStateChangeOccurrence != null) {
stateInvariantFigure.setInfinite(false);
currentStateInvariantInfinite = false;
- width = ((Rectangle) getConstraint(nextStateChangeOccurrence)).x - x;
- } else if (destruction) {
+ width = ((Rectangle)getConstraint(nextStateChangeOccurrence)).x - x;
+ } else if(destruction) {
stateInvariantFigure.setInfinite(false);
currentStateInvariantInfinite = false;
width = destructionX - x;
@@ -165,23 +164,23 @@ public class CustomCompactLifelineCompartmentEditPart extends CompactLifelineCom
currentStateInvariantWidth = width;
currentStateInvariantHeight = height;
x += width;
- } else if (verticalMarkFigure != null) {
+ } else if(verticalMarkFigure != null) {
// time observation or constraint
final Dimension size = verticalMarkFigure.getPreferredSize();
final int margin = 3;
// put it right above the StateInvariants
final int y = centerY - CompactStateFigure.PREFERRED_HEIGHT / 2 - VerticalMarkFigure.PREFERRED_HEIGHT - margin;
child.setBounds(new Rectangle(constraint.x, y, size.width, size.height));
- } else if (dimensioningArrowFigure != null) {
+ } else if(dimensioningArrowFigure != null) {
// duration observation or constraint
final Dimension size = dimensioningArrowFigure.getPreferredSize();
- if (constraint.width == Integer.MAX_VALUE) {
+ if(constraint.width == Integer.MAX_VALUE) {
// it has no end => set the right side of the compartment as the end
child.setBounds(new Rectangle(constraint.x, constraint.y, clientArea.width - constraint.x, size.height));
} else {
child.setBounds(new Rectangle(constraint.x, constraint.y, constraint.width, size.height));
}
- } else if (generalOrderingHorizontalFigure != null) {
+ } else if(generalOrderingHorizontalFigure != null) {
// general ordering
final Dimension size = generalOrderingHorizontalFigure.getPreferredSize();
child.setBounds(new Rectangle(constraint.x, constraint.y, constraint.width, size.height));
@@ -200,18 +199,18 @@ public class CustomCompactLifelineCompartmentEditPart extends CompactLifelineCom
protected static IFigure getOccurrenceChild(final IFigure child) {
IFigure occurrenceFigure = FigureUtils.findChildFigureInstance(child, SmallSquareFigure.class);
- if (occurrenceFigure == null) {
+ if(occurrenceFigure == null) {
occurrenceFigure = FigureUtils.findChildFigureInstance(child, CrossFigure.class);
}
return occurrenceFigure;
}
protected static IFigure findNextStateChangeOccurrence(final List<IFigure> children, final int startIndex) {
- for (int i = startIndex; i < children.size() - 1; i++) {
+ for(int i = startIndex; i < children.size() - 1; i++) {
final IFigure figure1 = children.get(i);
final IFigure figure2 = children.get(i + 1);
// an OccurrenceSpecification followed by a StateInvariant means a state change
- if (getOccurrenceChild(figure1) != null && FigureUtils.findChildFigureInstance(figure2, CompactStateFigure.class) != null) {
+ if(getOccurrenceChild(figure1) != null && FigureUtils.findChildFigureInstance(figure2, CompactStateFigure.class) != null) {
return figure1;
}
}
@@ -226,7 +225,7 @@ public class CustomCompactLifelineCompartmentEditPart extends CompactLifelineCom
@Override
protected void refreshVisuals() {
super.refreshVisuals();
- ((ResizableCompartmentFigure) getFigure()).getScrollPane().setScrollBarVisibility(org.eclipse.draw2d.ScrollPane.NEVER);
+ ((ResizableCompartmentFigure)getFigure()).getScrollPane().setScrollBarVisibility(org.eclipse.draw2d.ScrollPane.NEVER);
refreshBounds();
}
@@ -240,15 +239,15 @@ public class CustomCompactLifelineCompartmentEditPart extends CompactLifelineCom
@Override
public Command getCommand(final Request request) {
// redirect connection requests to the Lifeline (for MessageLost and MessageFound)
- if (request instanceof CreateConnectionRequest) {
- final CreateConnectionRequest createConnectionRequest = (CreateConnectionRequest) request;
- if (RequestConstants.REQ_CONNECTION_START.equals(request.getType())) {
- if (createConnectionRequest.getTargetEditPart() instanceof CompactLifelineCompartmentEditPartCN) {
+ if(request instanceof CreateConnectionRequest) {
+ final CreateConnectionRequest createConnectionRequest = (CreateConnectionRequest)request;
+ if(RequestConstants.REQ_CONNECTION_START.equals(request.getType())) {
+ if(createConnectionRequest.getTargetEditPart() instanceof CompactLifelineCompartmentEditPartCN) {
createConnectionRequest.setTargetEditPart(getParent());
}
return getParent().getCommand(request);
- } else if (RequestConstants.REQ_CONNECTION_END.equals(request.getType())) {
- if (createConnectionRequest.getSourceEditPart() instanceof CompactLifelineCompartmentEditPartCN) {
+ } else if(RequestConstants.REQ_CONNECTION_END.equals(request.getType())) {
+ if(createConnectionRequest.getSourceEditPart() instanceof CompactLifelineCompartmentEditPartCN) {
createConnectionRequest.setSourceEditPart(getParent());
}
return getParent().getCommand(request);
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomCompactLifelineEditPartCN.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomCompactLifelineEditPartCN.java
index 6d831269f28..3af3202be66 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomCompactLifelineEditPartCN.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomCompactLifelineEditPartCN.java
@@ -55,22 +55,23 @@ public class CustomCompactLifelineEditPartCN extends CompactLifelineEditPartCN {
final CompactLifelineFigure lifelineFigure = FigureUtils.findChildFigureInstance(nodeFigure, CompactLifelineFigure.class);
// collapses the time ruler rectangle if the time ruler is not used
lifelineFigure.getLifelineDataContainerFigure().setLayoutManager(new AbstractLayout() {
+
public void layout(final IFigure container) {
final int timeRulerHeight = Constants.TIME_RULER_HEIGHT;
final boolean displayTimeRuler = lifelineFigure.isDisplayTimeRuler();
final Rectangle clientArea = container.getClientArea();
@SuppressWarnings("unchecked")
final List<IFigure> children = container.getChildren();
- for (int i = 0; i < children.size(); i++) {
+ for(int i = 0; i < children.size(); i++) {
final IFigure child = children.get(i);
- if (child == lifelineFigure.getTimelineContainerFigure()) {
- if (displayTimeRuler) {
+ if(child == lifelineFigure.getTimelineContainerFigure()) {
+ if(displayTimeRuler) {
child.setBounds(new Rectangle(clientArea).getResized(0, -timeRulerHeight));
} else {
child.setBounds(clientArea);
}
- } else if (child == lifelineFigure.getTimeRulerContainerFigure()) {
- if (displayTimeRuler) {
+ } else if(child == lifelineFigure.getTimeRulerContainerFigure()) {
+ if(displayTimeRuler) {
final Rectangle bounds = new Rectangle(clientArea);
bounds.height = timeRulerHeight;
bounds.y = clientArea.y + clientArea.height - timeRulerHeight;
@@ -94,6 +95,7 @@ public class CustomCompactLifelineEditPartCN extends CompactLifelineEditPartCN {
public DragTracker getDragTracker(final Request request) {
// lock the drag to the containing compartment
return new DragEditPartsTrackerEx(this) {
+
@Override
protected boolean handleDragStarted() {
lockTargetEditPart(CustomCompactLifelineEditPartCN.this.getParent());
@@ -115,7 +117,7 @@ public class CustomCompactLifelineEditPartCN extends CompactLifelineEditPartCN {
/** Display feedback at the start location (where the create request was started) */
@Override
public ConnectionAnchor getTargetConnectionAnchor(final Request request) {
- if (request instanceof CreateRequest) {
+ if(request instanceof CreateRequest) {
return new XYAnchor(MessageUtils.getLastStartLocation());
}
return super.getTargetConnectionAnchor(request);
@@ -124,8 +126,8 @@ public class CustomCompactLifelineEditPartCN extends CompactLifelineEditPartCN {
/** Display feedback at the cursor location */
@Override
public ConnectionAnchor getSourceConnectionAnchor(final Request request) {
- if (request instanceof LocationRequest) {
- final LocationRequest locationRequest = (LocationRequest) request;
+ if(request instanceof LocationRequest) {
+ final LocationRequest locationRequest = (LocationRequest)request;
return new XYAnchor(locationRequest.getLocation());
}
return super.getTargetConnectionAnchor(request);
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomCompactLifelineTimeRulerCompartmentEditPartCN.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomCompactLifelineTimeRulerCompartmentEditPartCN.java
index 6ef12842d17..364c5509d55 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomCompactLifelineTimeRulerCompartmentEditPartCN.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomCompactLifelineTimeRulerCompartmentEditPartCN.java
@@ -24,7 +24,7 @@ public class CustomCompactLifelineTimeRulerCompartmentEditPartCN extends Compact
@Override
public IFigure createFigure() {
- final ResizableCompartmentFigure result = (ResizableCompartmentFigure) super.createFigure();
+ final ResizableCompartmentFigure result = (ResizableCompartmentFigure)super.createFigure();
result.setBorder(null);
result.setTitleVisibility(false);
result.setLayoutManager(new FillLayout());
@@ -40,7 +40,7 @@ public class CustomCompactLifelineTimeRulerCompartmentEditPartCN extends Compact
@Override
protected void refreshVisuals() {
super.refreshVisuals();
- ((ResizableCompartmentFigure) getFigure()).getScrollPane().setScrollBarVisibility(org.eclipse.draw2d.ScrollPane.NEVER);
+ ((ResizableCompartmentFigure)getFigure()).getScrollPane().setScrollBarVisibility(org.eclipse.draw2d.ScrollPane.NEVER);
refreshBounds();
}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomCompactStateInvariantEditPartCN.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomCompactStateInvariantEditPartCN.java
index 4ca303dd6be..9f0faf04bfc 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomCompactStateInvariantEditPartCN.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomCompactStateInvariantEditPartCN.java
@@ -44,11 +44,11 @@ public class CustomCompactStateInvariantEditPartCN extends CompactStateInvariant
public void performRequest(final Request request) {
// allow creating an OccurrenceSpecification when double-clicking on a StateInvariant line
// (in addition to the OccurrenceSpecification creation tool from the palette)
- if (request.getType() == REQ_OPEN && request instanceof LocationRequest) {
- final StateInvariant stateInvariant = (StateInvariant) ((View) getModel()).getElement();
+ if(request.getType() == REQ_OPEN && request instanceof LocationRequest) {
+ final StateInvariant stateInvariant = (StateInvariant)((View)getModel()).getElement();
final TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(stateInvariant);
// shift by 2 pixels to cut at the center of the OccurrenceSpecification
- final Point loc = new Point(((LocationRequest) request).getLocation()).translate(-SmallSquareFigure.RADIUS, 0);
+ final Point loc = new Point(((LocationRequest)request).getLocation()).translate(-SmallSquareFigure.RADIUS, 0);
final CompositeCommand compositeCommand = new CompositeCommand(Messages.CustomCompactStateInvariantEditPartCN_CreateOccurrenceSpecification);
compositeCommand.add(new CutAndInsertOccurrenceSpecificationCompactLifelineCommand(this, loc, false));
final EditPart timeline = EditPartUtils.findParentEditPartWithId(this, CompactLifelineCompartmentEditPartCN.VISUAL_ID);
@@ -62,8 +62,9 @@ public class CustomCompactStateInvariantEditPartCN extends CompactStateInvariant
@Override
protected void addBorderItem(final IFigure borderItemContainer, final IBorderItemEditPart borderItemEditPart) {
- if (borderItemEditPart instanceof StateInvariantAppliedStereotypeEditPart) {
+ if(borderItemEditPart instanceof StateInvariantAppliedStereotypeEditPart) {
final BorderItemLocator locator = new BorderItemLocator(getMainFigure(), PositionConstants.SOUTH) {
+
@Override
public int getPreferredSideOfParent() {
/*
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomCompactStateInvariantNameEditPart.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomCompactStateInvariantNameEditPart.java
index 9edb610edbe..7e29568ca08 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomCompactStateInvariantNameEditPart.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomCompactStateInvariantNameEditPart.java
@@ -26,7 +26,7 @@ public class CustomCompactStateInvariantNameEditPart extends CompactStateInvaria
@Override
public void performRequest(final Request request) {
- if (request.getType() == REQ_OPEN) {
+ if(request.getType() == REQ_OPEN) {
// double-click on the label is handled by the parent (to cut the CompactStateInvariant)
getParent().performRequest(request);
} else {
@@ -36,7 +36,7 @@ public class CustomCompactStateInvariantNameEditPart extends CompactStateInvaria
@Override
public IParser getParser() {
- if (this.parser == null) {
+ if(this.parser == null) {
this.parser = new CompactStateInvariantNameParser();
}
return this.parser;
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomDestructionOccurrenceSpecificationEditPartCN.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomDestructionOccurrenceSpecificationEditPartCN.java
index 64286448caa..68867e161a2 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomDestructionOccurrenceSpecificationEditPartCN.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomDestructionOccurrenceSpecificationEditPartCN.java
@@ -14,7 +14,6 @@ import org.eclipse.gef.DragTracker;
import org.eclipse.gef.Request;
import org.eclipse.gef.editpolicies.LayoutEditPolicy;
import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.ExternalLabelPrimaryDragRoleEditPolicy;
import org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.LayoutEditPolicyForLabel;
import org.eclipse.papyrus.uml.diagram.timing.custom.parts.NoScrollNoBorderDragEditPartsTracker;
import org.eclipse.papyrus.uml.diagram.timing.edit.parts.DestructionOccurrenceSpecificationEditPartCN;
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomDestructionOccurrenceSpecificationLabelEditPart.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomDestructionOccurrenceSpecificationLabelEditPart.java
index 314cd61c7ed..e26c8bffc85 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomDestructionOccurrenceSpecificationLabelEditPart.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomDestructionOccurrenceSpecificationLabelEditPart.java
@@ -14,6 +14,7 @@ import org.eclipse.papyrus.uml.diagram.timing.custom.parsers.OccurrenceSpecifica
import org.eclipse.papyrus.uml.diagram.timing.edit.parts.DestructionOccurrenceSpecificationLabelEditPart;
public class CustomDestructionOccurrenceSpecificationLabelEditPart extends DestructionOccurrenceSpecificationLabelEditPart {
+
private IParser parser;
public CustomDestructionOccurrenceSpecificationLabelEditPart(final View view) {
@@ -22,7 +23,7 @@ public class CustomDestructionOccurrenceSpecificationLabelEditPart extends Destr
@Override
public IParser getParser() {
- if (this.parser == null) {
+ if(this.parser == null) {
this.parser = new OccurrenceSpecificationNameParser();
}
return this.parser;
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomDurationConstraintEditPart.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomDurationConstraintEditPart.java
index 9f58d380209..80af177a20d 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomDurationConstraintEditPart.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomDurationConstraintEditPart.java
@@ -12,7 +12,6 @@ import org.eclipse.gef.DragTracker;
import org.eclipse.gef.Request;
import org.eclipse.gef.editpolicies.LayoutEditPolicy;
import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.ExternalLabelPrimaryDragRoleEditPolicy;
import org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.LayoutEditPolicyForLabel;
import org.eclipse.papyrus.uml.diagram.timing.custom.parts.NoScrollNoBorderDragEditPartsTracker;
import org.eclipse.papyrus.uml.diagram.timing.edit.parts.DurationConstraintEditPartCN;
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomDurationObservationEditPart.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomDurationObservationEditPart.java
index e3cb178b516..85f53e373ec 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomDurationObservationEditPart.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomDurationObservationEditPart.java
@@ -12,7 +12,6 @@ import org.eclipse.gef.DragTracker;
import org.eclipse.gef.Request;
import org.eclipse.gef.editpolicies.LayoutEditPolicy;
import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.ExternalLabelPrimaryDragRoleEditPolicy;
import org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.LayoutEditPolicyForLabel;
import org.eclipse.papyrus.uml.diagram.timing.custom.parts.NoScrollNoBorderDragEditPartsTracker;
import org.eclipse.papyrus.uml.diagram.timing.edit.parts.DurationObservationEditPartCN;
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomFreeTimeRulerCompartmentEditPart.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomFreeTimeRulerCompartmentEditPart.java
index a745b262e6a..457f2e5b81d 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomFreeTimeRulerCompartmentEditPart.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomFreeTimeRulerCompartmentEditPart.java
@@ -47,7 +47,7 @@ public class CustomFreeTimeRulerCompartmentEditPart extends FreeTimeRulerCompart
@Override
public IFigure createFigure() {
- final ResizableCompartmentFigure result = (ResizableCompartmentFigure) super.createFigure();
+ final ResizableCompartmentFigure result = (ResizableCompartmentFigure)super.createFigure();
result.setTitleVisibility(false);
result.setBorder(null);
result.getScrollPane().setBorder(null);
@@ -73,7 +73,7 @@ public class CustomFreeTimeRulerCompartmentEditPart extends FreeTimeRulerCompart
@Override
protected void refreshVisuals() {
super.refreshVisuals();
- ((ResizableCompartmentFigure) getFigure()).getScrollPane().setScrollBarVisibility(org.eclipse.draw2d.ScrollPane.NEVER);
+ ((ResizableCompartmentFigure)getFigure()).getScrollPane().setScrollBarVisibility(org.eclipse.draw2d.ScrollPane.NEVER);
refreshBounds();
}
@@ -95,21 +95,21 @@ public class CustomFreeTimeRulerCompartmentEditPart extends FreeTimeRulerCompart
final List<EditPart> osEditParts = new ArrayList<EditPart>();
- for (final SmallSquareFigure figure : osFigures) {
+ for(final SmallSquareFigure figure : osFigures) {
final EditPart editPart = visualPartMap.get(FigureUtils.findParentFigureInstance(figure, BorderedNodeFigure.class));
- if (editPart != null) {
+ if(editPart != null) {
osEditParts.add(editPart);
}
}
- for (final CrossFigure figure : destructionOSFigures) {
+ for(final CrossFigure figure : destructionOSFigures) {
final EditPart editPart = visualPartMap.get(FigureUtils.findParentFigureInstance(figure, BorderedNodeFigure.class));
- if (editPart != null) {
+ if(editPart != null) {
osEditParts.add(editPart);
}
}
// reset the layout so that the BorderItemsAwareFreeFormLayer fills its parent FreeformViewport
- if (!(container.getParent().getLayoutManager() instanceof FillLayout)) {
+ if(!(container.getParent().getLayoutManager() instanceof FillLayout)) {
container.getParent().setLayoutManager(new FillLayout());
}
@@ -120,22 +120,21 @@ public class CustomFreeTimeRulerCompartmentEditPart extends FreeTimeRulerCompart
@SuppressWarnings("unchecked")
final List<IFigure> children = container.getChildren();
- for (int i = 0; i < children.size(); i++) {
+ for(int i = 0; i < children.size(); i++) {
final IFigure child = children.get(i);
final List<BorderedNodeFigure> marks = FigureUtils.findChildFigureInstances(child, BorderedNodeFigure.class);
- for (final BorderedNodeFigure verticalMarkFigure : marks) {
+ for(final BorderedNodeFigure verticalMarkFigure : marks) {
final boolean compactLifeline = FigureUtils.findParentFigureInstance(verticalMarkFigure, CompactLifelineFigure.class) != null;
final boolean fullLifeline = FigureUtils.findParentFigureInstance(verticalMarkFigure, FullLifelineFigure.class) != null;
- final TickEditPart tickEditPart = (TickEditPart) visualPartMap.get(verticalMarkFigure);
+ final TickEditPart tickEditPart = (TickEditPart)visualPartMap.get(verticalMarkFigure);
final IGraphicalEditPart occurrenceSpecificationEditPart = TickUtils.findOccurrenceSpecificationEditPartFromTickEditPart(tickEditPart, viewer);
- if (occurrenceSpecificationEditPart != null) {
+ if(occurrenceSpecificationEditPart != null) {
final CompartmentEditPart timelineCompartment = EditPartUtils.findParentTimelineCompartment(occurrenceSpecificationEditPart);
- final GraphicalEditPart interactionEditPart = (InteractionEditPartTN) EditPartUtils.findParentEditPartWithId(timelineCompartment,
- InteractionEditPartTN.VISUAL_ID);
+ final GraphicalEditPart interactionEditPart = (InteractionEditPartTN)EditPartUtils.findParentEditPartWithId(timelineCompartment, InteractionEditPartTN.VISUAL_ID);
final int startX;
- if (fullLifeline) {
+ if(fullLifeline) {
startX = Constants.STATE_DEFINITIONS_WIDTH + 1;
- } else if (compactLifeline) {
+ } else if(compactLifeline) {
startX = 1;
} else {
startX = timelineCompartment.getFigure().getBounds().x - interactionEditPart.getFigure().getBounds().x;
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomFreeTimingRulerEditPart.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomFreeTimingRulerEditPart.java
index ad4dcb47152..bb5f4faf5a6 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomFreeTimingRulerEditPart.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomFreeTimingRulerEditPart.java
@@ -30,18 +30,19 @@ public class CustomFreeTimingRulerEditPart extends FreeTimingRulerEditPartCN {
protected IFigure createNodeShape() {
this.primaryShape = new TimingRulerFigure();
this.primaryShape.setLayoutManager(new FillLayout() {
+
@Override
public void layout(final IFigure container) {
- for (final Object child : container.getChildren()) {
- ((IFigure) child).setBounds(container.getBounds());
+ for(final Object child : container.getChildren()) {
+ ((IFigure)child).setBounds(container.getBounds());
}
final ShapeCompartmentFigure compartmentFigure = FigureUtils.findChildFigureInstance(container, ShapeCompartmentFigure.class);
- if (compartmentFigure != null) {
- for (final Object child : compartmentFigure.getChildren()) {
- if (child instanceof ScrollPane) {
- ((ScrollPane) child).setBounds(container.getBounds());
+ if(compartmentFigure != null) {
+ for(final Object child : compartmentFigure.getChildren()) {
+ if(child instanceof ScrollPane) {
+ ((ScrollPane)child).setBounds(container.getBounds());
// ((ScrollPane) child).setBorder(null);
- ((ScrollPane) child).setScrollBarVisibility(org.eclipse.draw2d.ScrollPane.NEVER);
+ ((ScrollPane)child).setScrollBarVisibility(org.eclipse.draw2d.ScrollPane.NEVER);
// ((ScrollPane) child).getViewport().setBounds(container.getBounds());
}
}
@@ -62,6 +63,7 @@ public class CustomFreeTimingRulerEditPart extends FreeTimingRulerEditPartCN {
public DragTracker getDragTracker(final Request request) {
// lock the drag to the containing compartment
return new DragEditPartsTrackerEx(this) {
+
@Override
protected boolean handleDragStarted() {
lockTargetEditPart(CustomFreeTimingRulerEditPart.this.getParent());
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomFullLifelineEditPartCN.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomFullLifelineEditPartCN.java
index 63d04ecbc9c..10045576637 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomFullLifelineEditPartCN.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomFullLifelineEditPartCN.java
@@ -57,22 +57,23 @@ public class CustomFullLifelineEditPartCN extends FullLifelineEditPartCN {
final FullLifelineFigure lifelineFigure = FigureUtils.findChildFigureInstance(nodeFigure, FullLifelineFigure.class);
// collapses the time ruler rectangle if the time ruler is not used
lifelineFigure.getLifelineDataContainerFigure().setLayoutManager(new AbstractLayout() {
+
public void layout(final IFigure container) {
final int timeRulerHeight = Constants.TIME_RULER_HEIGHT;
final boolean displayTimeRuler = lifelineFigure.isDisplayTimeRuler();
final Rectangle clientArea = container.getClientArea();
@SuppressWarnings("unchecked")
final List<IFigure> children = container.getChildren();
- for (int i = 0; i < children.size(); i++) {
+ for(int i = 0; i < children.size(); i++) {
final IFigure child = children.get(i);
- if (child == lifelineFigure.getChronogramContainerFigure()) {
- if (displayTimeRuler) {
+ if(child == lifelineFigure.getChronogramContainerFigure()) {
+ if(displayTimeRuler) {
child.setBounds(new Rectangle(clientArea).getResized(0, -timeRulerHeight));
} else {
child.setBounds(clientArea);
}
- } else if (child == lifelineFigure.getTimeRulerContainerFigure()) {
- if (displayTimeRuler) {
+ } else if(child == lifelineFigure.getTimeRulerContainerFigure()) {
+ if(displayTimeRuler) {
final Rectangle bounds = new Rectangle(clientArea);
bounds.height = timeRulerHeight;
bounds.y = clientArea.y + clientArea.height - timeRulerHeight;
@@ -96,6 +97,7 @@ public class CustomFullLifelineEditPartCN extends FullLifelineEditPartCN {
public DragTracker getDragTracker(final Request request) {
// lock the drag to the containing compartment
return new DragEditPartsTrackerEx(this) {
+
@Override
protected boolean handleDragStarted() {
lockTargetEditPart(CustomFullLifelineEditPartCN.this.getParent());
@@ -117,7 +119,7 @@ public class CustomFullLifelineEditPartCN extends FullLifelineEditPartCN {
/** Display feedback at the start location (where the create request was started) */
@Override
public ConnectionAnchor getTargetConnectionAnchor(final Request request) {
- if (request instanceof CreateRequest) {
+ if(request instanceof CreateRequest) {
return new XYAnchor(MessageUtils.getLastStartLocation());
}
return super.getTargetConnectionAnchor(request);
@@ -126,8 +128,8 @@ public class CustomFullLifelineEditPartCN extends FullLifelineEditPartCN {
/** Display feedback at the cursor location */
@Override
public ConnectionAnchor getSourceConnectionAnchor(final Request request) {
- if (request instanceof LocationRequest) {
- final LocationRequest locationRequest = (LocationRequest) request;
+ if(request instanceof LocationRequest) {
+ final LocationRequest locationRequest = (LocationRequest)request;
return new XYAnchor(locationRequest.getLocation());
}
return super.getTargetConnectionAnchor(request);
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomFullLifelineStateDefinitionCompartmentEditPartCN.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomFullLifelineStateDefinitionCompartmentEditPartCN.java
index b278672e246..a58cc7cb9a9 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomFullLifelineStateDefinitionCompartmentEditPartCN.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomFullLifelineStateDefinitionCompartmentEditPartCN.java
@@ -34,7 +34,7 @@ public class CustomFullLifelineStateDefinitionCompartmentEditPartCN extends Full
@Override
public IFigure createFigure() {
- final ResizableCompartmentFigure result = (ResizableCompartmentFigure) super.createFigure();
+ final ResizableCompartmentFigure result = (ResizableCompartmentFigure)super.createFigure();
result.setBorder(null);
result.getScrollPane().getContents().setBorder(null);
@@ -42,10 +42,11 @@ public class CustomFullLifelineStateDefinitionCompartmentEditPartCN extends Full
// layout StateDefinitions so that they are regularly spaced and fill the whole height
result.getContentPane().setLayoutManager(new XYLayout() {
+
@Override
public void layout(final IFigure container) {
// reset the layout so that the BorderItemsAwareFreeFormLayer fills its parent FreeformViewport
- if (!(container.getParent().getLayoutManager() instanceof FillLayout)) {
+ if(!(container.getParent().getLayoutManager() instanceof FillLayout)) {
container.getParent().setLayoutManager(new FillLayout());
}
@@ -56,7 +57,7 @@ public class CustomFullLifelineStateDefinitionCompartmentEditPartCN extends Full
final int nChildren = container.getChildren().size();
final int margin;
final int spacing;
- if (nChildren == 1) {
+ if(nChildren == 1) {
margin = clientArea.height / 2;
spacing = 0;
} else {
@@ -64,8 +65,8 @@ public class CustomFullLifelineStateDefinitionCompartmentEditPartCN extends Full
spacing = (clientArea.height - 2 * margin) / (nChildren - 1);
}
- for (int i = 0; i < nChildren; i++) {
- final IFigure child = (IFigure) container.getChildren().get(i);
+ for(int i = 0; i < nChildren; i++) {
+ final IFigure child = (IFigure)container.getChildren().get(i);
final Dimension ps = child.getPreferredSize();
final int w = ps.width;
// the height is twice as big as needed by default
@@ -94,7 +95,7 @@ public class CustomFullLifelineStateDefinitionCompartmentEditPartCN extends Full
@Override
protected void refreshVisuals() {
super.refreshVisuals();
- ((ResizableCompartmentFigure) getFigure()).getScrollPane().setScrollBarVisibility(org.eclipse.draw2d.ScrollPane.NEVER);
+ ((ResizableCompartmentFigure)getFigure()).getScrollPane().setScrollBarVisibility(org.eclipse.draw2d.ScrollPane.NEVER);
refreshBounds();
}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomFullLifelineTimeRulerCompartmentEditPartCN.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomFullLifelineTimeRulerCompartmentEditPartCN.java
index 3fb45a6ec98..71fd2b5b84b 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomFullLifelineTimeRulerCompartmentEditPartCN.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomFullLifelineTimeRulerCompartmentEditPartCN.java
@@ -24,7 +24,7 @@ public class CustomFullLifelineTimeRulerCompartmentEditPartCN extends FullLifeli
@Override
public IFigure createFigure() {
- final ResizableCompartmentFigure result = (ResizableCompartmentFigure) super.createFigure();
+ final ResizableCompartmentFigure result = (ResizableCompartmentFigure)super.createFigure();
result.setBorder(null);
result.setTitleVisibility(false);
result.setLayoutManager(new FillLayout());
@@ -40,7 +40,7 @@ public class CustomFullLifelineTimeRulerCompartmentEditPartCN extends FullLifeli
@Override
protected void refreshVisuals() {
super.refreshVisuals();
- ((ResizableCompartmentFigure) getFigure()).getScrollPane().setScrollBarVisibility(org.eclipse.draw2d.ScrollPane.NEVER);
+ ((ResizableCompartmentFigure)getFigure()).getScrollPane().setScrollBarVisibility(org.eclipse.draw2d.ScrollPane.NEVER);
refreshBounds();
}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomFullLifelineTimelineCompartmentEditPartCN.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomFullLifelineTimelineCompartmentEditPartCN.java
index c89f1b8236f..a80ee321816 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomFullLifelineTimelineCompartmentEditPartCN.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomFullLifelineTimelineCompartmentEditPartCN.java
@@ -50,20 +50,21 @@ public class CustomFullLifelineTimelineCompartmentEditPartCN extends FullLifelin
@Override
public IFigure createFigure() {
- final ResizableCompartmentFigure figure = (ResizableCompartmentFigure) super.createFigure();
+ final ResizableCompartmentFigure figure = (ResizableCompartmentFigure)super.createFigure();
figure.setBorder(null);
figure.getScrollPane().setBorder(null);
figure.setLayoutManager(new FillLayout());
figure.getContentPane().setLayoutManager(new FreeFormLayoutEx() {
+
@Override
public void layout(final IFigure container) {
final EditPartViewer viewer = CustomFullLifelineTimelineCompartmentEditPartCN.this.getRoot().getViewer();
// reset the layout so that the BorderItemsAwareFreeFormLayer fills its parent FreeformViewport
final IFigure parent = container.getParent();
- if (parent instanceof FreeformViewport) {
- final FreeformViewport freeformViewport = (FreeformViewport) parent;
- if (!(freeformViewport.getLayoutManager() instanceof FillLayout)) {
+ if(parent instanceof FreeformViewport) {
+ final FreeformViewport freeformViewport = (FreeformViewport)parent;
+ if(!(freeformViewport.getLayoutManager() instanceof FillLayout)) {
freeformViewport.setLayoutManager(new FillLayout());
}
// reset the origin if it changed (for example, clicking on a label partly
@@ -78,8 +79,8 @@ public class CustomFullLifelineTimelineCompartmentEditPartCN extends FullLifelin
@SuppressWarnings("unchecked")
final List<IFigure> children = container.getChildren();
final Rectangle[] constraints = new Rectangle[children.size()];
- for (int i = 0; i < children.size(); i++) {
- constraints[i] = (Rectangle) getConstraint(children.get(i));
+ for(int i = 0; i < children.size(); i++) {
+ constraints[i] = (Rectangle)getConstraint(children.get(i));
}
/*
@@ -108,7 +109,7 @@ public class CustomFullLifelineTimelineCompartmentEditPartCN extends FullLifelin
@Override
protected void refreshVisuals() {
super.refreshVisuals();
- ((ResizableCompartmentFigure) getFigure()).getScrollPane().setScrollBarVisibility(org.eclipse.draw2d.ScrollPane.NEVER);
+ ((ResizableCompartmentFigure)getFigure()).getScrollPane().setScrollBarVisibility(org.eclipse.draw2d.ScrollPane.NEVER);
refreshBounds();
}
@@ -122,15 +123,15 @@ public class CustomFullLifelineTimelineCompartmentEditPartCN extends FullLifelin
@Override
public Command getCommand(final Request request) {
// redirect connection requests to the Lifeline (for MessageLost and MessageFound)
- if (request instanceof CreateConnectionRequest) {
- final CreateConnectionRequest createConnectionRequest = (CreateConnectionRequest) request;
- if (RequestConstants.REQ_CONNECTION_START.equals(request.getType())) {
- if (createConnectionRequest.getTargetEditPart() instanceof FullLifelineTimelineCompartmentEditPartCN) {
+ if(request instanceof CreateConnectionRequest) {
+ final CreateConnectionRequest createConnectionRequest = (CreateConnectionRequest)request;
+ if(RequestConstants.REQ_CONNECTION_START.equals(request.getType())) {
+ if(createConnectionRequest.getTargetEditPart() instanceof FullLifelineTimelineCompartmentEditPartCN) {
createConnectionRequest.setTargetEditPart(getParent());
}
return getParent().getCommand(request);
- } else if (RequestConstants.REQ_CONNECTION_END.equals(request.getType())) {
- if (createConnectionRequest.getSourceEditPart() instanceof FullLifelineTimelineCompartmentEditPartCN) {
+ } else if(RequestConstants.REQ_CONNECTION_END.equals(request.getType())) {
+ if(createConnectionRequest.getSourceEditPart() instanceof FullLifelineTimelineCompartmentEditPartCN) {
createConnectionRequest.setSourceEditPart(getParent());
}
return getParent().getCommand(request);
@@ -140,8 +141,7 @@ public class CustomFullLifelineTimelineCompartmentEditPartCN extends FullLifelin
}
/** First pass of the layout */
- protected static void layoutOccurrenceSpecificationsAndStateInvariants(final EditPartViewer viewer, final Rectangle clientArea,
- final List<IFigure> figures, final Rectangle[] constraints) {
+ protected static void layoutOccurrenceSpecificationsAndStateInvariants(final EditPartViewer viewer, final Rectangle clientArea, final List<IFigure> figures, final Rectangle[] constraints) {
int x = clientArea.x;
int y = -1;
@@ -149,13 +149,13 @@ public class CustomFullLifelineTimelineCompartmentEditPartCN extends FullLifelin
Rectangle nextConstraint = null;
IFigure nextFigure = null;
IFigure nextChildFigure = null;
- for (int i = 0; i < figures.size(); i++) {
+ for(int i = 0; i < figures.size(); i++) {
final IFigure figure = figures.get(i);
final FullStateFigure stateInvariantFigure = FigureUtils.findChildFigureInstance(figure, FullStateFigure.class);
final SmallSquareFigure smallSquareFigure = FigureUtils.findChildFigureInstance(figure, SmallSquareFigure.class);
final CrossFigure crossFigure = FigureUtils.findChildFigureInstance(figure, CrossFigure.class);
- if (stateInvariantFigure == null && smallSquareFigure == null && crossFigure == null) {
+ if(stateInvariantFigure == null && smallSquareFigure == null && crossFigure == null) {
continue;
}
@@ -164,16 +164,16 @@ public class CustomFullLifelineTimelineCompartmentEditPartCN extends FullLifelin
nextConstraint = null;
nextFigure = null;
- for (int j = i + 1; j < figures.size(); j++) {
+ for(int j = i + 1; j < figures.size(); j++) {
final IFigure f = figures.get(j);
nextChildFigure = FigureUtils.findChildFigureInstance(f, FullStateFigure.class);
- if (nextChildFigure == null) {
+ if(nextChildFigure == null) {
nextChildFigure = FigureUtils.findChildFigureInstance(f, SmallSquareFigure.class);
}
- if (nextChildFigure == null) {
+ if(nextChildFigure == null) {
nextChildFigure = FigureUtils.findChildFigureInstance(f, CrossFigure.class);
}
- if (nextChildFigure != null) {
+ if(nextChildFigure != null) {
nextConstraint = constraints[j];
nextFigure = f;
break;
@@ -181,18 +181,18 @@ public class CustomFullLifelineTimelineCompartmentEditPartCN extends FullLifelin
}
IFigure occurrenceFigure = null;
- if (smallSquareFigure != null) {
+ if(smallSquareFigure != null) {
occurrenceFigure = smallSquareFigure;
- } else if (crossFigure != null) {
+ } else if(crossFigure != null) {
occurrenceFigure = crossFigure;
}
// OccurrenceSpecification, MessageOccurrenceSpecification or DestructionOccurrenceSpecification
- if (occurrenceFigure != null) {
+ if(occurrenceFigure != null) {
final int occurrenceY;
- if (y == -1) {
+ if(y == -1) {
// the Lifeline starts by an OccurrenceSpecification => align it with the following StateInvariant
- if (nextChildFigure instanceof FullStateFigure) {
+ if(nextChildFigure instanceof FullStateFigure) {
occurrenceY = computeVerticalPosition(nextFigure, viewer);
} else {
Activator.log.warn("The Lifeline starts by an OccurrenceSpecification not followed by a StateInvariant"); //$NON-NLS-1$
@@ -210,11 +210,11 @@ public class CustomFullLifelineTimelineCompartmentEditPartCN extends FullLifelin
}
// StateInvariant
- if (stateInvariantFigure != null) {
+ if(stateInvariantFigure != null) {
final int computedY = computeVerticalPosition(figure, viewer);
stateInvariantFigure.setPosY(computedY);
- if (y == -1) {
+ if(y == -1) {
// first state invariant
prevY = computedY;
} else {
@@ -224,7 +224,7 @@ public class CustomFullLifelineTimelineCompartmentEditPartCN extends FullLifelin
y = computedY;
final int width;
- if (nextConstraint != null) {
+ if(nextConstraint != null) {
// the StateInvariant stops where the next occurrence begins
width = nextConstraint.x - x;
} else {
@@ -232,7 +232,7 @@ public class CustomFullLifelineTimelineCompartmentEditPartCN extends FullLifelin
width = clientArea.width - x;
}
- if (prevY == y) {
+ if(prevY == y) {
// a StateInvariant on the right of an OccurrenceSpecification (or at the beginning)
figure.setBounds(new Rectangle(x, y - 5, width, 10));
} else {
@@ -248,23 +248,23 @@ public class CustomFullLifelineTimelineCompartmentEditPartCN extends FullLifelin
private static int computeVerticalPosition(final IFigure stateInvariantFigure, final EditPartViewer viewer) {
@SuppressWarnings("unchecked")
final Map<IFigure, EditPart> visualPartMap = viewer.getVisualPartMap();
- final CustomFullStateInvariantEditPartCN stateInvariantEditPart = (CustomFullStateInvariantEditPartCN) visualPartMap.get(stateInvariantFigure);
- final View stateInvariantView = (View) stateInvariantEditPart.getModel();
- final StateInvariant stateInvariant = (StateInvariant) stateInvariantView.getElement();
+ final CustomFullStateInvariantEditPartCN stateInvariantEditPart = (CustomFullStateInvariantEditPartCN)visualPartMap.get(stateInvariantFigure);
+ final View stateInvariantView = (View)stateInvariantEditPart.getModel();
+ final StateInvariant stateInvariant = (StateInvariant)stateInvariantView.getElement();
final String id = StateInvariantUtils.getStateInvariantId(stateInvariant);
- if (id == null) {
+ if(id == null) {
Activator.log.error("null id for a StateInvariant", new Exception()); //$NON-NLS-1$
return -1;
}
final View lifelineView = StateDefinitionUtils.getParentLifelineView(stateInvariantView);
final View stateDefinition = StateDefinitionUtils.getStateDefinitionViewWithId(id, lifelineView);
- if (stateDefinition == null) {
+ if(stateDefinition == null) {
Activator.log.error("No StateDefinition found for the StateInvariant (id = " + id + ")", new Exception()); //$NON-NLS-1$//$NON-NLS-2$
return -1;
}
- final StateDefinitionEditPart stateDefinitionEditPart = (StateDefinitionEditPart) viewer.getEditPartRegistry().get(stateDefinition);
+ final StateDefinitionEditPart stateDefinitionEditPart = (StateDefinitionEditPart)viewer.getEditPartRegistry().get(stateDefinition);
final IFigure stateDefinitionFigure = stateDefinitionEditPart.getFigure();
final Rectangle bounds = stateDefinitionFigure.getBounds();
final int parentY = stateDefinitionFigure.getParent().getClientArea().y;
@@ -280,17 +280,15 @@ public class CustomFullLifelineTimelineCompartmentEditPartCN extends FullLifelin
IFigure previousFigure = null;
IFigure nextFigure = null;
- for (int i = 0; i < figures.size(); i++) {
+ for(int i = 0; i < figures.size(); i++) {
final IFigure figure = figures.get(i);
- final FullStateInvariantVerticalLineFigure verticalLineFigure = FigureUtils.findChildFigureInstance(figure,
- FullStateInvariantVerticalLineFigure.class);
+ final FullStateInvariantVerticalLineFigure verticalLineFigure = FigureUtils.findChildFigureInstance(figure, FullStateInvariantVerticalLineFigure.class);
final VerticalMarkFigure verticalMarkFigure = FigureUtils.findChildFigureInstance(figure, VerticalMarkFigure.class);
final DimensioningArrowFigure dimensioningArrowFigure = FigureUtils.findChildFigureInstance(figure, DimensioningArrowFigure.class);
- final GeneralOrderingHorizontalFigure generalOrderingHorizontalFigure = FigureUtils.findChildFigureInstance(figure,
- GeneralOrderingHorizontalFigure.class);
+ final GeneralOrderingHorizontalFigure generalOrderingHorizontalFigure = FigureUtils.findChildFigureInstance(figure, GeneralOrderingHorizontalFigure.class);
nextFigure = null;
- if (i < figures.size() - 1) {
+ if(i < figures.size() - 1) {
nextFigure = figures.get(i + 1);
}
@@ -298,19 +296,19 @@ public class CustomFullLifelineTimelineCompartmentEditPartCN extends FullLifelin
final Rectangle constraint = constraints[i];
// VerticalLine
- if (verticalLineFigure != null) {
+ if(verticalLineFigure != null) {
boolean showVerticalLine = false;
- if (nextFigure != null && previousFigure != null) {
+ if(nextFigure != null && previousFigure != null) {
final Rectangle prev = previousFigure.getBounds();
final int y = prev.y + prev.height / 2;
final int x = prev.x + prev.width / 2;
final Rectangle next = nextFigure.getBounds();
final int y2 = next.y + next.height / 2;
int y1 = y;
- final int sign = (int) Math.signum(y2 - y1);
+ final int sign = (int)Math.signum(y2 - y1);
// move the start of the line outside the OccurrenceSpecification
y1 += sign * (previousFigure.getBounds().height / 2);
- if (y != y2) {
+ if(y != y2) {
showVerticalLine = true;
}
final int verticalLineBoxWidth = 10;
@@ -319,20 +317,20 @@ public class CustomFullLifelineTimelineCompartmentEditPartCN extends FullLifelin
Activator.log.warn("VerticalLine not between two Figures"); //$NON-NLS-1$
}
figure.setVisible(showVerticalLine);
- } else if (verticalMarkFigure != null) {
+ } else if(verticalMarkFigure != null) {
// time observation or constraint
final Dimension size = verticalMarkFigure.getPreferredSize();
figure.setBounds(new Rectangle(constraint.x, constraint.y, size.width, size.height));
- } else if (dimensioningArrowFigure != null) {
+ } else if(dimensioningArrowFigure != null) {
// duration observation or constraint
final Dimension size = dimensioningArrowFigure.getPreferredSize();
- if (constraint.width == Integer.MAX_VALUE) {
+ if(constraint.width == Integer.MAX_VALUE) {
// it has no end => set the right side of the compartment as the end
figure.setBounds(new Rectangle(constraint.x, constraint.y, clientArea.width - constraint.x, size.height));
} else {
figure.setBounds(new Rectangle(constraint.x, constraint.y, constraint.width, size.height));
}
- } else if (generalOrderingHorizontalFigure != null) {
+ } else if(generalOrderingHorizontalFigure != null) {
// general ordering
final Dimension size = generalOrderingHorizontalFigure.getPreferredSize();
figure.setBounds(new Rectangle(constraint.x, constraint.y, constraint.width, size.height));
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomFullStateInvariantEditPartCN.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomFullStateInvariantEditPartCN.java
index 2a81902c086..ce6f13589db 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomFullStateInvariantEditPartCN.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomFullStateInvariantEditPartCN.java
@@ -64,11 +64,11 @@ public class CustomFullStateInvariantEditPartCN extends FullStateInvariantEditPa
public void performRequest(final Request request) {
// allow creating an OccurrenceSpecification when double-clicking on a StateInvariant line
// (in addition to the OccurrenceSpecification creation tool from the palette)
- if (request.getType() == REQ_OPEN && request instanceof LocationRequest) {
- final StateInvariant stateInvariant = (StateInvariant) ((View) getModel()).getElement();
+ if(request.getType() == REQ_OPEN && request instanceof LocationRequest) {
+ final StateInvariant stateInvariant = (StateInvariant)((View)getModel()).getElement();
final TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(stateInvariant);
// shift by 2 pixels to cut at the center of the OccurrenceSpecification
- final Point loc = new Point(((LocationRequest) request).getLocation()).translate(-SmallSquareFigure.RADIUS, 0);
+ final Point loc = new Point(((LocationRequest)request).getLocation()).translate(-SmallSquareFigure.RADIUS, 0);
final CompositeCommand compositeCommand = new CompositeCommand(Messages.CustomFullStateInvariantEditPartCN_CreateOccurrenceSpecification);
compositeCommand.add(new CutAndInsertOccurrenceSpecificationCommand(this, loc, false));
final EditPart timeline = EditPartUtils.findParentEditPartWithId(this, FullLifelineTimelineCompartmentEditPartCN.VISUAL_ID);
@@ -82,20 +82,20 @@ public class CustomFullStateInvariantEditPartCN extends FullStateInvariantEditPa
@Override
public Command getCommand(final Request request) {
- if (request instanceof ChangeBoundsRequest) {
- final ChangeBoundsRequest changeBoundsRequest = (ChangeBoundsRequest) request;
+ if(request instanceof ChangeBoundsRequest) {
+ final ChangeBoundsRequest changeBoundsRequest = (ChangeBoundsRequest)request;
// we allow moving an OccurrenceSpecification on top of a StateInvariant line
// in this case, we redirect the request to the parent timeline compartment
- if (RequestUtils.isChangeBoundsRequestFor(changeBoundsRequest, UMLPackage.eINSTANCE.getOccurrenceSpecification())) {
+ if(RequestUtils.isChangeBoundsRequestFor(changeBoundsRequest, UMLPackage.eINSTANCE.getOccurrenceSpecification())) {
return getTimelineCompartmentEditPart().getCommand(request);
}
- } else if (request instanceof EditCommandRequestWrapper) {
+ } else if(request instanceof EditCommandRequestWrapper) {
// we also need to forward this request, otherwise the feedback figure stays displayed
- final EditCommandRequestWrapper editCommandRequestWrapper = (EditCommandRequestWrapper) request;
+ final EditCommandRequestWrapper editCommandRequestWrapper = (EditCommandRequestWrapper)request;
final IEditCommandRequest editCommandRequest = editCommandRequestWrapper.getEditCommandRequest();
- if (editCommandRequest instanceof MoveRequest) {
- final MoveRequest moveRequest = (MoveRequest) editCommandRequest;
- if (moveRequest.getTargetContainer() instanceof StateInvariant) {
+ if(editCommandRequest instanceof MoveRequest) {
+ final MoveRequest moveRequest = (MoveRequest)editCommandRequest;
+ if(moveRequest.getTargetContainer() instanceof StateInvariant) {
return getTimelineCompartmentEditPart().getCommand(request);
}
}
@@ -104,15 +104,15 @@ public class CustomFullStateInvariantEditPartCN extends FullStateInvariantEditPa
}
private FullLifelineTimelineCompartmentEditPartCN getTimelineCompartmentEditPart() {
- final FullLifelineTimelineCompartmentEditPartCN timelineEditPart = (FullLifelineTimelineCompartmentEditPartCN) EditPartUtils.findParentEditPartWithId(
- this, FullLifelineTimelineCompartmentEditPartCN.VISUAL_ID);
+ final FullLifelineTimelineCompartmentEditPartCN timelineEditPart = (FullLifelineTimelineCompartmentEditPartCN)EditPartUtils.findParentEditPartWithId(this, FullLifelineTimelineCompartmentEditPartCN.VISUAL_ID);
return timelineEditPart;
}
@Override
protected void addBorderItem(final IFigure borderItemContainer, final IBorderItemEditPart borderItemEditPart) {
- if (borderItemEditPart instanceof FullStateInvariantAppliedStereotypeEditPart) {
+ if(borderItemEditPart instanceof FullStateInvariantAppliedStereotypeEditPart) {
final BorderItemLocator locator = new BorderItemLocator(getMainFigure(), PositionConstants.SOUTH) {
+
@Override
public int getPreferredSideOfParent() {
/*
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomFullStateInvariantVerticalLineEditPart.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomFullStateInvariantVerticalLineEditPart.java
index d7715a6ce12..2cbad2317a4 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomFullStateInvariantVerticalLineEditPart.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomFullStateInvariantVerticalLineEditPart.java
@@ -17,6 +17,7 @@ import org.eclipse.papyrus.uml.diagram.timing.custom.parts.NoScrollNoBorderDragE
import org.eclipse.papyrus.uml.diagram.timing.edit.parts.FullStateInvariantVerticalLineEditPart;
public class CustomFullStateInvariantVerticalLineEditPart extends FullStateInvariantVerticalLineEditPart {
+
public CustomFullStateInvariantVerticalLineEditPart(final View view) {
super(view);
}
@@ -33,7 +34,7 @@ public class CustomFullStateInvariantVerticalLineEditPart extends FullStateInvar
@Override
public Command getCommand(final Request request) {
- if (request.getType() == REQ_DELETE || request.getType() == REQ_RECONNECT_TARGET) {
+ if(request.getType() == REQ_DELETE || request.getType() == REQ_RECONNECT_TARGET) {
// don't let the user remove vertical lines, or reconnect anything to a vertical line
return UnexecutableCommand.INSTANCE;
}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomGateEditPart.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomGateEditPart.java
index 3fda430acb2..18dc672871c 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomGateEditPart.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomGateEditPart.java
@@ -12,7 +12,6 @@ import org.eclipse.gef.editpolicies.LayoutEditPolicy;
import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.ExternalLabelPrimaryDragRoleEditPolicy;
import org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.LayoutEditPolicyForLabel;
import org.eclipse.papyrus.uml.diagram.timing.edit.parts.GateEditPart;
import org.eclipse.papyrus.uml.diagram.timing.edit.parts.GateLabelEditPart;
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomGeneralOrderingEditPart.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomGeneralOrderingEditPart.java
index def16e6a153..f975300e85d 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomGeneralOrderingEditPart.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomGeneralOrderingEditPart.java
@@ -12,7 +12,6 @@ import org.eclipse.gef.DragTracker;
import org.eclipse.gef.Request;
import org.eclipse.gef.editpolicies.LayoutEditPolicy;
import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.ExternalLabelPrimaryDragRoleEditPolicy;
import org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.LayoutEditPolicyForLabel;
import org.eclipse.papyrus.uml.diagram.timing.custom.parts.NoScrollNoBorderDragEditPartsTracker;
import org.eclipse.papyrus.uml.diagram.timing.edit.parts.GeneralOrderingEditPart;
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomInteractionCompartmentEditPartTN.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomInteractionCompartmentEditPartTN.java
index 07ce203cb41..83a370860e7 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomInteractionCompartmentEditPartTN.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomInteractionCompartmentEditPartTN.java
@@ -42,28 +42,29 @@ public class CustomInteractionCompartmentEditPartTN extends InteractionCompartme
@Override
public IFigure createFigure() {
- final ResizableCompartmentFigure result = (ResizableCompartmentFigure) super.createFigure();
+ final ResizableCompartmentFigure result = (ResizableCompartmentFigure)super.createFigure();
result.setTitleVisibility(false);
result.setBorder(null);
result.setLayoutManager(new FillLayout());
// each lifeline takes a height proportional to its number of states
result.getContentPane().setLayoutManager(new AbstractLayout() {
+
public void layout(final IFigure container) {
@SuppressWarnings("unchecked")
final List<IFigure> children = container.getChildren();
final Rectangle clientArea = container.getClientArea();
final Map<IFigure, Integer> numberOfStates = computeNumberOfStates(children);
double totalStates = 0;
- for (final Integer nStates : numberOfStates.values()) {
+ for(final Integer nStates : numberOfStates.values()) {
totalStates += Math.max(nStates.intValue(), 1);
}
int y = clientArea.y;
final int totalHeight = clientArea.height - Constants.MARGIN_BETWEEN_LIFELINES * (children.size() - 1);
- for (final IFigure child : children) {
+ for(final IFigure child : children) {
final Integer nStates = numberOfStates.get(child);
- if (nStates != null) {
- final int height = (int) (totalHeight * (Math.max(nStates.doubleValue(), 1) / totalStates));
+ if(nStates != null) {
+ final int height = (int)(totalHeight * (Math.max(nStates.doubleValue(), 1) / totalStates));
child.setBounds(new Rectangle(clientArea.x, y, clientArea.width, height));
y += height + Constants.MARGIN_BETWEEN_LIFELINES;
}
@@ -82,20 +83,19 @@ public class CustomInteractionCompartmentEditPartTN extends InteractionCompartme
protected Map<IFigure, Integer> computeNumberOfStates(final List<IFigure> children) {
final LinkedHashMap<IFigure, Integer> numberOfStatesPerLifeline = new LinkedHashMap<IFigure, Integer>();
final EditPartViewer viewer = CustomInteractionCompartmentEditPartTN.this.getRoot().getViewer();
- for (int i = 0; i < children.size(); i++) {
+ for(int i = 0; i < children.size(); i++) {
final IFigure child = children.get(i);
- if (FigureUtils.findChildFigureInstance(child, FullLifelineFigure.class) != null) {
+ if(FigureUtils.findChildFigureInstance(child, FullLifelineFigure.class) != null) {
@SuppressWarnings("unchecked")
final Map<IFigure, EditPart> visualPartMap = viewer.getVisualPartMap();
- final FullLifelineEditPartCN lifelineEditPart = (FullLifelineEditPartCN) visualPartMap.get(child);
- final View lifelineView = (View) lifelineEditPart.getModel();
+ final FullLifelineEditPartCN lifelineEditPart = (FullLifelineEditPartCN)visualPartMap.get(child);
+ final View lifelineView = (View)lifelineEditPart.getModel();
final int nStates = findNumberOfStatesDisplayedIn(lifelineView);
numberOfStatesPerLifeline.put(child, Integer.valueOf(nStates));
- } else if (FigureUtils.findChildFigureInstance(child, CompactLifelineFigure.class) != null) {
+ } else if(FigureUtils.findChildFigureInstance(child, CompactLifelineFigure.class) != null) {
numberOfStatesPerLifeline.put(child, Integer.valueOf(1));
} else {
- Activator.log
- .warn("Only instances of " + FullLifelineFigure.class.getSimpleName() + " are expected in the compartment " + CustomInteractionCompartmentEditPartTN.class.getSimpleName()); //$NON-NLS-1$//$NON-NLS-2$
+ Activator.log.warn("Only instances of " + FullLifelineFigure.class.getSimpleName() + " are expected in the compartment " + CustomInteractionCompartmentEditPartTN.class.getSimpleName()); //$NON-NLS-1$//$NON-NLS-2$
continue;
}
@@ -109,8 +109,8 @@ public class CustomInteractionCompartmentEditPartTN extends InteractionCompartme
@SuppressWarnings("unchecked")
final EList<View> children = stateDefinitionCompartment.getChildren();
final String stateDefID = Integer.toString(StateDefinitionEditPart.VISUAL_ID);
- for (final View view : children) {
- if (stateDefID.equals(view.getType())) {
+ for(final View view : children) {
+ if(stateDefID.equals(view.getType())) {
n++;
}
}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomInteractionEditPartTN.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomInteractionEditPartTN.java
index 850f6da8645..ba0a089badc 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomInteractionEditPartTN.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomInteractionEditPartTN.java
@@ -40,6 +40,7 @@ import org.eclipse.papyrus.uml.diagram.timing.part.UMLVisualIDRegistry;
public class CustomInteractionEditPartTN extends InteractionEditPartTN {
private static final int HEADER_HEIGHT_PADDING = 4;
+
private static final int MIN_HEADER_HEIGHT = 21;
public CustomInteractionEditPartTN(final View view) {
@@ -63,30 +64,27 @@ public class CustomInteractionEditPartTN extends InteractionEditPartTN {
@SuppressWarnings("unchecked")
final List<IFigure> children = container.getChildren();
int consumedHeight = 0;
- for (int i = 0; i < children.size(); i++) {
+ for(int i = 0; i < children.size(); i++) {
final IFigure child = children.get(i);
- if (child.equals(interactionRectangleFigure.getHeaderLabelContainer())) {
- final int height = Math.max(interactionRectangleFigure.getHeaderLabel().getPreferredSize().height + HEADER_HEIGHT_PADDING,
- MIN_HEADER_HEIGHT);
+ if(child.equals(interactionRectangleFigure.getHeaderLabelContainer())) {
+ final int height = Math.max(interactionRectangleFigure.getHeaderLabel().getPreferredSize().height + HEADER_HEIGHT_PADDING, MIN_HEADER_HEIGHT);
child.setBounds(new Rectangle(clientArea.x, clientArea.y + consumedHeight, clientArea.width, height));
consumedHeight = consumedHeight + height;
- } else if (child.equals(interactionRectangleFigure.getCompartmentFigure())) {
- child.setBounds(new Rectangle(clientArea.x, clientArea.y + consumedHeight, clientArea.width, clientArea.height - 3 - consumedHeight
- - Constants.TIME_RULER_HEIGHT));
+ } else if(child.equals(interactionRectangleFigure.getCompartmentFigure())) {
+ child.setBounds(new Rectangle(clientArea.x, clientArea.y + consumedHeight, clientArea.width, clientArea.height - 3 - consumedHeight - Constants.TIME_RULER_HEIGHT));
- } else if (child instanceof StereotypePropertiesCompartment) {
+ } else if(child instanceof StereotypePropertiesCompartment) {
final int height = child.getPreferredSize().height;
child.setBounds(new Rectangle(clientArea.x, clientArea.y + consumedHeight, clientArea.width, height));
consumedHeight += height;
- } else if (child.equals(interactionRectangleFigure.getTimeRulerContainerFigure())) {
- child.setBounds(new Rectangle(clientArea.x, clientArea.y + clientArea.height - Constants.TIME_RULER_HEIGHT, clientArea.width,
- Constants.TIME_RULER_HEIGHT));
+ } else if(child.equals(interactionRectangleFigure.getTimeRulerContainerFigure())) {
+ child.setBounds(new Rectangle(clientArea.x, clientArea.y + clientArea.height - Constants.TIME_RULER_HEIGHT, clientArea.width, Constants.TIME_RULER_HEIGHT));
consumedHeight += Constants.TIME_RULER_HEIGHT;
- } else if (i == 0 && !(child instanceof WrappingLabel)) {
+ } else if(i == 0 && !(child instanceof WrappingLabel)) {
consumedHeight = consumedHeight + child.getPreferredSize().height;
child.setBounds(new Rectangle(clientArea.x, clientArea.y, clientArea.width, consumedHeight));
} else {
- if (i == 0 && !(child instanceof WrappingLabel)) {
+ if(i == 0 && !(child instanceof WrappingLabel)) {
consumedHeight = consumedHeight + child.getPreferredSize().height;
child.setBounds(new Rectangle(clientArea.x, clientArea.y, clientArea.width, consumedHeight));
} else {
@@ -108,14 +106,14 @@ public class CustomInteractionEditPartTN extends InteractionEditPartTN {
@Override
public Command getCommand(final Request request) {
// redirect the "drop objects" request to the compartment
- if (request instanceof DropObjectsRequest) {
- final DropObjectsRequest dropObjectsRequest = (DropObjectsRequest) request;
+ if(request instanceof DropObjectsRequest) {
+ final DropObjectsRequest dropObjectsRequest = (DropObjectsRequest)request;
final EditPart compartment = EditPartUtils.findFirstChildEditPartWithId(this, InteractionCompartmentEditPartTN.VISUAL_ID);
- if (compartment != null) {
+ if(compartment != null) {
return compartment.getCommand(dropObjectsRequest);
}
Activator.log.error(new IllegalStateException("No " + InteractionCompartmentEditPartTN.class.getSimpleName() + " found in the " //$NON-NLS-1$ //$NON-NLS-2$
- + CustomInteractionEditPartTN.class.getSimpleName()));
+ + CustomInteractionEditPartTN.class.getSimpleName()));
}
return super.getCommand(request);
}
@@ -126,10 +124,10 @@ public class CustomInteractionEditPartTN extends InteractionEditPartTN {
@Override
protected EditPolicy createChildEditPolicy(final EditPart child) {
- final View childView = (View) child.getModel();
+ final View childView = (View)child.getModel();
final int visualID = UMLVisualIDRegistry.getVisualID(childView);
// don't let Gates be resized
- if (visualID == GateEditPart.VISUAL_ID) {
+ if(visualID == GateEditPart.VISUAL_ID) {
return new BorderItemSelectionEditPolicy();
}
return new NonResizableEditPolicy();
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomMessageFoundEditPart.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomMessageFoundEditPart.java
index 1de626403bb..f844d954929 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomMessageFoundEditPart.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomMessageFoundEditPart.java
@@ -23,7 +23,7 @@ public class CustomMessageFoundEditPart extends MessageFoundEditPart {
@Override
public Command getCommand(final Request request) {
- if (request instanceof BendpointRequest) {
+ if(request instanceof BendpointRequest) {
// disable bendpoints on MessageFound (to avoid a bug with anchor locations,
// and because they are not appropriate anyway)
return UnexecutableCommand.INSTANCE;
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomMessageLostEditPart.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomMessageLostEditPart.java
index 04bb402ea0f..a489825c531 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomMessageLostEditPart.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomMessageLostEditPart.java
@@ -23,7 +23,7 @@ public class CustomMessageLostEditPart extends MessageLostEditPart {
@Override
public Command getCommand(final Request request) {
- if (request instanceof BendpointRequest) {
+ if(request instanceof BendpointRequest) {
// disable bendpoints on MessageLost (to avoid a bug with anchor locations,
// and because they are not appropriate anyway)
return UnexecutableCommand.INSTANCE;
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomMessageOccurrenceSpecificationEditPartCN.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomMessageOccurrenceSpecificationEditPartCN.java
index 06acf51507a..93561b580f7 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomMessageOccurrenceSpecificationEditPartCN.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomMessageOccurrenceSpecificationEditPartCN.java
@@ -14,7 +14,6 @@ import org.eclipse.gef.DragTracker;
import org.eclipse.gef.Request;
import org.eclipse.gef.editpolicies.LayoutEditPolicy;
import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.ExternalLabelPrimaryDragRoleEditPolicy;
import org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.LayoutEditPolicyForLabel;
import org.eclipse.papyrus.uml.diagram.timing.custom.parts.NoScrollNoBorderDragEditPartsTracker;
import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageOccurrenceSpecificationEditPartCN;
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomMessageOccurrenceSpecificationLabelEditPart.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomMessageOccurrenceSpecificationLabelEditPart.java
index 9c3750bc5e7..98cc4f5d681 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomMessageOccurrenceSpecificationLabelEditPart.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomMessageOccurrenceSpecificationLabelEditPart.java
@@ -14,6 +14,7 @@ import org.eclipse.papyrus.uml.diagram.timing.custom.parsers.OccurrenceSpecifica
import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageOccurrenceSpecificationLabelEditPart;
public class CustomMessageOccurrenceSpecificationLabelEditPart extends MessageOccurrenceSpecificationLabelEditPart {
+
private IParser parser;
public CustomMessageOccurrenceSpecificationLabelEditPart(final View view) {
@@ -22,7 +23,7 @@ public class CustomMessageOccurrenceSpecificationLabelEditPart extends MessageOc
@Override
public IParser getParser() {
- if (this.parser == null) {
+ if(this.parser == null) {
this.parser = new OccurrenceSpecificationNameParser();
}
return this.parser;
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomOccurrenceSpecificationEditPartCN.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomOccurrenceSpecificationEditPartCN.java
index 11881936a4d..c5455293011 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomOccurrenceSpecificationEditPartCN.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomOccurrenceSpecificationEditPartCN.java
@@ -14,7 +14,6 @@ import org.eclipse.gef.DragTracker;
import org.eclipse.gef.Request;
import org.eclipse.gef.editpolicies.LayoutEditPolicy;
import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.ExternalLabelPrimaryDragRoleEditPolicy;
import org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.LayoutEditPolicyForLabel;
import org.eclipse.papyrus.uml.diagram.timing.custom.parts.NoScrollNoBorderDragEditPartsTracker;
import org.eclipse.papyrus.uml.diagram.timing.edit.parts.OccurrenceSpecificationEditPartCN;
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomOccurrenceSpecificationLabelEditPart.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomOccurrenceSpecificationLabelEditPart.java
index e6ca71b47ec..ac828ee1156 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomOccurrenceSpecificationLabelEditPart.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomOccurrenceSpecificationLabelEditPart.java
@@ -14,6 +14,7 @@ import org.eclipse.papyrus.uml.diagram.timing.custom.parsers.OccurrenceSpecifica
import org.eclipse.papyrus.uml.diagram.timing.edit.parts.OccurrenceSpecificationLabelEditPart;
public class CustomOccurrenceSpecificationLabelEditPart extends OccurrenceSpecificationLabelEditPart {
+
private IParser parser;
public CustomOccurrenceSpecificationLabelEditPart(final View view) {
@@ -22,7 +23,7 @@ public class CustomOccurrenceSpecificationLabelEditPart extends OccurrenceSpecif
@Override
public IParser getParser() {
- if (this.parser == null) {
+ if(this.parser == null) {
this.parser = new OccurrenceSpecificationNameParser();
}
return this.parser;
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomStateDefinitionEditPart.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomStateDefinitionEditPart.java
index f0d33eb0b2d..95c4731406a 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomStateDefinitionEditPart.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomStateDefinitionEditPart.java
@@ -59,15 +59,14 @@ public class CustomStateDefinitionEditPart extends StateDefinitionEditPart {
@Override
public Command getCommand(final Request request) {
- if (request.getType() == REQ_DELETE) {
- final FullLifelineEditPartCN lifelineEditPart = (FullLifelineEditPartCN) EditPartUtils.findParentEditPartWithId(this,
- FullLifelineEditPartCN.VISUAL_ID);
- final Lifeline lifeline = (Lifeline) ((View) lifelineEditPart.getModel()).getElement();
- final View view = (View) getModel();
+ if(request.getType() == REQ_DELETE) {
+ final FullLifelineEditPartCN lifelineEditPart = (FullLifelineEditPartCN)EditPartUtils.findParentEditPartWithId(this, FullLifelineEditPartCN.VISUAL_ID);
+ final Lifeline lifeline = (Lifeline)((View)lifelineEditPart.getModel()).getElement();
+ final View view = (View)getModel();
final String id = StateDefinitionUtils.getStateDefinitionViewID(view);
- if (lifeline.getInteraction() != null) {
+ if(lifeline.getInteraction() != null) {
final List<StateInvariant> stateInvariants = StateInvariantUtils.findStateInvariantsWithId(id, lifeline.getInteraction());
- if (stateInvariants.size() > 0) {
+ if(stateInvariants.size() > 0) {
// cannot delete a StateDefinition used in a StateInvariant
return UnexecutableCommand.INSTANCE;
}
@@ -81,7 +80,7 @@ public class CustomStateDefinitionEditPart extends StateDefinitionEditPart {
return compoundCommand;
}
- if (request.getType() == REQ_RECONNECT_TARGET) {
+ if(request.getType() == REQ_RECONNECT_TARGET) {
// don't let the user reconnect anything to a state definition
return UnexecutableCommand.INSTANCE;
}
@@ -94,7 +93,7 @@ public class CustomStateDefinitionEditPart extends StateDefinitionEditPart {
// There is no semantic element, so we return null in order for Papyrus to handle
// the delete menu action enablement correctly.
// XXX warning: this might cause unforeseen bugs somewhere else.
- if (key == EObject.class) {
+ if(key == EObject.class) {
return null;
}
return super.getAdapter(key);
@@ -104,6 +103,7 @@ public class CustomStateDefinitionEditPart extends StateDefinitionEditPart {
public DragTracker getDragTracker(final Request request) {
// lock the drag to the containing compartment
return new DragEditPartsTrackerEx(this) {
+
@Override
protected boolean handleDragStarted() {
lockTargetEditPart(CustomStateDefinitionEditPart.this.getParent());
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomStateDefinitionLabelEditPart.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomStateDefinitionLabelEditPart.java
index 6b6905a82fb..86f6a82aeb0 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomStateDefinitionLabelEditPart.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomStateDefinitionLabelEditPart.java
@@ -28,7 +28,7 @@ public class CustomStateDefinitionLabelEditPart extends StateDefinitionLabelEdit
@Override
public Command getCommand(final Request request) {
- if (request.getType() == REQ_DELETE) {
+ if(request.getType() == REQ_DELETE) {
// if the StateDefinitionLabel is selected, then delete the parent StateDefinition
return getParent().getCommand(request);
}
@@ -41,7 +41,7 @@ public class CustomStateDefinitionLabelEditPart extends StateDefinitionLabelEdit
*/
@Override
public IParser getParser() {
- if (this.parser == null) {
+ if(this.parser == null) {
this.parser = new StateDefinitionParser();
}
return this.parser;
@@ -53,7 +53,7 @@ public class CustomStateDefinitionLabelEditPart extends StateDefinitionLabelEdit
// There is no semantic element, so we return null in order for Papyrus to handle
// the delete menu action enablement correctly.
// XXX warning: this might cause unforeseen bugs somewhere else.
- if (key == EObject.class) {
+ if(key == EObject.class) {
return null;
}
return super.getAdapter(key);
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomTickEditPart.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomTickEditPart.java
index b04f6ac382c..3ab76e8ec7d 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomTickEditPart.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomTickEditPart.java
@@ -14,7 +14,6 @@ import org.eclipse.gef.DragTracker;
import org.eclipse.gef.Request;
import org.eclipse.gef.editpolicies.LayoutEditPolicy;
import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.ExternalLabelPrimaryDragRoleEditPolicy;
import org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.LayoutEditPolicyForLabel;
import org.eclipse.papyrus.uml.diagram.timing.custom.parts.NoScrollNoBorderDragEditPartsTracker;
import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TickEditPart;
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomTimeConstraintEditPart.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomTimeConstraintEditPart.java
index f5d9e9b3f6f..9af67319b9b 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomTimeConstraintEditPart.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomTimeConstraintEditPart.java
@@ -14,7 +14,6 @@ import org.eclipse.gef.DragTracker;
import org.eclipse.gef.Request;
import org.eclipse.gef.editpolicies.LayoutEditPolicy;
import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.ExternalLabelPrimaryDragRoleEditPolicy;
import org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.LayoutEditPolicyForLabel;
import org.eclipse.papyrus.uml.diagram.timing.custom.parts.NoScrollNoBorderDragEditPartsTracker;
import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimeConstraintEditPart;
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomTimeObservationEditPart.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomTimeObservationEditPart.java
index a2a2ff2ad3a..12d69cc56e1 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomTimeObservationEditPart.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomTimeObservationEditPart.java
@@ -14,7 +14,6 @@ import org.eclipse.gef.DragTracker;
import org.eclipse.gef.Request;
import org.eclipse.gef.editpolicies.LayoutEditPolicy;
import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.ExternalLabelPrimaryDragRoleEditPolicy;
import org.eclipse.papyrus.uml.diagram.timing.custom.edit.policies.LayoutEditPolicyForLabel;
import org.eclipse.papyrus.uml.diagram.timing.custom.parts.NoScrollNoBorderDragEditPartsTracker;
import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimeObservationEditPart;
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomTimeRulerCompartmentEditPartCN.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomTimeRulerCompartmentEditPartCN.java
index 2b761123e10..3b3761502ed 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomTimeRulerCompartmentEditPartCN.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomTimeRulerCompartmentEditPartCN.java
@@ -23,7 +23,7 @@ public class CustomTimeRulerCompartmentEditPartCN extends TimeRulerCompartmentEd
@Override
public IFigure createFigure() {
- final ResizableCompartmentFigure result = (ResizableCompartmentFigure) super.createFigure();
+ final ResizableCompartmentFigure result = (ResizableCompartmentFigure)super.createFigure();
result.setTitleVisibility(false);
result.setLayoutManager(new FillLayout());
result.getContentPane().setLayoutManager(new TimeRulerLayout());
@@ -38,7 +38,7 @@ public class CustomTimeRulerCompartmentEditPartCN extends TimeRulerCompartmentEd
@Override
protected void refreshVisuals() {
super.refreshVisuals();
- ((ResizableCompartmentFigure) getFigure()).getScrollPane().setScrollBarVisibility(org.eclipse.draw2d.ScrollPane.NEVER);
+ ((ResizableCompartmentFigure)getFigure()).getScrollPane().setScrollBarVisibility(org.eclipse.draw2d.ScrollPane.NEVER);
refreshBounds();
}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomTimingDiagramEditPart.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomTimingDiagramEditPart.java
index 53a5cea8884..0207d71df26 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomTimingDiagramEditPart.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomTimingDiagramEditPart.java
@@ -21,6 +21,7 @@ import org.eclipse.papyrus.uml.diagram.timing.edit.parts.InteractionEditPartTN;
import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimingDiagramEditPart;
public class CustomTimingDiagramEditPart extends TimingDiagramEditPart {
+
public CustomTimingDiagramEditPart(final View view) {
super(view);
}
@@ -28,7 +29,7 @@ public class CustomTimingDiagramEditPart extends TimingDiagramEditPart {
@SuppressWarnings("unchecked")
@Override
public Command getCommand(final Request request) {
- if (request.getType() == RequestConstants.REQ_DROP && !canBeDropped(((GroupRequest) request).getEditParts())) {
+ if(request.getType() == RequestConstants.REQ_DROP && !canBeDropped(((GroupRequest)request).getEditParts())) {
// this fixes the bug where an OccurrenceSpecification could be moved out of its timeline
return UnexecutableCommand.INSTANCE;
}
@@ -36,8 +37,8 @@ public class CustomTimingDiagramEditPart extends TimingDiagramEditPart {
}
private static boolean canBeDropped(final List<EditPart> editParts) {
- for (final EditPart editPart : editParts) {
- if (!(editPart instanceof InteractionEditPartTN)) {
+ for(final EditPart editPart : editParts) {
+ if(!(editPart instanceof InteractionEditPartTN)) {
return false;
}
}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomUMLEditPartFactory.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomUMLEditPartFactory.java
index a64aab50a8a..795f571b4ed 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomUMLEditPartFactory.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/parts/CustomUMLEditPartFactory.java
@@ -50,12 +50,13 @@ import org.eclipse.papyrus.uml.diagram.timing.edit.parts.UMLEditPartFactory;
import org.eclipse.papyrus.uml.diagram.timing.part.UMLVisualIDRegistry;
public class CustomUMLEditPartFactory extends UMLEditPartFactory {
+
@Override
public EditPart createEditPart(final EditPart context, final Object model) {
- if (model instanceof View) {
- final View view = (View) model;
+ if(model instanceof View) {
+ final View view = (View)model;
final int visualID = UMLVisualIDRegistry.getVisualID(view);
- switch (visualID) {
+ switch(visualID) {
case TimingDiagramEditPart.VISUAL_ID:// 1
return new CustomTimingDiagramEditPart(view);
case InteractionEditPartTN.VISUAL_ID:// 2
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/AbstractTimelineLayoutPolicy.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/AbstractTimelineLayoutPolicy.java
index 28d29ec4373..f32ec34a57d 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/AbstractTimelineLayoutPolicy.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/AbstractTimelineLayoutPolicy.java
@@ -59,16 +59,16 @@ public class AbstractTimelineLayoutPolicy extends XYLayoutEditPolicy {
@Override
public Command getCommand(final Request request) {
- if (request instanceof ChangeBoundsRequest && request.getType() == RequestConstants.REQ_ADD) {
+ if(request instanceof ChangeBoundsRequest && request.getType() == RequestConstants.REQ_ADD) {
// deny adding an element into another element (since this breaks everything)
request.setType(REQ_MOVE_CHILDREN);
}
- if (request == UPDATE_LAYOUT_REQUEST) {
+ if(request == UPDATE_LAYOUT_REQUEST) {
return getUpdateTimeElementsCommand();
}
final Command superCommand = super.getCommand(request);
// update the locations of time elements each time an element is added or moved in the timeline
- if (superCommand != null && (request instanceof ChangeBoundsRequest || request.getType() == RequestConstants.REQ_CREATE)) {
+ if(superCommand != null && (request instanceof ChangeBoundsRequest || request.getType() == RequestConstants.REQ_CREATE)) {
final CompoundCommand compoundCommand = new CompoundCommand();
compoundCommand.add(superCommand);
compoundCommand.add(getUpdateTimeElementsCommand());
@@ -78,33 +78,33 @@ public class AbstractTimelineLayoutPolicy extends XYLayoutEditPolicy {
}
/**
- * Returns a command that moves the given node (that represents an OccurrenceSpecification) <code>moveDeltaX</code>
- * pixels to the right (or left if negative).
+ * Returns a command that moves the given node (that represents an OccurrenceSpecification) <code>moveDeltaX</code> pixels to the right (or left
+ * if negative).
*
* @param occurrenceSpecificationNode
- * the node to move
+ * the node to move
* @param moveDelta
- * how much to move
+ * how much to move
* @param timelineCompartmentView
- * the parent compartment
+ * the parent compartment
* @param occurrenceSpecificationIndex
- * the index of the OccurrenceSpecification Node in its parent compartment
+ * the index of the OccurrenceSpecification Node in its parent compartment
* @param nodesToIgnore
- * these nodes will not constrain the new position
+ * these nodes will not constrain the new position
* @return the command
*/
- protected static Command getMoveOccurrenceSpecificationCommand(final Node occurrenceSpecificationNode, final Point moveDelta,
- final View timelineCompartmentView, final int occurrenceSpecificationIndex, final List<Node> nodesToIgnore) {
+ protected static Command getMoveOccurrenceSpecificationCommand(final Node occurrenceSpecificationNode, final Point moveDelta, final View timelineCompartmentView, final int occurrenceSpecificationIndex, final List<Node> nodesToIgnore) {
final LayoutConstraint layoutConstraint = occurrenceSpecificationNode.getLayoutConstraint();
- if (layoutConstraint instanceof Location) {
- final Location location = (Location) layoutConstraint;
+ if(layoutConstraint instanceof Location) {
+ final Location location = (Location)layoutConstraint;
final int posX = location.getX() + moveDelta.x;
final int posY = location.getY() + moveDelta.y;
final int min = findMin(timelineCompartmentView, occurrenceSpecificationIndex, nodesToIgnore);
final int max = findMax(timelineCompartmentView, occurrenceSpecificationIndex, nodesToIgnore);
- final OccurrenceSpecification occurrenceSpecification = (OccurrenceSpecification) occurrenceSpecificationNode.getElement();
+ final OccurrenceSpecification occurrenceSpecification = (OccurrenceSpecification)occurrenceSpecificationNode.getElement();
final TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(occurrenceSpecification);
return new ICommandProxy(new AbstractTransactionalCommand(editingDomain, Messages.AbstractTimelineLayoutPolicy_MoveOccurrenceSpecification, null) {
+
@Override
protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
final Location loc = NotationFactory.eINSTANCE.createLocation();
@@ -124,23 +124,23 @@ public class AbstractTimelineLayoutPolicy extends XYLayoutEditPolicy {
* Find the maximum abscissa of the OccurrenceSpecification at the given index
*
* @param timelineCompartmentView
- * the parent timeline compartment view
+ * the parent timeline compartment view
* @param index
- * the index of the OccurrenceSpecification in the compartment view's children
+ * the index of the OccurrenceSpecification in the compartment view's children
* @param nodesToIgnore
* @param nodesToIgnore
- * these nodes will be ignored when computing the maximum position
+ * these nodes will be ignored when computing the maximum position
* @return the maximum abscissa
*/
protected static int findMax(final View timelineCompartmentView, final int index, final List<Node> nodesToIgnore) {
@SuppressWarnings("unchecked")
final EList<View> children = timelineCompartmentView.getChildren();
- for (int i = index + 1; i < children.size(); i++) {
+ for(int i = index + 1; i < children.size(); i++) {
final View childView = children.get(i);
- if (!nodesToIgnore.contains(childView) && childView.getElement() instanceof OccurrenceSpecification) {
- final LayoutConstraint layoutConstraint = ((Node) childView).getLayoutConstraint();
- if (layoutConstraint instanceof Location) {
- final Location location = (Location) layoutConstraint;
+ if(!nodesToIgnore.contains(childView) && childView.getElement() instanceof OccurrenceSpecification) {
+ final LayoutConstraint layoutConstraint = ((Node)childView).getLayoutConstraint();
+ if(layoutConstraint instanceof Location) {
+ final Location location = (Location)layoutConstraint;
return location.getX() - Constants.MINIMUM_DISTANCE_BETWEEN_OCCURRENCE_SPECIFICATIONS;
}
}
@@ -152,22 +152,22 @@ public class AbstractTimelineLayoutPolicy extends XYLayoutEditPolicy {
* Find the minimum abscissa of the OccurrenceSpecification at the given index
*
* @param timelineCompartmentView
- * the parent timeline compartment view
+ * the parent timeline compartment view
* @param index
- * the index of the OccurrenceSpecification in the compartment view's children
+ * the index of the OccurrenceSpecification in the compartment view's children
* @param nodesToIgnore
- * these nodes will be ignored when computing the minimum position
+ * these nodes will be ignored when computing the minimum position
* @return the minimum abscissa
*/
protected static int findMin(final View timelineCompartmentView, final int index, final List<Node> nodesToIgnore) {
@SuppressWarnings("unchecked")
final EList<View> children = timelineCompartmentView.getChildren();
- for (int i = index - 1; i >= 0; i--) {
+ for(int i = index - 1; i >= 0; i--) {
final View childView = children.get(i);
- if (!nodesToIgnore.contains(childView) && childView.getElement() instanceof OccurrenceSpecification) {
- final LayoutConstraint layoutConstraint = ((Node) childView).getLayoutConstraint();
- if (layoutConstraint instanceof Location) {
- final Location location = (Location) layoutConstraint;
+ if(!nodesToIgnore.contains(childView) && childView.getElement() instanceof OccurrenceSpecification) {
+ final LayoutConstraint layoutConstraint = ((Node)childView).getLayoutConstraint();
+ if(layoutConstraint instanceof Location) {
+ final Location location = (Location)layoutConstraint;
return location.getX() + Constants.MINIMUM_DISTANCE_BETWEEN_OCCURRENCE_SPECIFICATIONS;
}
}
@@ -177,57 +177,58 @@ public class AbstractTimelineLayoutPolicy extends XYLayoutEditPolicy {
/** Returns a command that updates the positions of time elements, relative to the element they are attached to */
protected Command getUpdateTimeElementsCommand() {
- final GraphicalEditPart timelineCompartmentEditPart = (GraphicalEditPart) getHost();
- final Node compartmentView = (Node) timelineCompartmentEditPart.getModel();
+ final GraphicalEditPart timelineCompartmentEditPart = (GraphicalEditPart)getHost();
+ final Node compartmentView = (Node)timelineCompartmentEditPart.getModel();
final boolean compact = timelineCompartmentEditPart instanceof CompactLifelineCompartmentEditPartCN;
final int width = timelineCompartmentEditPart.getFigure().getSize().width;
final TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(compartmentView);
return new ICommandProxy(new AbstractTransactionalCommand(editingDomain, Messages.AbstractTimelineLayoutPolicy_UpdateLocationOfTimeElements, null) {
+
@Override
protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
@SuppressWarnings("unchecked")
final EList<View> children = compartmentView.getChildren();
- for (final View child : children) {
+ for(final View child : children) {
final EObject element = child.getElement();
- if (element instanceof TimeObservation) {
- final TimeObservation timeObservation = (TimeObservation) element;
- final Node timeObservationNode = ((Node) child);
+ if(element instanceof TimeObservation) {
+ final TimeObservation timeObservation = (TimeObservation)element;
+ final Node timeObservationNode = ((Node)child);
updateTimeElementLocation(timeObservationNode, timeObservation.getEvent(), children, compact, width);
- } else if (element instanceof TimeConstraint) {
- final TimeConstraint timeConstraint = (TimeConstraint) element;
- final Node timeConstraintNode = ((Node) child);
+ } else if(element instanceof TimeConstraint) {
+ final TimeConstraint timeConstraint = (TimeConstraint)element;
+ final Node timeConstraintNode = ((Node)child);
final EList<Element> constrainedElements = timeConstraint.getConstrainedElements();
- if (constrainedElements.size() > 0) {
+ if(constrainedElements.size() > 0) {
final Element constrainedElement = constrainedElements.get(0);
updateTimeElementLocation(timeConstraintNode, constrainedElement, children, compact, width);
}
- } else if (element instanceof DurationObservation) {
- final DurationObservation durationObservation = (DurationObservation) element;
- final Node durationObservationNode = ((Node) child);
+ } else if(element instanceof DurationObservation) {
+ final DurationObservation durationObservation = (DurationObservation)element;
+ final Node durationObservationNode = ((Node)child);
final EList<NamedElement> events = durationObservation.getEvents();
- if (events.size() == 2) {
+ if(events.size() == 2) {
final Element startElement = events.get(0);
final Element endElement = events.get(1);
updateDurationElementLocation(durationObservationNode, startElement, endElement, children);
- } else if (events.size() == 1) {
+ } else if(events.size() == 1) {
final Element startEndElement = events.get(0);
updateDurationElementLocation(durationObservationNode, startEndElement, startEndElement, children);
}
- } else if (element instanceof DurationConstraint) {
- final DurationConstraint durationConstraint = (DurationConstraint) element;
- final Node durationConstraintNode = ((Node) child);
+ } else if(element instanceof DurationConstraint) {
+ final DurationConstraint durationConstraint = (DurationConstraint)element;
+ final Node durationConstraintNode = ((Node)child);
final EList<Element> elements = durationConstraint.getConstrainedElements();
- if (elements.size() == 2) {
+ if(elements.size() == 2) {
final Element startElement = elements.get(0);
final Element endElement = elements.get(1);
updateDurationElementLocation(durationConstraintNode, startElement, endElement, children);
- } else if (elements.size() == 1) {
+ } else if(elements.size() == 1) {
final Element startEndElement = elements.get(0);
updateDurationElementLocation(durationConstraintNode, startEndElement, startEndElement, children);
}
- } else if (element instanceof GeneralOrdering) {
- final GeneralOrdering generalOrdering = (GeneralOrdering) element;
- final Node generalOrderingNode = ((Node) child);
+ } else if(element instanceof GeneralOrdering) {
+ final GeneralOrdering generalOrdering = (GeneralOrdering)element;
+ final Node generalOrderingNode = ((Node)child);
final OccurrenceSpecification before = generalOrdering.getBefore();
final OccurrenceSpecification after = generalOrdering.getAfter();
@@ -243,37 +244,36 @@ public class AbstractTimelineLayoutPolicy extends XYLayoutEditPolicy {
* Set the horizontal location of the given time element View, so that it is aligned with its associated element
*
* @param timeElementNode
- * the element to align
+ * the element to align
* @param alignmentElement
- * the element to align to
+ * the element to align to
* @param timelineViews
- * the views contained in the timeline
+ * the views contained in the timeline
* @param compact
- * whether this is a compact timeline
+ * whether this is a compact timeline
* @param max
- * the position to give the element if it has no end
+ * the position to give the element if it has no end
*/
- protected static void updateTimeElementLocation(final Node timeElementNode, final EObject alignmentElement, final EList<View> timelineViews,
- final boolean compact, final int max) {
+ protected static void updateTimeElementLocation(final Node timeElementNode, final EObject alignmentElement, final EList<View> timelineViews, final boolean compact, final int max) {
int occurrencePositionBefore = -1;
int occurrencePositionAfter = -1;
int lastOccurrencePosition = -1;
boolean after = false;
- for (final View view : timelineViews) {
- if (view instanceof Node && ViewUtils.isViewFor(view, UMLPackage.eINSTANCE.getOccurrenceSpecification())) {
- final Node node = (Node) view;
+ for(final View view : timelineViews) {
+ if(view instanceof Node && ViewUtils.isViewFor(view, UMLPackage.eINSTANCE.getOccurrenceSpecification())) {
+ final Node node = (Node)view;
final LayoutConstraint layoutConstraint = node.getLayoutConstraint();
- if (layoutConstraint instanceof Location) {
- final Location location = (Location) layoutConstraint;
+ if(layoutConstraint instanceof Location) {
+ final Location location = (Location)layoutConstraint;
lastOccurrencePosition = location.getX();
}
}
- if (after && view instanceof Node && ViewUtils.isViewFor(view, UMLPackage.eINSTANCE.getStateInvariant())) {
+ if(after && view instanceof Node && ViewUtils.isViewFor(view, UMLPackage.eINSTANCE.getStateInvariant())) {
// we found the first state change after the alignmentElement => memorize the occurrence position
occurrencePositionAfter = lastOccurrencePosition;
after = false;
}
- if (view.getElement() == alignmentElement) {
+ if(view.getElement() == alignmentElement) {
// memorize the first occurrence position before the alignmentElement
occurrencePositionBefore = lastOccurrencePosition;
after = true;
@@ -282,26 +282,26 @@ public class AbstractTimelineLayoutPolicy extends XYLayoutEditPolicy {
boolean firstEvent = true;
final EObject element = timeElementNode.getElement();
- if (element instanceof TimeObservation) {
- final TimeObservation timeObservation = (TimeObservation) element;
+ if(element instanceof TimeObservation) {
+ final TimeObservation timeObservation = (TimeObservation)element;
firstEvent = timeObservation.isFirstEvent();
- } else if (element instanceof TimeConstraint) {
- final TimeConstraint timeConstraint = (TimeConstraint) element;
+ } else if(element instanceof TimeConstraint) {
+ final TimeConstraint timeConstraint = (TimeConstraint)element;
firstEvent = timeConstraint.isFirstEvent();
}
- if (firstEvent) {
- if (occurrencePositionBefore != -1) {
+ if(firstEvent) {
+ if(occurrencePositionBefore != -1) {
setTimeElementNodeLocation(timeElementNode, occurrencePositionBefore);
} else {
- if (compact) {
+ if(compact) {
setTimeElementNodeLocation(timeElementNode, CustomCompactLifelineCompartmentEditPart.FIRST_STATE_OFFSET);
} else {
setTimeElementNodeLocation(timeElementNode, 0);
}
}
} else {
- if (occurrencePositionAfter != -1) {
+ if(occurrencePositionAfter != -1) {
setTimeElementNodeLocation(timeElementNode, occurrencePositionAfter);
} else {
// the margin avoids the element pushing the rest outside
@@ -316,44 +316,43 @@ public class AbstractTimelineLayoutPolicy extends XYLayoutEditPolicy {
* and end elements
*
* @param durationElementNode
- * the element to align
+ * the element to align
* @param startElement
- * the start element of the duration
+ * the start element of the duration
* @param endElement
- * the end element of the duration
+ * the end element of the duration
* @param timelineViews
- * the views contained in the timeline
+ * the views contained in the timeline
*/
- protected void updateDurationElementLocation(final Node durationElementNode, final Element startElement, final Element endElement,
- final EList<View> timelineViews) {
+ protected void updateDurationElementLocation(final Node durationElementNode, final Element startElement, final Element endElement, final EList<View> timelineViews) {
int lastOccurrencePosition = getOriginX();
int startPos = getOriginX();
int endPos = -1;
boolean onEndElement = false;
- for (final View view : timelineViews) {
- if (view instanceof Node) {
- final Node node = (Node) view;
+ for(final View view : timelineViews) {
+ if(view instanceof Node) {
+ final Node node = (Node)view;
final LayoutConstraint layoutConstraint = node.getLayoutConstraint();
- final Location location = (Location) layoutConstraint;
- if (onEndElement && ViewUtils.isViewFor(view, UMLPackage.eINSTANCE.getDestructionOccurrenceSpecification())) {
+ final Location location = (Location)layoutConstraint;
+ if(onEndElement && ViewUtils.isViewFor(view, UMLPackage.eINSTANCE.getDestructionOccurrenceSpecification())) {
// if there is a DestructionOccurrenceSpecification, then the duration must end on it
endPos = location.getX() + SmallSquareFigure.RADIUS + 1;
onEndElement = false;
}
- if (ViewUtils.isViewFor(view, UMLPackage.eINSTANCE.getOccurrenceSpecification())) {
+ if(ViewUtils.isViewFor(view, UMLPackage.eINSTANCE.getOccurrenceSpecification())) {
lastOccurrencePosition = location.getX();
- } else if (ViewUtils.isViewFor(view, UMLPackage.eINSTANCE.getStateInvariant())) {
- if (onEndElement) {
+ } else if(ViewUtils.isViewFor(view, UMLPackage.eINSTANCE.getStateInvariant())) {
+ if(onEndElement) {
endPos = lastOccurrencePosition + SmallSquareFigure.RADIUS + 1;
onEndElement = false;
}
}
}
- if (view.getElement() == startElement) {
+ if(view.getElement() == startElement) {
startPos = lastOccurrencePosition + SmallSquareFigure.RADIUS;
}
- if (view.getElement() == endElement) {
- if (endElement instanceof OccurrenceSpecification) {
+ if(view.getElement() == endElement) {
+ if(endElement instanceof OccurrenceSpecification) {
endPos = lastOccurrencePosition + SmallSquareFigure.RADIUS + 1;
} else {
// on a StateInvariant => the next state change (an OccurrenceSpecification followed by
@@ -363,7 +362,7 @@ public class AbstractTimelineLayoutPolicy extends XYLayoutEditPolicy {
}
}
- if (endPos == -1) {
+ if(endPos == -1) {
// the endElement has no end
endPos = Integer.MAX_VALUE;
}
@@ -386,13 +385,13 @@ public class AbstractTimelineLayoutPolicy extends XYLayoutEditPolicy {
final Location timeElementLocation;
final int y;
// it is a Bounds element when created; we change it to a Location
- if (layoutConstraint instanceof Bounds) {
- final Bounds initialBounds = (Bounds) layoutConstraint;
+ if(layoutConstraint instanceof Bounds) {
+ final Bounds initialBounds = (Bounds)layoutConstraint;
timeElementLocation = NotationFactory.eINSTANCE.createLocation();
// place it above the location where the user clicked
y = initialBounds.getY() - VerticalMarkFigure.PREFERRED_HEIGHT - 5;
- } else if (layoutConstraint instanceof Location) {
- timeElementLocation = (Location) layoutConstraint;
+ } else if(layoutConstraint instanceof Location) {
+ timeElementLocation = (Location)layoutConstraint;
y = timeElementLocation.getY();
} else {
timeElementLocation = NotationFactory.eINSTANCE.createLocation();
@@ -408,24 +407,24 @@ public class AbstractTimelineLayoutPolicy extends XYLayoutEditPolicy {
* Set the location of the given duration node
*
* @param durationElementNode
- * the node to position
+ * the node to position
* @param startPos
- * the horizontal starting position
+ * the horizontal starting position
* @param endPos
- * the horizontal ending position
+ * the horizontal ending position
*/
private static void setDurationElementNodeLocation(final Node durationElementNode, final int startPos, final int endPos) {
final LayoutConstraint layoutConstraint = durationElementNode.getLayoutConstraint();
final Bounds bounds;
- if (layoutConstraint instanceof Bounds) {
- bounds = (Bounds) layoutConstraint;
+ if(layoutConstraint instanceof Bounds) {
+ bounds = (Bounds)layoutConstraint;
} else {
bounds = NotationFactory.eINSTANCE.createBounds();
durationElementNode.setLayoutConstraint(bounds);
}
bounds.setX(startPos);
- if (endPos == Integer.MAX_VALUE) {
+ if(endPos == Integer.MAX_VALUE) {
bounds.setWidth(Integer.MAX_VALUE);
} else {
bounds.setWidth(endPos - startPos);
@@ -433,36 +432,34 @@ public class AbstractTimelineLayoutPolicy extends XYLayoutEditPolicy {
}
/**
- * Set the location of the given GeneralOrdering node so that it is aligned with the given <code>before</code> and
- * <code>after</code> occurrences.
+ * Set the location of the given GeneralOrdering node so that it is aligned with the given <code>before</code> and <code>after</code> occurrences.
*
* @param generalOrderingNode
- * the node to align
+ * the node to align
* @param before
- * the start element
+ * the start element
* @param after
- * the end element
+ * the end element
* @param timelineViews
- * all the Views in the timeline
+ * all the Views in the timeline
*/
- protected static void updateGeneralOrderingLocation(final Node generalOrderingNode, final OccurrenceSpecification before,
- final OccurrenceSpecification after, final EList<View> timelineViews) {
+ protected static void updateGeneralOrderingLocation(final Node generalOrderingNode, final OccurrenceSpecification before, final OccurrenceSpecification after, final EList<View> timelineViews) {
int startPos = -1;
int endPos = -1;
- for (final View view : timelineViews) {
- if (view instanceof Node) {
- final Node node = (Node) view;
+ for(final View view : timelineViews) {
+ if(view instanceof Node) {
+ final Node node = (Node)view;
final LayoutConstraint layoutConstraint = node.getLayoutConstraint();
- final Location location = (Location) layoutConstraint;
- if (view.getElement() == before) {
+ final Location location = (Location)layoutConstraint;
+ if(view.getElement() == before) {
startPos = location.getX() + SmallSquareFigure.RADIUS;
}
- if (view.getElement() == after) {
+ if(view.getElement() == after) {
endPos = location.getX() + SmallSquareFigure.RADIUS + 1;
}
}
}
- if (startPos != -1 && endPos != -1) {
+ if(startPos != -1 && endPos != -1) {
setGeneralOrderingNodeLocation(generalOrderingNode, startPos, endPos);
}
}
@@ -471,17 +468,17 @@ public class AbstractTimelineLayoutPolicy extends XYLayoutEditPolicy {
* Set the location of the given {@link GeneralOrdering} node
*
* @param generalOrderingNode
- * the node to position
+ * the node to position
* @param startPos
- * the horizontal starting position
+ * the horizontal starting position
* @param endPos
- * the horizontal ending position
+ * the horizontal ending position
*/
private static void setGeneralOrderingNodeLocation(final Node generalOrderingNode, final int startPos, final int endPos) {
final LayoutConstraint layoutConstraint = generalOrderingNode.getLayoutConstraint();
final Bounds bounds;
- if (layoutConstraint instanceof Bounds) {
- bounds = (Bounds) layoutConstraint;
+ if(layoutConstraint instanceof Bounds) {
+ bounds = (Bounds)layoutConstraint;
} else {
bounds = NotationFactory.eINSTANCE.createBounds();
generalOrderingNode.setLayoutConstraint(bounds);
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomCompactLifelineCompartmentItemSemanticEditPolicyCN.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomCompactLifelineCompartmentItemSemanticEditPolicyCN.java
index e56bfacf83b..e89697a86c4 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomCompactLifelineCompartmentItemSemanticEditPolicyCN.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomCompactLifelineCompartmentItemSemanticEditPolicyCN.java
@@ -29,7 +29,7 @@ public class CustomCompactLifelineCompartmentItemSemanticEditPolicyCN extends Co
@Override
protected Command getReorientRelationshipSourceCommand(final ReconnectRequest request) {
- if (request.getConnectionEditPart() instanceof MessageFoundEditPart) {
+ if(request.getConnectionEditPart() instanceof MessageFoundEditPart) {
// don't let it return an unexecutable command, since it prevents the MessageFound anchor from being dragged
return null;
}
@@ -38,7 +38,7 @@ public class CustomCompactLifelineCompartmentItemSemanticEditPolicyCN extends Co
@Override
protected Command getReorientRelationshipTargetCommand(final ReconnectRequest request) {
- if (request.getConnectionEditPart() instanceof MessageLostEditPart) {
+ if(request.getConnectionEditPart() instanceof MessageLostEditPart) {
// don't let it return an unexecutable command, since it prevents the MessageLost anchor from being dragged
return null;
}
@@ -49,7 +49,7 @@ public class CustomCompactLifelineCompartmentItemSemanticEditPolicyCN extends Co
@Override
protected Command getCreateRelationshipCommand(final CreateRelationshipRequest req) {
final IElementType requestElementType = req.getElementType();
- if (MessageUtils.isMessage(requestElementType)) {
+ if(MessageUtils.isMessage(requestElementType)) {
return getGEFWrapper(new CustomMessageCreateCommand(req));
}
return super.getCreateRelationshipCommand(req);
@@ -59,15 +59,15 @@ public class CustomCompactLifelineCompartmentItemSemanticEditPolicyCN extends Co
@Override
protected Command getCreateCommand(final CreateElementRequest req) {
final IElementType requestElementType = req.getElementType();
- if (requestElementType == UMLElementTypes.TimeObservation_16) {
+ if(requestElementType == UMLElementTypes.TimeObservation_16) {
return getGEFWrapper(new CustomTimeObservationCreateCommand(req));
- } else if (requestElementType == UMLElementTypes.TimeConstraint_15) {
+ } else if(requestElementType == UMLElementTypes.TimeConstraint_15) {
return getGEFWrapper(new CustomTimeConstraintCreateCommand(req));
- } else if (requestElementType == UMLElementTypes.DurationObservation_17) {
+ } else if(requestElementType == UMLElementTypes.DurationObservation_17) {
return getGEFWrapper(new CustomDurationObservationCreateCommand(req));
- } else if (requestElementType == UMLElementTypes.DurationConstraint_18) {
+ } else if(requestElementType == UMLElementTypes.DurationConstraint_18) {
return getGEFWrapper(new CustomDurationConstraintCreateCommand(req));
- } else if (requestElementType == UMLElementTypes.GeneralOrdering_67) {
+ } else if(requestElementType == UMLElementTypes.GeneralOrdering_67) {
return getGEFWrapper(new CustomGeneralOrderingCreateCommand(req));
}
return super.getCreateCommand(req);
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomCompactLifelineCompartmentLayoutEditPolicy.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomCompactLifelineCompartmentLayoutEditPolicy.java
index a25d7f0dad6..c317e340c99 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomCompactLifelineCompartmentLayoutEditPolicy.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomCompactLifelineCompartmentLayoutEditPolicy.java
@@ -62,7 +62,7 @@ public class CustomCompactLifelineCompartmentLayoutEditPolicy extends AbstractTi
@Override
protected Command getMoveChildrenCommand(final Request request) {
- if (RequestUtils.isChangeBoundsRequestFor(request, UMLPackage.eINSTANCE.getOccurrenceSpecification())) {
+ if(RequestUtils.isChangeBoundsRequestFor(request, UMLPackage.eINSTANCE.getOccurrenceSpecification())) {
return getMoveOccurrenceSpecificationsCommand(request);
}
return super.getMoveChildrenCommand(request);
@@ -70,21 +70,20 @@ public class CustomCompactLifelineCompartmentLayoutEditPolicy extends AbstractTi
@Override
protected Command getResizeChildrenCommand(final ChangeBoundsRequest request) {
- if (RequestUtils.isChangeBoundsRequestFor(request, UMLPackage.eINSTANCE.getStateInvariant())) {
+ if(RequestUtils.isChangeBoundsRequestFor(request, UMLPackage.eINSTANCE.getStateInvariant())) {
return getResizeStateInvariantsCommand(request);
}
return super.getResizeChildrenCommand(request);
}
private Command getResizeStateInvariantsCommand(final ChangeBoundsRequest request) {
- if (request.getResizeDirection() != PositionConstants.EAST) {
+ if(request.getResizeDirection() != PositionConstants.EAST) {
return UnexecutableCommand.INSTANCE;
}
final CompoundCommand compoundCommand = new CompoundCommand(Messages.CustomCompactLifelineCompartmentLayoutEditPolicy_ResizeStateInvariant);
- final CompactLifelineEditPartCN lifelineEditPart = (CompactLifelineEditPartCN) getHost().getParent();
+ final CompactLifelineEditPartCN lifelineEditPart = (CompactLifelineEditPartCN)getHost().getParent();
compoundCommand.add(new RefreshCommandForUndo(lifelineEditPart));
- final CompactLifelineCompartmentEditPartCN compartmentEditPart = (CompactLifelineCompartmentEditPartCN) EditPartUtils.findFirstChildEditPartWithId(
- lifelineEditPart, CompactLifelineCompartmentEditPartCN.VISUAL_ID);
+ final CompactLifelineCompartmentEditPartCN compartmentEditPart = (CompactLifelineCompartmentEditPartCN)EditPartUtils.findFirstChildEditPartWithId(lifelineEditPart, CompactLifelineCompartmentEditPartCN.VISUAL_ID);
final int widthDelta = FigureUtils.scaleByZoom(new Point(request.getSizeDelta().width, 0), lifelineEditPart.getFigure()).x;
@SuppressWarnings("unchecked")
@@ -93,33 +92,33 @@ public class CustomCompactLifelineCompartmentLayoutEditPolicy extends AbstractTi
final List<EditPart> children = compartmentEditPart.getChildren();
int deltaX = 0;
boolean moved = false;
- for (int i = 0; i < children.size(); i++) {
+ for(int i = 0; i < children.size(); i++) {
final EditPart childEditPart = children.get(i);
EditPart nextChildEditPart = null;
- if (i < children.size() - 1) {
+ if(i < children.size() - 1) {
nextChildEditPart = children.get(i + 1);
}
final Object model = childEditPart.getModel();
- if (model instanceof Node) {
- final Node childNode = (Node) model;
+ if(model instanceof Node) {
+ final Node childNode = (Node)model;
boolean move = deltaX != 0;
- if (OccurrenceSpecificationUtils.isOccurrenceSpecificationEditPart(childEditPart)) {
+ if(OccurrenceSpecificationUtils.isOccurrenceSpecificationEditPart(childEditPart)) {
// only move OccurrenceSpecifications followed by a StateInvariant (state changes)
move = move && nextChildEditPart instanceof CompactStateInvariantEditPartCN;
}
// if the element needs to be moved, then create the move command
- if (move && !TimeElementUtils.isTimeElementEditPart(childEditPart) && !GeneralOrderingUtils.isGeneralOrderingEditPart(childEditPart)) {
+ if(move && !TimeElementUtils.isTimeElementEditPart(childEditPart) && !GeneralOrderingUtils.isGeneralOrderingEditPart(childEditPart)) {
final LayoutConstraint layoutConstraint = childNode.getLayoutConstraint();
- if (!(layoutConstraint instanceof Location)) {
+ if(!(layoutConstraint instanceof Location)) {
Activator.log.error("Expected a LayoutConstraint", new Exception()); //$NON-NLS-1$
continue;
}
- final Location location = (Location) layoutConstraint;
+ final Location location = (Location)layoutConstraint;
final int newX = location.getX() + deltaX;
final TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(childNode);
- compoundCommand.add(new ICommandProxy(new AbstractTransactionalCommand(editingDomain,
- Messages.CustomCompactLifelineCompartmentLayoutEditPolicy_MoveElement, null) {
+ compoundCommand.add(new ICommandProxy(new AbstractTransactionalCommand(editingDomain, Messages.CustomCompactLifelineCompartmentLayoutEditPolicy_MoveElement, null) {
+
@Override
protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
final Location loc = NotationFactory.eINSTANCE.createLocation();
@@ -130,13 +129,13 @@ public class CustomCompactLifelineCompartmentLayoutEditPolicy extends AbstractTi
}));
moved = true;
}
- if (editPartsToResize.contains(childEditPart)) {
+ if(editPartsToResize.contains(childEditPart)) {
// resizing a StateInvariant moves all the elements after it
deltaX += widthDelta;
}
}
}
- if (!moved) {
+ if(!moved) {
return UnexecutableCommand.INSTANCE;
}
compoundCommand.add(new RefreshCommandForDo(lifelineEditPart));
@@ -146,12 +145,12 @@ public class CustomCompactLifelineCompartmentLayoutEditPolicy extends AbstractTi
/** returns a NonResizableEditPolicy instead of a ResizableEditPolicy for some children */
@Override
protected EditPolicy createChildEditPolicy(final EditPart child) {
- final View childView = (View) child.getModel();
+ final View childView = (View)child.getModel();
final int visualID = UMLVisualIDRegistry.getVisualID(childView);
// make OccurrenceSpecifications, time and duration elements and general orderings non-resizable
- if (OccurrenceSpecificationUtils.isOccurrenceSpecificationEditPart(visualID) || TimeElementUtils.isTimeElementEditPart(visualID)
- || GeneralOrderingUtils.isGeneralOrderingEditPart(visualID)) {
+ if(OccurrenceSpecificationUtils.isOccurrenceSpecificationEditPart(visualID) || TimeElementUtils.isTimeElementEditPart(visualID) || GeneralOrderingUtils.isGeneralOrderingEditPart(visualID)) {
return new NonResizableEditPolicyEx() {
+
/** Override the command in order to pass all the moved EditParts in the request */
@Override
protected Command getMoveCommand(final ChangeBoundsRequest request) {
@@ -167,6 +166,7 @@ public class CustomCompactLifelineCompartmentLayoutEditPolicy extends AbstractTi
};
}
return new ResizableShapeEditPolicy() {
+
/** Override the command in order to pass all the resized EditParts in the request */
@Override
protected Command getResizeCommand(final ChangeBoundsRequest request) {
@@ -189,35 +189,31 @@ public class CustomCompactLifelineCompartmentLayoutEditPolicy extends AbstractTi
}
private Command getMoveOccurrenceSpecificationsCommand(final Request request) {
- final ChangeBoundsRequest changeBoundsRequest = (ChangeBoundsRequest) request;
+ final ChangeBoundsRequest changeBoundsRequest = (ChangeBoundsRequest)request;
final CompoundCommand compoundCommand = new CompoundCommand(Messages.CustomCompactLifelineCompartmentLayoutEditPolicy_MoveOccurrenceSpecification);
- final CompactLifelineEditPartCN lifelineEditPart = (CompactLifelineEditPartCN) getHost().getParent();
+ final CompactLifelineEditPartCN lifelineEditPart = (CompactLifelineEditPartCN)getHost().getParent();
compoundCommand.add(new RefreshCommandForUndo(lifelineEditPart));
- final CompactLifelineCompartmentEditPartCN timelineCompartmentEditPart = (CompactLifelineCompartmentEditPartCN) EditPartUtils
- .findFirstChildEditPartWithId(lifelineEditPart, CompactLifelineCompartmentEditPartCN.VISUAL_ID);
- final View timelineCompartmentView = (View) timelineCompartmentEditPart.getModel();
+ final CompactLifelineCompartmentEditPartCN timelineCompartmentEditPart = (CompactLifelineCompartmentEditPartCN)EditPartUtils.findFirstChildEditPartWithId(lifelineEditPart, CompactLifelineCompartmentEditPartCN.VISUAL_ID);
+ final View timelineCompartmentView = (View)timelineCompartmentEditPart.getModel();
@SuppressWarnings("unchecked")
final List<EditPart> editParts = changeBoundsRequest.getEditParts();
final List<Node> nodesToMove = new ArrayList<Node>();
- for (final EditPart editPart : editParts) {
+ for(final EditPart editPart : editParts) {
final Object model = editPart.getModel();
- if (model instanceof Node) {
- final Node node = (Node) model;
- if (node.getElement() instanceof OccurrenceSpecification) {
+ if(model instanceof Node) {
+ final Node node = (Node)model;
+ if(node.getElement() instanceof OccurrenceSpecification) {
nodesToMove.add(node);
}
}
}
- for (final Node node : nodesToMove) {
+ for(final Node node : nodesToMove) {
final int index = timelineCompartmentView.getChildren().indexOf(node);
- if (index >= 0) {
- compoundCommand
- .add(getMoveOccurrenceSpecificationCommand(node,
- FigureUtils.scaleByZoom(changeBoundsRequest.getMoveDelta(), lifelineEditPart.getFigure()), timelineCompartmentView, index,
- nodesToMove));
+ if(index >= 0) {
+ compoundCommand.add(getMoveOccurrenceSpecificationCommand(node, FigureUtils.scaleByZoom(changeBoundsRequest.getMoveDelta(), lifelineEditPart.getFigure()), timelineCompartmentView, index, nodesToMove));
}
}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomCompactLifelineItemSemanticEditPolicyCN.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomCompactLifelineItemSemanticEditPolicyCN.java
index b5fd8dca216..c9c9191a6fb 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomCompactLifelineItemSemanticEditPolicyCN.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomCompactLifelineItemSemanticEditPolicyCN.java
@@ -21,10 +21,10 @@ public class CustomCompactLifelineItemSemanticEditPolicyCN extends CompactLifeli
@Override
protected Command getCreateRelationshipCommand(final CreateRelationshipRequest req) {
final IElementType requestElementType = req.getElementType();
- if (requestElementType == null) {
+ if(requestElementType == null) {
return null;
}
- if (MessageUtils.isMessage(requestElementType)) {
+ if(MessageUtils.isMessage(requestElementType)) {
return getGEFWrapper(new CustomMessageCreateCommand(req));
}
return super.getCreateRelationshipCommand(req);
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomCompactStateInvariantItemSemanticEditPolicy.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomCompactStateInvariantItemSemanticEditPolicy.java
index 858b50f2ab9..e57769aeadf 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomCompactStateInvariantItemSemanticEditPolicy.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomCompactStateInvariantItemSemanticEditPolicy.java
@@ -29,17 +29,17 @@ public class CustomCompactStateInvariantItemSemanticEditPolicy extends CompactSt
@Override
public Command getCommand(final Request request) {
- if (request.getType() == REQ_DELETE) {
+ if(request.getType() == REQ_DELETE) {
try {
- final View view = (View) getHost().getModel();
+ final View view = (View)getHost().getModel();
final Set<View> viewsToRemove = new HashSet<View>();
- if (view.getType().equals(Constants.compactStateInvariantId)) {
+ if(view.getType().equals(Constants.compactStateInvariantId)) {
viewsToRemove.addAll(StateInvariantUtils.getViewsToHide(view));
}
- if (viewsToRemove.size() > 0) {
+ if(viewsToRemove.size() > 0) {
final CompoundCommand compoundCommand = new CompoundCommand(Messages.hideStateInvariant);
compoundCommand.add(super.getCommand(request));
- for (final View viewToRemove : viewsToRemove) {
+ for(final View viewToRemove : viewsToRemove) {
compoundCommand.add(new ICommandProxy(new DeleteCommand(viewToRemove)));
}
return compoundCommand;
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomDestructionOccurrenceSpecificationItemSemanticEditPolicy.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomDestructionOccurrenceSpecificationItemSemanticEditPolicy.java
index efe69587c29..04a736c3460 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomDestructionOccurrenceSpecificationItemSemanticEditPolicy.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomDestructionOccurrenceSpecificationItemSemanticEditPolicy.java
@@ -19,7 +19,6 @@ import org.eclipse.papyrus.uml.diagram.timing.custom.edit.commands.CustomMessage
import org.eclipse.papyrus.uml.diagram.timing.custom.utils.MessageUtils;
import org.eclipse.papyrus.uml.diagram.timing.custom.utils.OccurrenceSpecificationUtils;
import org.eclipse.papyrus.uml.diagram.timing.edit.policies.DestructionOccurrenceSpecificationItemSemanticEditPolicyCN;
-import org.eclipse.uml2.uml.DestructionOccurrenceSpecification;
/** Semantic edit policy for {@link DestructionOccurrenceSpecification}s */
public class CustomDestructionOccurrenceSpecificationItemSemanticEditPolicy extends DestructionOccurrenceSpecificationItemSemanticEditPolicyCN {
@@ -27,7 +26,7 @@ public class CustomDestructionOccurrenceSpecificationItemSemanticEditPolicy exte
/** Handles the "Hide Element" (remove only the view, and keep the semantic element) */
@Override
public Command getCommand(final Request request) {
- if (request.getType() == REQ_DELETE) {
+ if(request.getType() == REQ_DELETE) {
final Command baseCommand = super.getCommand(request);
return OccurrenceSpecificationUtils.getHideOccurrenceSpecificationCommand(getHost(), baseCommand);
}
@@ -37,10 +36,10 @@ public class CustomDestructionOccurrenceSpecificationItemSemanticEditPolicy exte
@Override
protected Command getCreateRelationshipCommand(final CreateRelationshipRequest req) {
final IElementType requestElementType = req.getElementType();
- if (requestElementType == null) {
+ if(requestElementType == null) {
return null;
}
- if (MessageUtils.isMessage(requestElementType)) {
+ if(MessageUtils.isMessage(requestElementType)) {
return getGEFWrapper(new CustomMessageCreateCommand(req));
}
return super.getCreateRelationshipCommand(req);
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomFullLifelineItemSemanticEditPolicyCN.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomFullLifelineItemSemanticEditPolicyCN.java
index 4b54d628712..98074eb819c 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomFullLifelineItemSemanticEditPolicyCN.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomFullLifelineItemSemanticEditPolicyCN.java
@@ -21,10 +21,10 @@ public class CustomFullLifelineItemSemanticEditPolicyCN extends FullLifelineItem
@Override
protected Command getCreateRelationshipCommand(final CreateRelationshipRequest req) {
final IElementType requestElementType = req.getElementType();
- if (requestElementType == null) {
+ if(requestElementType == null) {
return null;
}
- if (MessageUtils.isMessage(requestElementType)) {
+ if(MessageUtils.isMessage(requestElementType)) {
return getGEFWrapper(new CustomMessageCreateCommand(req));
}
return super.getCreateRelationshipCommand(req);
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomFullLifelineStateDefinitionCompartmentLayoutEditPolicy.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomFullLifelineStateDefinitionCompartmentLayoutEditPolicy.java
index 43788a09868..8acfa353c26 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomFullLifelineStateDefinitionCompartmentLayoutEditPolicy.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomFullLifelineStateDefinitionCompartmentLayoutEditPolicy.java
@@ -17,6 +17,6 @@ public class CustomFullLifelineStateDefinitionCompartmentLayoutEditPolicy extend
@Override
protected GraphicalEditPart getEditPartToRefresh() {
- return (GraphicalEditPart) EditPartUtils.findParentEditPartWithId(getHost(), FullLifelineEditPartCN.VISUAL_ID);
+ return (GraphicalEditPart)EditPartUtils.findParentEditPartWithId(getHost(), FullLifelineEditPartCN.VISUAL_ID);
}
}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomFullLifelineTimelineCompartmentItemSemanticEditPolicyCN.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomFullLifelineTimelineCompartmentItemSemanticEditPolicyCN.java
index 07e5e529f40..92204bfb3f0 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomFullLifelineTimelineCompartmentItemSemanticEditPolicyCN.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomFullLifelineTimelineCompartmentItemSemanticEditPolicyCN.java
@@ -29,7 +29,7 @@ public class CustomFullLifelineTimelineCompartmentItemSemanticEditPolicyCN exten
@Override
protected Command getReorientRelationshipSourceCommand(final ReconnectRequest request) {
- if (request.getConnectionEditPart() instanceof MessageFoundEditPart) {
+ if(request.getConnectionEditPart() instanceof MessageFoundEditPart) {
// don't let it return an unexecutable command, since it prevents the MessageFound anchor from being dragged
return null;
}
@@ -38,7 +38,7 @@ public class CustomFullLifelineTimelineCompartmentItemSemanticEditPolicyCN exten
@Override
protected Command getReorientRelationshipTargetCommand(final ReconnectRequest request) {
- if (request.getConnectionEditPart() instanceof MessageLostEditPart) {
+ if(request.getConnectionEditPart() instanceof MessageLostEditPart) {
// don't let it return an unexecutable command, since it prevents the MessageLost anchor from being dragged
return null;
}
@@ -49,7 +49,7 @@ public class CustomFullLifelineTimelineCompartmentItemSemanticEditPolicyCN exten
@Override
protected Command getCreateRelationshipCommand(final CreateRelationshipRequest req) {
final IElementType requestElementType = req.getElementType();
- if (MessageUtils.isMessage(requestElementType)) {
+ if(MessageUtils.isMessage(requestElementType)) {
return getGEFWrapper(new CustomMessageCreateCommand(req));
}
return super.getCreateRelationshipCommand(req);
@@ -59,15 +59,15 @@ public class CustomFullLifelineTimelineCompartmentItemSemanticEditPolicyCN exten
@Override
protected Command getCreateCommand(final CreateElementRequest req) {
final IElementType requestElementType = req.getElementType();
- if (requestElementType == UMLElementTypes.TimeObservation_16) {
+ if(requestElementType == UMLElementTypes.TimeObservation_16) {
return getGEFWrapper(new CustomTimeObservationCreateCommand(req));
- } else if (requestElementType == UMLElementTypes.TimeConstraint_15) {
+ } else if(requestElementType == UMLElementTypes.TimeConstraint_15) {
return getGEFWrapper(new CustomTimeConstraintCreateCommand(req));
- } else if (requestElementType == UMLElementTypes.DurationObservation_17) {
+ } else if(requestElementType == UMLElementTypes.DurationObservation_17) {
return getGEFWrapper(new CustomDurationObservationCreateCommand(req));
- } else if (requestElementType == UMLElementTypes.DurationConstraint_18) {
+ } else if(requestElementType == UMLElementTypes.DurationConstraint_18) {
return getGEFWrapper(new CustomDurationConstraintCreateCommand(req));
- } else if (requestElementType == UMLElementTypes.GeneralOrdering_67) {
+ } else if(requestElementType == UMLElementTypes.GeneralOrdering_67) {
return getGEFWrapper(new CustomGeneralOrderingCreateCommand(req));
}
return super.getCreateCommand(req);
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomFullStateInvariantItemSemanticEditPolicy.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomFullStateInvariantItemSemanticEditPolicy.java
index 4a7372b3dde..c31f56c3da5 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomFullStateInvariantItemSemanticEditPolicy.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomFullStateInvariantItemSemanticEditPolicy.java
@@ -29,17 +29,17 @@ public class CustomFullStateInvariantItemSemanticEditPolicy extends FullStateInv
@Override
public Command getCommand(final Request request) {
- if (request.getType() == REQ_DELETE) {
+ if(request.getType() == REQ_DELETE) {
try {
- final View view = (View) getHost().getModel();
+ final View view = (View)getHost().getModel();
final Set<View> viewsToRemove = new HashSet<View>();
- if (view.getType().equals(Constants.fullStateInvariantId)) {
+ if(view.getType().equals(Constants.fullStateInvariantId)) {
viewsToRemove.addAll(StateInvariantUtils.getViewsToHide(view));
}
- if (viewsToRemove.size() > 0) {
+ if(viewsToRemove.size() > 0) {
final CompoundCommand compoundCommand = new CompoundCommand(Messages.hideStateInvariant);
compoundCommand.add(super.getCommand(request));
- for (final View viewToRemove : viewsToRemove) {
+ for(final View viewToRemove : viewsToRemove) {
compoundCommand.add(new ICommandProxy(new DeleteCommand(viewToRemove)));
}
return compoundCommand;
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomGateItemSemanticEditPolicy.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomGateItemSemanticEditPolicy.java
index ce3ca08f900..afe1d1d9c4b 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomGateItemSemanticEditPolicy.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomGateItemSemanticEditPolicy.java
@@ -18,7 +18,6 @@ import org.eclipse.papyrus.uml.diagram.timing.custom.edit.commands.CustomMessage
import org.eclipse.papyrus.uml.diagram.timing.custom.edit.commands.CustomMessageReorientCommand;
import org.eclipse.papyrus.uml.diagram.timing.custom.utils.MessageUtils;
import org.eclipse.papyrus.uml.diagram.timing.edit.policies.GateItemSemanticEditPolicy;
-import org.eclipse.uml2.uml.Gate;
/** Semantic edit policy for {@link Gate}s */
public class CustomGateItemSemanticEditPolicy extends GateItemSemanticEditPolicy {
@@ -26,7 +25,7 @@ public class CustomGateItemSemanticEditPolicy extends GateItemSemanticEditPolicy
/** Handles the "Hide Element" (remove only the view, and keep the semantic element) */
@Override
public Command getCommand(final Request request) {
- if (request.getType() == REQ_DELETE) {
+ if(request.getType() == REQ_DELETE) {
// TODO: delete elements linked to Gate
// final Command baseCommand = super.getCommand(request);
// return GateUtils.getHideGateCommand(getHost(), baseCommand);
@@ -37,10 +36,10 @@ public class CustomGateItemSemanticEditPolicy extends GateItemSemanticEditPolicy
@Override
protected Command getCreateRelationshipCommand(final CreateRelationshipRequest req) {
final IElementType requestElementType = req.getElementType();
- if (requestElementType == null) {
+ if(requestElementType == null) {
return null;
}
- if (MessageUtils.isMessage(requestElementType)) {
+ if(MessageUtils.isMessage(requestElementType)) {
return getGEFWrapper(new CustomMessageCreateCommand(req));
}
return super.getCreateRelationshipCommand(req);
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomInteractionCompartmentCreationEditPolicy.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomInteractionCompartmentCreationEditPolicy.java
index d4305cef77c..90c705d1b5d 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomInteractionCompartmentCreationEditPolicy.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomInteractionCompartmentCreationEditPolicy.java
@@ -45,14 +45,14 @@ public class CustomInteractionCompartmentCreationEditPolicy extends PapyrusCreat
@Override
protected Command getCreateCommand(final CreateViewRequest request) {
- final ICommandProxy superCommand = (ICommandProxy) super.getCreateCommand(request);
+ final ICommandProxy superCommand = (ICommandProxy)super.getCreateCommand(request);
final List<? extends ViewDescriptor> viewDescriptors = request.getViewDescriptors();
- if (request instanceof CreateViewAndElementRequest && viewDescriptors.size() == 1) {
+ if(request instanceof CreateViewAndElementRequest && viewDescriptors.size() == 1) {
final String semanticHint = viewDescriptors.get(0).getSemanticHint();
final TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(getHost().getModel());
- if (Integer.toString(CompactLifelineEditPartCN.VISUAL_ID).equals(semanticHint)) {
- final View interactionView = (View) getHost().getParent().getModel();
- final Interaction interaction = (Interaction) interactionView.getElement();
+ if(Integer.toString(CompactLifelineEditPartCN.VISUAL_ID).equals(semanticHint)) {
+ final View interactionView = (View)getHost().getParent().getModel();
+ final Interaction interaction = (Interaction)interactionView.getElement();
// note: only add a StateInvariant to the Lifeline if the request is a CreateViewAndElementRequest,
// and not merely a CreateViewRequest, because we don't want to create a new StateInvariant if this is
// only a drop for an existing Lifeline
@@ -64,7 +64,7 @@ public class CustomInteractionCompartmentCreationEditPolicy extends PapyrusCreat
compoundCommand.add(new RefreshCommandForDo(interactionEditPart));
return compoundCommand;
}
- if (Integer.toString(FullLifelineEditPartCN.VISUAL_ID).equals(semanticHint)) {
+ if(Integer.toString(FullLifelineEditPartCN.VISUAL_ID).equals(semanticHint)) {
final CompoundCommand compoundCommand = new CompoundCommand(Messages.CustomInteractionCompartmentCreationEditPolicy_CreateFullLifeline);
final InteractionEditPartTN interactionEditPart = getInteractionEditPart();
compoundCommand.add(new RefreshCommandForUndo(interactionEditPart));
@@ -82,20 +82,20 @@ public class CustomInteractionCompartmentCreationEditPolicy extends PapyrusCreat
// creates the compact lifeline View
compoundCommand.add(superCommand);
- final CommandResult superCommandResult = ((ICommandProxy) superCommand).getICommand().getCommandResult();
+ final CommandResult superCommandResult = ((ICommandProxy)superCommand).getICommand().getCommandResult();
final TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(interaction);
- if (editingDomain == null) {
+ if(editingDomain == null) {
throw new IllegalStateException("no editing domain"); //$NON-NLS-1$
}
- final AbstractTransactionalCommand initStateDefinitionCommand = new AbstractTransactionalCommand(editingDomain,
- Messages.CustomCompactLifelifeCompactStateInvariantCreationEditPolicy_InitializeStateInvariant, null) {
+ final AbstractTransactionalCommand initStateDefinitionCommand = new AbstractTransactionalCommand(editingDomain, Messages.CustomCompactLifelifeCompactStateInvariantCreationEditPolicy_InitializeStateInvariant, null) {
+
@Override
protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
// the result from the super command that creates the view
- final ViewDescriptor viewDescriptor = (ViewDescriptor) superCommandResult.getReturnValue();
- final View compactLifelineView = (View) viewDescriptor.getAdapter(View.class);
+ final ViewDescriptor viewDescriptor = (ViewDescriptor)superCommandResult.getReturnValue();
+ final View compactLifelineView = (View)viewDescriptor.getAdapter(View.class);
final View compactLifelineCompartmentView = ViewUtils.findCompactTimelineCompartmentView(compactLifelineView);
StateInvariantUtils.createCompactStateInvariant(compactLifelineCompartmentView, -1, -1, -1);
return CommandResult.newOKCommandResult();
@@ -106,10 +106,10 @@ public class CustomInteractionCompartmentCreationEditPolicy extends PapyrusCreat
}
protected InteractionEditPartTN getInteractionEditPart() {
- return (InteractionEditPartTN) EditPartUtils.findParentEditPartWithId(getHost(), InteractionEditPartTN.VISUAL_ID);
+ return (InteractionEditPartTN)EditPartUtils.findParentEditPartWithId(getHost(), InteractionEditPartTN.VISUAL_ID);
}
protected CompactLifelineCompartmentEditPartCN getCompactLifelineCompartmentEditPart() {
- return (CompactLifelineCompartmentEditPartCN) EditPartUtils.findFirstChildEditPartWithId(getHost(), CompactLifelineCompartmentEditPartCN.VISUAL_ID);
+ return (CompactLifelineCompartmentEditPartCN)EditPartUtils.findFirstChildEditPartWithId(getHost(), CompactLifelineCompartmentEditPartCN.VISUAL_ID);
}
}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomInteractionCompartmentItemSemanticEditPolicy.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomInteractionCompartmentItemSemanticEditPolicy.java
index 481c9975fe2..df9eb3059c1 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomInteractionCompartmentItemSemanticEditPolicy.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomInteractionCompartmentItemSemanticEditPolicy.java
@@ -27,8 +27,9 @@ public class CustomInteractionCompartmentItemSemanticEditPolicy extends Interact
@Override
protected Command getCreateCommand(final CreateElementRequest req) {
final IElementType elementType = req.getElementType();
- if (UMLElementTypes.Lifeline_19 == elementType) {
+ if(UMLElementTypes.Lifeline_19 == elementType) {
return getGEFWrapper(new FullLifelineCreateCommandCN(req) {
+
@Override
protected void doConfigure(final Lifeline newElement, final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
super.doConfigure(newElement, monitor, info);
@@ -36,8 +37,9 @@ public class CustomInteractionCompartmentItemSemanticEditPolicy extends Interact
}
});
}
- if (UMLElementTypes.Lifeline_20 == elementType) {
+ if(UMLElementTypes.Lifeline_20 == elementType) {
return getGEFWrapper(new CompactLifelineCreateCommandCN(req) {
+
@Override
protected void doConfigure(final Lifeline newElement, final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
super.doConfigure(newElement, monitor, info);
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomInteractionCreationEditPolicy.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomInteractionCreationEditPolicy.java
index 8814dc01c26..e7dab25d234 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomInteractionCreationEditPolicy.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomInteractionCreationEditPolicy.java
@@ -46,11 +46,11 @@ public class CustomInteractionCreationEditPolicy extends PapyrusCreationEditPoli
@Override
protected Command getCreateCommand(final CreateViewRequest request) {
- final ICommandProxy superCommand = (ICommandProxy) super.getCreateCommand(request);
+ final ICommandProxy superCommand = (ICommandProxy)super.getCreateCommand(request);
final List<? extends ViewDescriptor> viewDescriptors = request.getViewDescriptors();
- if (request instanceof CreateViewAndElementRequest && viewDescriptors.size() == 1) {
+ if(request instanceof CreateViewAndElementRequest && viewDescriptors.size() == 1) {
final String semanticHint = viewDescriptors.get(0).getSemanticHint();
- if (Integer.toString(GateEditPart.VISUAL_ID).equals(semanticHint)) {
+ if(Integer.toString(GateEditPart.VISUAL_ID).equals(semanticHint)) {
return getCreateGateCommand(request, superCommand);
}
}
@@ -62,19 +62,20 @@ public class CustomInteractionCreationEditPolicy extends PapyrusCreationEditPoli
final CompoundCommand compoundCommand = new CompoundCommand(Messages.CustomInteractionCreationEditPolicy_CreateGate);
compoundCommand.add(superCommand);
final ICommand iCommand = superCommand.getICommand();
- final TransactionalEditingDomain editingDomain = ((AbstractEMFOperation) iCommand).getEditingDomain();
+ final TransactionalEditingDomain editingDomain = ((AbstractEMFOperation)iCommand).getEditingDomain();
compoundCommand.add(new ICommandProxy(new AbstractTransactionalCommand(editingDomain, Messages.CustomInteractionCreationEditPolicy_PositionGate, null) {
+
@Override
protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
final CommandResult commandResult = iCommand.getCommandResult();
final Object returnValue = commandResult.getReturnValue();
- final ViewAndElementDescriptor descriptor = (ViewAndElementDescriptor) returnValue;
- final Node node = (Node) descriptor.getAdapter(Node.class);
+ final ViewAndElementDescriptor descriptor = (ViewAndElementDescriptor)returnValue;
+ final Node node = (Node)descriptor.getAdapter(Node.class);
- final Node interactionView = (Node) ViewUtils.findSuperViewWithId(node, InteractionEditPartTN.VISUAL_ID);
- final Location interactionLocation = (Location) interactionView.getLayoutConstraint();
+ final Node interactionView = (Node)ViewUtils.findSuperViewWithId(node, InteractionEditPartTN.VISUAL_ID);
+ final Location interactionLocation = (Location)interactionView.getLayoutConstraint();
- final IFigure hostFigure = ((GraphicalEditPart) getHost()).getFigure();
+ final IFigure hostFigure = ((GraphicalEditPart)getHost()).getFigure();
final Point point = new Point(request.getLocation());
final Point origin = FigureUtils.getLayeredPaneOrigin(hostFigure);
point.translate(origin);
@@ -88,7 +89,7 @@ public class CustomInteractionCreationEditPolicy extends PapyrusCreationEditPoli
return CommandResult.newOKCommandResult();
}
}));
- compoundCommand.add(new RefreshCommandForDo((GraphicalEditPart) getHost()));
+ compoundCommand.add(new RefreshCommandForDo((GraphicalEditPart)getHost()));
return compoundCommand;
}
}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomLifelineCompartmentGraphicalNodeEditPolicy.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomLifelineCompartmentGraphicalNodeEditPolicy.java
index 1f0fcd27e5f..660232a3b61 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomLifelineCompartmentGraphicalNodeEditPolicy.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomLifelineCompartmentGraphicalNodeEditPolicy.java
@@ -23,7 +23,6 @@ import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.INodeEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.GraphicalNodeEditPolicy;
import org.eclipse.papyrus.uml.diagram.timing.custom.Messages;
-import org.eclipse.papyrus.uml.diagram.timing.custom.edit.parts.CustomFullLifelineEditPartCN;
import org.eclipse.papyrus.uml.diagram.timing.custom.utils.MessageUtils;
import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageFoundEditPart;
import org.eclipse.papyrus.uml.diagram.timing.edit.parts.MessageLostEditPart;
@@ -33,45 +32,41 @@ public class CustomLifelineCompartmentGraphicalNodeEditPolicy extends GraphicalN
@Override
protected INodeEditPart getConnectionCompleteEditPart(final Request request) {
// connect to the Lifeline
- return (INodeEditPart) getHost().getParent();
+ return (INodeEditPart)getHost().getParent();
}
@Override
protected INodeEditPart getConnectableEditPart() {
// connect to the Lifeline
- return (INodeEditPart) getHost().getParent();
+ return (INodeEditPart)getHost().getParent();
}
/**
* Let the target anchor of a MessageLost be moved, by storing the desired location in an EAnnotation on the
- * connector, which will then be used in
- * {@link CustomFullLifelineEditPartCN#getTargetConnectionAnchor(ConnectionEditPart)}
+ * connector, which will then be used in {@link CustomFullLifelineEditPartCN#getTargetConnectionAnchor(ConnectionEditPart)}
*/
@Override
protected Command getReconnectTargetCommand(final ReconnectRequest request) {
final ConnectionEditPart connectionEditPart = request.getConnectionEditPart();
- if (connectionEditPart instanceof MessageLostEditPart) {
- final TransactionalEditingDomain editingDomain = ((IGraphicalEditPart) getHost()).getEditingDomain();
- final IFigure sourceFigure = ((GraphicalEditPart) connectionEditPart.getSource()).getFigure();
- return MessageUtils.createMoveMessageAnchorCommand(request, connectionEditPart, sourceFigure,
- Messages.CustomLifelineCompartmentGraphicalNodeEditPolicy_SetMessageLostTargetLocation, editingDomain);
+ if(connectionEditPart instanceof MessageLostEditPart) {
+ final TransactionalEditingDomain editingDomain = ((IGraphicalEditPart)getHost()).getEditingDomain();
+ final IFigure sourceFigure = ((GraphicalEditPart)connectionEditPart.getSource()).getFigure();
+ return MessageUtils.createMoveMessageAnchorCommand(request, connectionEditPart, sourceFigure, Messages.CustomLifelineCompartmentGraphicalNodeEditPolicy_SetMessageLostTargetLocation, editingDomain);
}
return super.getReconnectTargetCommand(request);
}
/**
* Let the target anchor of a MessageFound be moved, by storing the desired location in an EAnnotation on the
- * connector, which will then be used in
- * {@link CustomFullLifelineEditPartCN#getSourceConnectionAnchor(ConnectionEditPart)}
+ * connector, which will then be used in {@link CustomFullLifelineEditPartCN#getSourceConnectionAnchor(ConnectionEditPart)}
*/
@Override
protected Command getReconnectSourceCommand(final ReconnectRequest request) {
final ConnectionEditPart connectionEditPart = request.getConnectionEditPart();
- if (connectionEditPart instanceof MessageFoundEditPart) {
- final TransactionalEditingDomain editingDomain = ((IGraphicalEditPart) getHost()).getEditingDomain();
- final IFigure targetFigure = ((GraphicalEditPart) connectionEditPart.getTarget()).getFigure();
- return MessageUtils.createMoveMessageAnchorCommand(request, connectionEditPart, targetFigure,
- Messages.CustomLifelineCompartmentGraphicalNodeEditPolicy_SetMessageFoundSourceLocation, editingDomain);
+ if(connectionEditPart instanceof MessageFoundEditPart) {
+ final TransactionalEditingDomain editingDomain = ((IGraphicalEditPart)getHost()).getEditingDomain();
+ final IFigure targetFigure = ((GraphicalEditPart)connectionEditPart.getTarget()).getFigure();
+ return MessageUtils.createMoveMessageAnchorCommand(request, connectionEditPart, targetFigure, Messages.CustomLifelineCompartmentGraphicalNodeEditPolicy_SetMessageFoundSourceLocation, editingDomain);
}
return super.getReconnectTargetCommand(request);
}
@@ -86,7 +81,7 @@ public class CustomLifelineCompartmentGraphicalNodeEditPolicy extends GraphicalN
@Override
protected ConnectionAnchor getSourceConnectionAnchor(final CreateConnectionRequest request) {
final Point startLocation = MessageUtils.retrieveRequestStartLocation(request);
- if (startLocation != null) {
+ if(startLocation != null) {
return new XYAnchor(new Point(startLocation));
}
return super.getSourceConnectionAnchor(request);
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomLifelineNameEditPolicy.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomLifelineNameEditPolicy.java
index 21a01072f10..95920f05f8d 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomLifelineNameEditPolicy.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomLifelineNameEditPolicy.java
@@ -15,36 +15,37 @@ import org.eclipse.papyrus.uml.diagram.timing.edit.policies.UMLTextSelectionEdit
/** Shows feedback for the selection of a Lifeline name vertical label. */
public class CustomLifelineNameEditPolicy extends UMLTextSelectionEditPolicy {
+
@Override
protected void showPrimarySelection() {
- final LifelineVerticalLabel label = (LifelineVerticalLabel) getHostFigure();
+ final LifelineVerticalLabel label = (LifelineVerticalLabel)getHostFigure();
label.setSelected(true);
label.setFocus(true);
}
@Override
protected void showSelection() {
- final LifelineVerticalLabel label = (LifelineVerticalLabel) getHostFigure();
+ final LifelineVerticalLabel label = (LifelineVerticalLabel)getHostFigure();
label.setSelected(true);
label.setFocus(false);
}
@Override
protected void hideSelection() {
- final LifelineVerticalLabel label = (LifelineVerticalLabel) getHostFigure();
+ final LifelineVerticalLabel label = (LifelineVerticalLabel)getHostFigure();
label.setSelected(false);
label.setFocus(false);
}
@Override
protected void showFocus() {
- final LifelineVerticalLabel label = (LifelineVerticalLabel) getHostFigure();
+ final LifelineVerticalLabel label = (LifelineVerticalLabel)getHostFigure();
label.setFocus(true);
}
@Override
protected void hideFocus() {
- final LifelineVerticalLabel label = (LifelineVerticalLabel) getHostFigure();
+ final LifelineVerticalLabel label = (LifelineVerticalLabel)getHostFigure();
label.setFocus(false);
}
}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomMessageOccurrenceSpecificationItemSemanticEditPolicy.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomMessageOccurrenceSpecificationItemSemanticEditPolicy.java
index e9dc44db16d..139856ca5e8 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomMessageOccurrenceSpecificationItemSemanticEditPolicy.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomMessageOccurrenceSpecificationItemSemanticEditPolicy.java
@@ -23,7 +23,6 @@ import org.eclipse.papyrus.uml.diagram.timing.edit.commands.TimeConstraintCreate
import org.eclipse.papyrus.uml.diagram.timing.edit.commands.TimeObservationCreateCommand;
import org.eclipse.papyrus.uml.diagram.timing.edit.policies.MessageOccurrenceSpecificationItemSemanticEditPolicyCN;
import org.eclipse.papyrus.uml.diagram.timing.providers.UMLElementTypes;
-import org.eclipse.uml2.uml.MessageOccurrenceSpecification;
/** Semantic edit policy for {@link MessageOccurrenceSpecification}s */
public class CustomMessageOccurrenceSpecificationItemSemanticEditPolicy extends MessageOccurrenceSpecificationItemSemanticEditPolicyCN {
@@ -31,7 +30,7 @@ public class CustomMessageOccurrenceSpecificationItemSemanticEditPolicy extends
/** Handles the "Hide Element" (remove only the view, and keep the semantic element) */
@Override
public Command getCommand(final Request request) {
- if (request.getType() == REQ_DELETE) {
+ if(request.getType() == REQ_DELETE) {
final Command baseCommand = super.getCommand(request);
return OccurrenceSpecificationUtils.getHideOccurrenceSpecificationCommand(getHost(), baseCommand);
}
@@ -41,10 +40,10 @@ public class CustomMessageOccurrenceSpecificationItemSemanticEditPolicy extends
@Override
protected Command getCreateCommand(final CreateElementRequest req) {
final IElementType elementType = req.getElementType();
- if (UMLElementTypes.TimeConstraint_15 == elementType) {
+ if(UMLElementTypes.TimeConstraint_15 == elementType) {
return getGEFWrapper(new TimeConstraintCreateCommand(req));
}
- if (UMLElementTypes.TimeObservation_16 == elementType) {
+ if(UMLElementTypes.TimeObservation_16 == elementType) {
return getGEFWrapper(new TimeObservationCreateCommand(req));
}
return super.getCreateCommand(req);
@@ -53,10 +52,10 @@ public class CustomMessageOccurrenceSpecificationItemSemanticEditPolicy extends
@Override
protected Command getCreateRelationshipCommand(final CreateRelationshipRequest req) {
final IElementType requestElementType = req.getElementType();
- if (requestElementType == null) {
+ if(requestElementType == null) {
return null;
}
- if (MessageUtils.isMessage(requestElementType)) {
+ if(MessageUtils.isMessage(requestElementType)) {
return getGEFWrapper(new CustomMessageCreateCommand(req));
}
return super.getCreateRelationshipCommand(req);
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomOccurrenceSpecificationItemSemanticEditPolicy.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomOccurrenceSpecificationItemSemanticEditPolicy.java
index df94b4ecfad..1ce6acf068e 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomOccurrenceSpecificationItemSemanticEditPolicy.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomOccurrenceSpecificationItemSemanticEditPolicy.java
@@ -23,8 +23,7 @@ import org.eclipse.papyrus.uml.diagram.timing.edit.policies.OccurrenceSpecificat
/**
* <ul>
* <li>Handles hiding an OccurrenceSpecification and the associated VerticalLine and StateInvariant
- * <li>Handles destroying an OccurrenceSpecification and the associated elements, while renaming the
- * OccurrenceSpecifications and StateInvariants
+ * <li>Handles destroying an OccurrenceSpecification and the associated elements, while renaming the OccurrenceSpecifications and StateInvariants
* <li>Creates the CustomMessageCreateCommand
* </ul>
*/
@@ -33,7 +32,7 @@ public class CustomOccurrenceSpecificationItemSemanticEditPolicy extends Occurre
/** Handles the "Hide Element" (remove only the view, and keep the semantic element) */
@Override
public Command getCommand(final Request request) {
- if (request.getType() == REQ_DELETE) {
+ if(request.getType() == REQ_DELETE) {
final Command baseCommand = super.getCommand(request);
return OccurrenceSpecificationUtils.getHideOccurrenceSpecificationCommand(getHost(), baseCommand);
}
@@ -43,10 +42,10 @@ public class CustomOccurrenceSpecificationItemSemanticEditPolicy extends Occurre
@Override
protected Command getCreateRelationshipCommand(final CreateRelationshipRequest req) {
final IElementType requestElementType = req.getElementType();
- if (requestElementType == null) {
+ if(requestElementType == null) {
return null;
}
- if (MessageUtils.isMessage(requestElementType)) {
+ if(MessageUtils.isMessage(requestElementType)) {
return getGEFWrapper(new CustomMessageCreateCommand(req));
}
return super.getCreateRelationshipCommand(req);
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomTimelineCompartmentLayoutEditPolicy.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomTimelineCompartmentLayoutEditPolicy.java
index 1386d6bfc31..374d48d8c08 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomTimelineCompartmentLayoutEditPolicy.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomTimelineCompartmentLayoutEditPolicy.java
@@ -71,6 +71,7 @@ import org.eclipse.uml2.uml.UMLPackage;
public class CustomTimelineCompartmentLayoutEditPolicy extends AbstractTimelineLayoutPolicy {
private static final String ALL_MOVED_EDITPARTS = "ALL_MOVED_EDITPARTS"; //$NON-NLS-1$
+
/** The height of the feedback figure when moving StateInvariants up or down. */
private static final int LAYOUT_FEEDBACK_HEIGHT = 4;
@@ -78,55 +79,55 @@ public class CustomTimelineCompartmentLayoutEditPolicy extends AbstractTimelineL
@Override
protected Command getMoveChildrenCommand(final Request request) {
- if (RequestUtils.isChangeBoundsRequestFor(request, UMLPackage.eINSTANCE.getStateInvariant())) {
+ if(RequestUtils.isChangeBoundsRequestFor(request, UMLPackage.eINSTANCE.getStateInvariant())) {
return getMoveStateInvariantCommand(request);
- } else if (RequestUtils.isChangeBoundsRequestFor(request, FullStateInvariantVerticalLineEditPart.class)) {
+ } else if(RequestUtils.isChangeBoundsRequestFor(request, FullStateInvariantVerticalLineEditPart.class)) {
return getMoveVerticalLinesCommand(request);
- } else if (RequestUtils.isChangeBoundsRequestFor(request, UMLPackage.eINSTANCE.getOccurrenceSpecification())) {
+ } else if(RequestUtils.isChangeBoundsRequestFor(request, UMLPackage.eINSTANCE.getOccurrenceSpecification())) {
return getMoveOccurrenceSpecificationsCommand(request);
}
return super.getMoveChildrenCommand(request);
}
private Command getMoveStateInvariantCommand(final Request request) {
- final ChangeBoundsRequest changeBoundsRequest = (ChangeBoundsRequest) request;
+ final ChangeBoundsRequest changeBoundsRequest = (ChangeBoundsRequest)request;
final Point location = changeBoundsRequest.getLocation();
- if (location == null) {
+ if(location == null) {
Activator.log.warn("Ignoring ChangeBoundsRequest without a Location"); //$NON-NLS-1$
return UnexecutableCommand.INSTANCE;
}
final int ordinate = location.y;
final CompoundCommand compoundCommand = new CompoundCommand(Messages.CustomTimelineCompartmentLayoutEditPolicy_MoveStateInvariant);
- final FullLifelineEditPartCN lifelineEditPart = (FullLifelineEditPartCN) getHost().getParent();
+ final FullLifelineEditPartCN lifelineEditPart = (FullLifelineEditPartCN)getHost().getParent();
compoundCommand.add(new RefreshCommandForUndo(lifelineEditPart));
final StateDefinitionEditPart stateDefinitionEditPart = StateDefinitionUtils.findStateDefinitionClosestToOrdinate(lifelineEditPart, ordinate);
- if (stateDefinitionEditPart == null) {
+ if(stateDefinitionEditPart == null) {
return UnexecutableCommand.INSTANCE;
}
- final View stateDefinitionView = ((View) stateDefinitionEditPart.getModel());
+ final View stateDefinitionView = ((View)stateDefinitionEditPart.getModel());
final String closestStateDefinitionName = StateDefinitionUtils.getStateDefinitionName(stateDefinitionView);
final String closestStateDefinitionId = StateDefinitionUtils.getStateDefinitionViewID(stateDefinitionView);
@SuppressWarnings("unchecked")
final List<EditPart> editParts = changeBoundsRequest.getEditParts();
- for (final EditPart editPart : editParts) {
- if (editPart instanceof FullStateInvariantEditPartCN) {
- final FullStateInvariantEditPartCN fullStateInvariantEditPart = (FullStateInvariantEditPartCN) editPart;
- final StateInvariant stateInvariant = (StateInvariant) ((View) (fullStateInvariantEditPart.getModel())).getElement();
+ for(final EditPart editPart : editParts) {
+ if(editPart instanceof FullStateInvariantEditPartCN) {
+ final FullStateInvariantEditPartCN fullStateInvariantEditPart = (FullStateInvariantEditPartCN)editPart;
+ final StateInvariant stateInvariant = (StateInvariant)((View)(fullStateInvariantEditPart.getModel())).getElement();
final TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(stateInvariant);
- if (editingDomain == null) {
+ if(editingDomain == null) {
throw new IllegalStateException("no editing domain"); //$NON-NLS-1$
}
- final AbstractTransactionalCommand updateStateInvariantCommand = new AbstractTransactionalCommand(editingDomain,
- Messages.CustomTimelineCompartmentLayoutEditPolicy_UpdateStateInvariant, null) {
+ final AbstractTransactionalCommand updateStateInvariantCommand = new AbstractTransactionalCommand(editingDomain, Messages.CustomTimelineCompartmentLayoutEditPolicy_UpdateStateInvariant, null) {
+
@Override
protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
StateInvariantUtils.setStateInvariantId(stateInvariant, closestStateDefinitionId);
StateInvariantUtils.setInnerStateInvariantName(stateInvariant, closestStateDefinitionName);
- final View lifelineView = (View) lifelineEditPart.getModel();
- final Lifeline lifeline = (Lifeline) lifelineView.getElement();
+ final View lifelineView = (View)lifelineEditPart.getModel();
+ final Lifeline lifeline = (Lifeline)lifelineView.getElement();
LifelineUtils.updateFragmentNames(lifeline, lifelineView);
return CommandResult.newOKCommandResult();
}
@@ -143,15 +144,14 @@ public class CustomTimelineCompartmentLayoutEditPolicy extends AbstractTimelineL
* the layout).
*/
private Command getMoveVerticalLinesCommand(final Request request) {
- final ChangeBoundsRequest changeBoundsRequest = (ChangeBoundsRequest) request;
+ final ChangeBoundsRequest changeBoundsRequest = (ChangeBoundsRequest)request;
final CompoundCommand compoundCommand = new CompoundCommand(Messages.CustomTimelineCompartmentLayoutEditPolicy_MoveVerticalLine);
- final FullLifelineEditPartCN lifelineEditPart = (FullLifelineEditPartCN) getHost().getParent();
+ final FullLifelineEditPartCN lifelineEditPart = (FullLifelineEditPartCN)getHost().getParent();
compoundCommand.add(new RefreshCommandForUndo(lifelineEditPart));
- final FullLifelineTimelineCompartmentEditPartCN timelineCompartmentEditPart = (FullLifelineTimelineCompartmentEditPartCN) EditPartUtils
- .findFirstChildEditPartWithId(lifelineEditPart, FullLifelineTimelineCompartmentEditPartCN.VISUAL_ID);
- final View timelineCompartmentView = (View) timelineCompartmentEditPart.getModel();
+ final FullLifelineTimelineCompartmentEditPartCN timelineCompartmentEditPart = (FullLifelineTimelineCompartmentEditPartCN)EditPartUtils.findFirstChildEditPartWithId(lifelineEditPart, FullLifelineTimelineCompartmentEditPartCN.VISUAL_ID);
+ final View timelineCompartmentView = (View)timelineCompartmentEditPart.getModel();
@SuppressWarnings("unchecked")
final List<EditPart> editParts = changeBoundsRequest.getEditParts();
@@ -161,16 +161,16 @@ public class CustomTimelineCompartmentLayoutEditPolicy extends AbstractTimelineL
final List<Node> nodesToMove = new ArrayList<Node>();
final List<Integer> indexes = new ArrayList<Integer>();
final List<Node> allMovedNodes = getAllMovedNodes(request);
- for (final EditPart editPart : editParts) {
- if (editPart instanceof FullStateInvariantVerticalLineEditPart) {
- final FullStateInvariantVerticalLineEditPart verticalLineEditPart = (FullStateInvariantVerticalLineEditPart) editPart;
- final View verticalLineView = (View) verticalLineEditPart.getModel();
+ for(final EditPart editPart : editParts) {
+ if(editPart instanceof FullStateInvariantVerticalLineEditPart) {
+ final FullStateInvariantVerticalLineEditPart verticalLineEditPart = (FullStateInvariantVerticalLineEditPart)editPart;
+ final View verticalLineView = (View)verticalLineEditPart.getModel();
final int index = timelineCompartmentView.getChildren().indexOf(verticalLineView);
- if (index > 0) {
+ if(index > 0) {
final int occurrenceSpecificationIndex = index - 1;
- final View previousView = (View) timelineCompartmentView.getChildren().get(occurrenceSpecificationIndex);
- if (previousView.getElement() instanceof OccurrenceSpecification) {
- final Node occurrenceSpecificationNode = (Node) previousView;
+ final View previousView = (View)timelineCompartmentView.getChildren().get(occurrenceSpecificationIndex);
+ if(previousView.getElement() instanceof OccurrenceSpecification) {
+ final Node occurrenceSpecificationNode = (Node)previousView;
nodesToMove.add(occurrenceSpecificationNode);
indexes.add(Integer.valueOf(occurrenceSpecificationIndex));
}
@@ -178,7 +178,7 @@ public class CustomTimelineCompartmentLayoutEditPolicy extends AbstractTimelineL
}
}
int i = 0;
- for (final Node node : nodesToMove) {
+ for(final Node node : nodesToMove) {
compoundCommand.add(getMoveOccurrenceSpecificationCommand(node, moveDelta, timelineCompartmentView, indexes.get(i).intValue(), allMovedNodes));
i++;
}
@@ -187,15 +187,14 @@ public class CustomTimelineCompartmentLayoutEditPolicy extends AbstractTimelineL
}
private Command getMoveOccurrenceSpecificationsCommand(final Request request) {
- final ChangeBoundsRequest changeBoundsRequest = (ChangeBoundsRequest) request;
+ final ChangeBoundsRequest changeBoundsRequest = (ChangeBoundsRequest)request;
final CompoundCommand compoundCommand = new CompoundCommand(Messages.CustomTimelineCompartmentLayoutEditPolicy_MoveOccurrenceSpecification);
- final FullLifelineEditPartCN lifelineEditPart = (FullLifelineEditPartCN) getHost().getParent();
+ final FullLifelineEditPartCN lifelineEditPart = (FullLifelineEditPartCN)getHost().getParent();
compoundCommand.add(new RefreshCommandForUndo(lifelineEditPart));
- final FullLifelineTimelineCompartmentEditPartCN timelineCompartmentEditPart = (FullLifelineTimelineCompartmentEditPartCN) EditPartUtils
- .findFirstChildEditPartWithId(lifelineEditPart, FullLifelineTimelineCompartmentEditPartCN.VISUAL_ID);
- final View timelineCompartmentView = (View) timelineCompartmentEditPart.getModel();
+ final FullLifelineTimelineCompartmentEditPartCN timelineCompartmentEditPart = (FullLifelineTimelineCompartmentEditPartCN)EditPartUtils.findFirstChildEditPartWithId(lifelineEditPart, FullLifelineTimelineCompartmentEditPartCN.VISUAL_ID);
+ final View timelineCompartmentView = (View)timelineCompartmentEditPart.getModel();
@SuppressWarnings("unchecked")
final List<EditPart> editParts = changeBoundsRequest.getEditParts();
final Point moveDelta = FigureUtils.scaleByZoom(changeBoundsRequest.getMoveDelta(), lifelineEditPart.getFigure());
@@ -203,18 +202,18 @@ public class CustomTimelineCompartmentLayoutEditPolicy extends AbstractTimelineL
moveDelta.y = 0;
final List<Node> nodesToMove = new ArrayList<Node>();
final List<Node> allMovedNodes = getAllMovedNodes(request);
- for (final EditPart editPart : editParts) {
- if (OccurrenceSpecificationUtils.isOccurrenceSpecificationEditPart(editPart)) {
- final Node occurrenceSpecificationNode = (Node) editPart.getModel();
- final Rectangle figureBounds = ((GraphicalEditPart) editPart).getFigure().getBounds();
+ for(final EditPart editPart : editParts) {
+ if(OccurrenceSpecificationUtils.isOccurrenceSpecificationEditPart(editPart)) {
+ final Node occurrenceSpecificationNode = (Node)editPart.getModel();
+ final Rectangle figureBounds = ((GraphicalEditPart)editPart).getFigure().getBounds();
// constrain the move inside the timeline
moveDelta.x = Math.min(moveDelta.x, getHostFigure().getBounds().width - figureBounds.x - figureBounds.width - 2);
nodesToMove.add(occurrenceSpecificationNode);
}
}
- for (final Node node : nodesToMove) {
+ for(final Node node : nodesToMove) {
final int index = timelineCompartmentView.getChildren().indexOf(node);
- if (index >= 0) {
+ if(index >= 0) {
compoundCommand.add(getMoveOccurrenceSpecificationCommand(node, moveDelta, timelineCompartmentView, index, allMovedNodes));
}
}
@@ -227,22 +226,22 @@ public class CustomTimelineCompartmentLayoutEditPolicy extends AbstractTimelineL
private static List<Node> getAllMovedNodes(final Request request) {
final List<Node> allMovedNodes = new ArrayList<Node>();
final Map<Object, Object> extendedData = request.getExtendedData();
- if (extendedData != null) {
- List<EditPart> editParts = (List<EditPart>) extendedData.get(ALL_MOVED_EDITPARTS);
+ if(extendedData != null) {
+ List<EditPart> editParts = (List<EditPart>)extendedData.get(ALL_MOVED_EDITPARTS);
// when the request is sent directly, for example in unit tests
- if (editParts == null) {
- if (request instanceof GroupRequest) {
- final GroupRequest groupRequest = (GroupRequest) request;
+ if(editParts == null) {
+ if(request instanceof GroupRequest) {
+ final GroupRequest groupRequest = (GroupRequest)request;
editParts = groupRequest.getEditParts();
}
}
- if (editParts != null) {
- for (final EditPart editPart : editParts) {
- if (editPart instanceof GraphicalEditPart) {
- final GraphicalEditPart graphicalEditPart = (GraphicalEditPart) editPart;
+ if(editParts != null) {
+ for(final EditPart editPart : editParts) {
+ if(editPart instanceof GraphicalEditPart) {
+ final GraphicalEditPart graphicalEditPart = (GraphicalEditPart)editPart;
final Object model = graphicalEditPart.getModel();
- if (model instanceof Node) {
- final Node node = (Node) model;
+ if(model instanceof Node) {
+ final Node node = (Node)model;
allMovedNodes.add(node);
}
}
@@ -255,12 +254,10 @@ public class CustomTimelineCompartmentLayoutEditPolicy extends AbstractTimelineL
/** returns a NonResizableEditPolicy instead of a ResizableEditPolicy for some children */
@Override
protected EditPolicy createChildEditPolicy(final EditPart child) {
- final View childView = (View) child.getModel();
+ final View childView = (View)child.getModel();
final int visualID = UMLVisualIDRegistry.getVisualID(childView);
// make these EditParts non-resizable
- if (visualID == FullStateInvariantEditPartCN.VISUAL_ID || OccurrenceSpecificationUtils.isOccurrenceSpecificationEditPart(visualID)
- || visualID == FullStateInvariantVerticalLineEditPart.VISUAL_ID || TimeElementUtils.isTimeElementEditPart(visualID)
- || GeneralOrderingUtils.isGeneralOrderingEditPart(visualID)) {
+ if(visualID == FullStateInvariantEditPartCN.VISUAL_ID || OccurrenceSpecificationUtils.isOccurrenceSpecificationEditPart(visualID) || visualID == FullStateInvariantVerticalLineEditPart.VISUAL_ID || TimeElementUtils.isTimeElementEditPart(visualID) || GeneralOrderingUtils.isGeneralOrderingEditPart(visualID)) {
return createNonResizableEditPolicy();
}
return super.createChildEditPolicy(child);
@@ -268,6 +265,7 @@ public class CustomTimelineCompartmentLayoutEditPolicy extends AbstractTimelineL
private NonResizableEditPolicy createNonResizableEditPolicy() {
return new NonResizableEditPolicyEx() {
+
/**
* Overridden in order to keep the information about all EditParts being dragged simultaneously (the GEF
* NonResizableEditPolicy redirects a multi-part move to several moves each on a single part)
@@ -292,21 +290,20 @@ public class CustomTimelineCompartmentLayoutEditPolicy extends AbstractTimelineL
@Override
protected void showLayoutTargetFeedback(final Request request) {
- if (!RequestUtils.isChangeBoundsRequestFor(request, UMLPackage.eINSTANCE.getStateInvariant())) {
+ if(!RequestUtils.isChangeBoundsRequestFor(request, UMLPackage.eINSTANCE.getStateInvariant())) {
return;
}
eraseLayoutTargetFeedback();
- final ChangeBoundsRequest changeBoundsRequest = (ChangeBoundsRequest) request;
+ final ChangeBoundsRequest changeBoundsRequest = (ChangeBoundsRequest)request;
final int targetY = computeTargetOrdinate(changeBoundsRequest);
@SuppressWarnings("unchecked")
final List<GraphicalEditPart> editParts = changeBoundsRequest.getEditParts();
final double scale = FigureUtils.getScale(getHostFigure());
- for (final GraphicalEditPart editPart : editParts) {
+ for(final GraphicalEditPart editPart : editParts) {
final Rectangle figureBounds = editPart.getFigure().getBounds();
- final Rectangle containerBounds = ((GraphicalEditPart) getHost()).getFigure().getBounds();
- final Rectangle feedbackBounds = new Rectangle(containerBounds.x + figureBounds.x, targetY - LAYOUT_FEEDBACK_HEIGHT / 2, figureBounds.width,
- LAYOUT_FEEDBACK_HEIGHT);
+ final Rectangle containerBounds = ((GraphicalEditPart)getHost()).getFigure().getBounds();
+ final Rectangle feedbackBounds = new Rectangle(containerBounds.x + figureBounds.x, targetY - LAYOUT_FEEDBACK_HEIGHT / 2, figureBounds.width, LAYOUT_FEEDBACK_HEIGHT);
feedbackBounds.scale(scale);
this.layoutFeedbackFigures.add(createLayoutTargetFeedbackFigure(feedbackBounds));
}
@@ -314,7 +311,7 @@ public class CustomTimelineCompartmentLayoutEditPolicy extends AbstractTimelineL
private int computeTargetOrdinate(final ChangeBoundsRequest request) {
final int ordinate = request.getLocation().y;
- final FullLifelineEditPartCN lifelineEditPart = (FullLifelineEditPartCN) getHost().getParent();
+ final FullLifelineEditPartCN lifelineEditPart = (FullLifelineEditPartCN)getHost().getParent();
final StateDefinitionEditPart stateDefinitionEditPart = StateDefinitionUtils.findStateDefinitionClosestToOrdinate(lifelineEditPart, ordinate);
final Rectangle figureBounds = stateDefinitionEditPart.getFigure().getBounds();
@@ -333,14 +330,14 @@ public class CustomTimelineCompartmentLayoutEditPolicy extends AbstractTimelineL
@Override
protected void eraseLayoutTargetFeedback(final Request request) {
- if (!RequestUtils.isChangeBoundsRequestFor(request, UMLPackage.eINSTANCE.getStateInvariant())) {
+ if(!RequestUtils.isChangeBoundsRequestFor(request, UMLPackage.eINSTANCE.getStateInvariant())) {
return;
}
eraseLayoutTargetFeedback();
}
private void eraseLayoutTargetFeedback() {
- for (final IFigure figure : this.layoutFeedbackFigures) {
+ for(final IFigure figure : this.layoutFeedbackFigures) {
removeFeedback(figure);
}
this.layoutFeedbackFigures.clear();
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomTimingDiagramCreationEditPolicy.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomTimingDiagramCreationEditPolicy.java
index 2e6bdd2aba2..ab9c22abd48 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomTimingDiagramCreationEditPolicy.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomTimingDiagramCreationEditPolicy.java
@@ -36,15 +36,15 @@ public class CustomTimingDiagramCreationEditPolicy extends PapyrusCreationEditPo
protected Command getCreateCommand(final CreateViewRequest request) {
final Command superCommand = super.getCreateCommand(request);
final List<? extends ViewDescriptor> viewDescriptors = request.getViewDescriptors();
- if (request instanceof CreateViewAndElementRequest && viewDescriptors.size() == 1) {
+ if(request instanceof CreateViewAndElementRequest && viewDescriptors.size() == 1) {
final String semanticHint = viewDescriptors.get(0).getSemanticHint();
- if (Integer.toString(InteractionEditPartTN.VISUAL_ID).equals(semanticHint)) {
+ if(Integer.toString(InteractionEditPartTN.VISUAL_ID).equals(semanticHint)) {
final TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(getHost().getModel());
final CompoundCommand compoundCommand = new CompoundCommand(Messages.CustomTimingDiagramCreationEditPolicy_CreateInteraction);
- compoundCommand.add(new RefreshCommandForUndo((IGraphicalEditPart) getHost()));
+ compoundCommand.add(new RefreshCommandForUndo((IGraphicalEditPart)getHost()));
compoundCommand.add(superCommand);
compoundCommand.add(new ICommandProxy(TimeRulerUtils.getCreateFreeTimeRulerCommand(superCommand, editingDomain, true)));
- compoundCommand.add(new RefreshCommandForDo((IGraphicalEditPart) getHost()));
+ compoundCommand.add(new RefreshCommandForDo((IGraphicalEditPart)getHost()));
return compoundCommand;
}
}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/ExternalLabelPrimaryDragRoleEditPolicy.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/ExternalLabelPrimaryDragRoleEditPolicy.java
index 40673b4380e..c4ee9ee3a8f 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/ExternalLabelPrimaryDragRoleEditPolicy.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/ExternalLabelPrimaryDragRoleEditPolicy.java
@@ -47,14 +47,14 @@ public class ExternalLabelPrimaryDragRoleEditPolicy extends NonResizableLabelEdi
@Override
protected List<?> createSelectionHandles() {
- final MoveHandle mh = new MoveHandle((GraphicalEditPart) getHost());
+ final MoveHandle mh = new MoveHandle((GraphicalEditPart)getHost());
mh.setBorder(null);
return Collections.singletonList(mh);
}
@Override
protected Command getMoveCommand(final ChangeBoundsRequest request) {
- final LabelEditPart editPart = (LabelEditPart) getHost();
+ final LabelEditPart editPart = (LabelEditPart)getHost();
final IFigure parentFigure = getHostFigure().getParent();
final Rectangle parentBounds = parentFigure.getBounds();
@@ -70,9 +70,8 @@ public class ExternalLabelPrimaryDragRoleEditPolicy extends NonResizableLabelEdi
updatedBounds = updatedBounds.getTranslated(parentBounds.getLocation().getNegated());
final CompoundCommand compoundCommand = new CompoundCommand();
- compoundCommand.add(new RefreshCommandForUndo((GraphicalEditPart) editPart.getParent().getParent()));
- compoundCommand.add(new ICommandProxy(new SetBoundsCommand(editPart.getEditingDomain(), DiagramUIMessages.MoveLabelCommand_Label_Location,
- new EObjectAdapter((View) editPart.getModel()), updatedBounds)));
+ compoundCommand.add(new RefreshCommandForUndo((GraphicalEditPart)editPart.getParent().getParent()));
+ compoundCommand.add(new ICommandProxy(new SetBoundsCommand(editPart.getEditingDomain(), DiagramUIMessages.MoveLabelCommand_Label_Location, new EObjectAdapter((View)editPart.getModel()), updatedBounds)));
compoundCommand.add(new RefreshCommandForDo(editPart));
return compoundCommand;
}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/FirstEventRefreshEditPolicy.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/FirstEventRefreshEditPolicy.java
index d540944d813..aa8b7a5554a 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/FirstEventRefreshEditPolicy.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/FirstEventRefreshEditPolicy.java
@@ -41,7 +41,7 @@ public class FirstEventRefreshEditPolicy extends GraphicalEditPolicy implements
@Override
public void activate() {
this.umlElement = getUMLElement();
- if (this.umlElement == null) {
+ if(this.umlElement == null) {
return;
}
// adds a listener on the UML element
@@ -53,7 +53,7 @@ public class FirstEventRefreshEditPolicy extends GraphicalEditPolicy implements
@Override
public void deactivate() {
// retrieve the UML element managed by the edit part
- if (this.umlElement == null) {
+ if(this.umlElement == null) {
return;
}
// remove the listener from the UML element
@@ -66,8 +66,8 @@ public class FirstEventRefreshEditPolicy extends GraphicalEditPolicy implements
* @return the diagram event broker
*/
protected DiagramEventBroker getDiagramEventBroker() {
- final TransactionalEditingDomain editingDomain = ((IGraphicalEditPart) getHost()).getEditingDomain();
- if (editingDomain != null) {
+ final TransactionalEditingDomain editingDomain = ((IGraphicalEditPart)getHost()).getEditingDomain();
+ if(editingDomain != null) {
return DiagramEventBroker.getInstance(editingDomain);
}
return null;
@@ -80,8 +80,8 @@ public class FirstEventRefreshEditPolicy extends GraphicalEditPolicy implements
*/
protected Element getUMLElement() {
final View view = getView();
- if (view != null) {
- return (Element) view.getElement();
+ if(view != null) {
+ return (Element)view.getElement();
}
return null;
}
@@ -92,14 +92,13 @@ public class FirstEventRefreshEditPolicy extends GraphicalEditPolicy implements
* @return the view controlled by the host edit part
*/
protected View getView() {
- return (View) getHost().getModel();
+ return (View)getHost().getModel();
}
public void notifyChanged(final Notification notification) {
- if (notification.getEventType() == Notification.SET) {
+ if(notification.getEventType() == Notification.SET) {
final Object feature = notification.getFeature();
- if (feature == UMLPackage.eINSTANCE.getTimeObservation_FirstEvent() || feature == UMLPackage.eINSTANCE.getTimeObservation_Event()
- || feature == UMLPackage.eINSTANCE.getTimeConstraint_FirstEvent() || feature == UMLPackage.eINSTANCE.getConstraint_ConstrainedElement()) {
+ if(feature == UMLPackage.eINSTANCE.getTimeObservation_FirstEvent() || feature == UMLPackage.eINSTANCE.getTimeObservation_Event() || feature == UMLPackage.eINSTANCE.getTimeConstraint_FirstEvent() || feature == UMLPackage.eINSTANCE.getConstraint_ConstrainedElement()) {
refreshView();
}
}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/GenericListCompartmentLayoutEditPolicy.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/GenericListCompartmentLayoutEditPolicy.java
index c30501b2acb..ceeb6eed568 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/GenericListCompartmentLayoutEditPolicy.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/GenericListCompartmentLayoutEditPolicy.java
@@ -45,13 +45,15 @@ import org.eclipse.papyrus.uml.diagram.timing.custom.utils.ViewUtils;
public class GenericListCompartmentLayoutEditPolicy extends ConstrainedToolbarLayoutEditPolicy {
private static final int LAYOUT_FEEDBACK_HEIGHT = 4;
+
private static final int MARGIN_BEFORE_FIRST = 4;
+
private static final int MARGIN_AFTER_LAST = 4;
protected IFigure layoutFeedbackFigure = null;
protected GraphicalEditPart getEditPartToRefresh() {
- return (GraphicalEditPart) getHost();
+ return (GraphicalEditPart)getHost();
}
protected int getLayoutFeedbackHeight() {
@@ -61,7 +63,7 @@ public class GenericListCompartmentLayoutEditPolicy extends ConstrainedToolbarLa
@Override
protected EditPolicy createChildEditPolicy(final EditPart child) {
EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (result == null) {
+ if(result == null) {
// add an edit policy so that children can be moved
result = new NonResizableEditPolicyEx();
}
@@ -70,22 +72,22 @@ public class GenericListCompartmentLayoutEditPolicy extends ConstrainedToolbarLa
@Override
protected Command getMoveChildrenCommand(final Request request) {
- if (request instanceof ChangeBoundsRequest) {
- final ChangeBoundsRequest changeBoundsRequest = (ChangeBoundsRequest) request;
+ if(request instanceof ChangeBoundsRequest) {
+ final ChangeBoundsRequest changeBoundsRequest = (ChangeBoundsRequest)request;
final InsertionPoint insertionPoint = computeClosestInsertionPoint(changeBoundsRequest.getLocation().y);
- if (insertionPoint == null) {
+ if(insertionPoint == null) {
return UnexecutableCommand.INSTANCE;
}
- final GraphicalEditPart hostEditPart = (GraphicalEditPart) getHost();
- final View compartmentView = (View) hostEditPart.getModel();
+ final GraphicalEditPart hostEditPart = (GraphicalEditPart)getHost();
+ final View compartmentView = (View)hostEditPart.getModel();
@SuppressWarnings("unchecked")
final List<EditPart> editParts = changeBoundsRequest.getEditParts();
- for (final EditPart editPart : editParts) {
- if (editPart instanceof GraphicalEditPart) {
- final GraphicalEditPart graphicalEditPart = (GraphicalEditPart) editPart;
- final View view = (View) graphicalEditPart.getModel();
+ for(final EditPart editPart : editParts) {
+ if(editPart instanceof GraphicalEditPart) {
+ final GraphicalEditPart graphicalEditPart = (GraphicalEditPart)editPart;
+ final View view = (View)graphicalEditPart.getModel();
final GraphicalEditPart editPartToRefresh = getEditPartToRefresh();
final CompoundCommand compoundCommand = new CompoundCommand();
@@ -101,20 +103,19 @@ public class GenericListCompartmentLayoutEditPolicy extends ConstrainedToolbarLa
@Override
protected void showLayoutTargetFeedback(final Request request) {
- if (request instanceof ChangeBoundsRequest) {
+ if(request instanceof ChangeBoundsRequest) {
eraseLayoutTargetFeedback();
- final ChangeBoundsRequest changeBoundsRequest = (ChangeBoundsRequest) request;
+ final ChangeBoundsRequest changeBoundsRequest = (ChangeBoundsRequest)request;
final InsertionPoint insertionPoint = computeClosestInsertionPoint(changeBoundsRequest.getLocation().y);
- if (insertionPoint == null) {
+ if(insertionPoint == null) {
return;
}
final Rectangle containerBounds = new Rectangle(getHostFigure().getBounds());
getHostFigure().translateToAbsolute(containerBounds);
final int layoutFeedbackHeight = getLayoutFeedbackHeight();
- final Rectangle feedbackBounds = new Rectangle(containerBounds.x, insertionPoint.getLocation() - layoutFeedbackHeight / 2, containerBounds.width,
- layoutFeedbackHeight);
+ final Rectangle feedbackBounds = new Rectangle(containerBounds.x, insertionPoint.getLocation() - layoutFeedbackHeight / 2, containerBounds.width, layoutFeedbackHeight);
final Point origin = FigureUtils.getLayeredPaneOrigin(getHostFigure());
feedbackBounds.translate(origin);
@@ -126,7 +127,9 @@ public class GenericListCompartmentLayoutEditPolicy extends ConstrainedToolbarLa
}
protected class InsertionPoint {
+
int index;
+
int location;
public InsertionPoint(final int index, final int location) {
@@ -146,13 +149,13 @@ public class GenericListCompartmentLayoutEditPolicy extends ConstrainedToolbarLa
protected InsertionPoint computeClosestInsertionPoint(final int offset) {
@SuppressWarnings("unchecked")
final List<GraphicalEditPart> children = getHost().getChildren();
- if (children.isEmpty()) {
+ if(children.isEmpty()) {
return null;
}
final List<InsertionPoint> insertionPoints = computeInsertionPoints(children);
final TreeMap<Integer, InsertionPoint> distanceMap = new TreeMap<Integer, InsertionPoint>();
- for (final InsertionPoint insertionPoint : insertionPoints) {
+ for(final InsertionPoint insertionPoint : insertionPoints) {
final int distance = Math.abs(offset - insertionPoint.getLocation());
distanceMap.put(Integer.valueOf(distance), insertionPoint);
}
@@ -172,19 +175,19 @@ public class GenericListCompartmentLayoutEditPolicy extends ConstrainedToolbarLa
final int size = children.size();
final List<InsertionPoint> insertionPoints = new ArrayList<GenericListCompartmentLayoutEditPolicy.InsertionPoint>();
Rectangle previousBounds = null;
- for (int i = 0; i < size; i++) {
+ for(int i = 0; i < size; i++) {
final GraphicalEditPart childEditPart = children.get(i);
final Rectangle bounds = new Rectangle(childEditPart.getFigure().getBounds());
getHostFigure().translateToAbsolute(bounds);
- if (previousBounds != null) {
+ if(previousBounds != null) {
// an insertion point between two figures
insertionPoints.add(new InsertionPoint(i, (previousBounds.y + previousBounds.height + bounds.y) / 2));
} else {
// an insertion point before the first figure
insertionPoints.add(new InsertionPoint(i, bounds.y - getMarginBeforeFirst()));
}
- if (i == size - 1) {
+ if(i == size - 1) {
// last insertion point: after the last figure
insertionPoints.add(new InsertionPoint(i + 1, bounds.y + bounds.height + getMarginAfterLast()));
}
@@ -209,7 +212,7 @@ public class GenericListCompartmentLayoutEditPolicy extends ConstrainedToolbarLa
}
protected void eraseLayoutTargetFeedback() {
- if (this.layoutFeedbackFigure != null) {
+ if(this.layoutFeedbackFigure != null) {
removeFeedback(this.layoutFeedbackFigure);
this.layoutFeedbackFigure = null;
}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/LayoutEditPolicyForLabel.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/LayoutEditPolicyForLabel.java
index c1b5d9228e7..f7385ae724f 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/LayoutEditPolicyForLabel.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/LayoutEditPolicyForLabel.java
@@ -32,12 +32,12 @@ public class LayoutEditPolicyForLabel extends LayoutEditPolicy {
@Override
protected EditPolicy createChildEditPolicy(final EditPart child) {
- final View childView = (View) child.getModel();
- if (UMLVisualIDRegistry.getVisualID(childView) == this.labelVisualId) {
+ final View childView = (View)child.getModel();
+ if(UMLVisualIDRegistry.getVisualID(childView) == this.labelVisualId) {
return new ExternalLabelPrimaryDragRoleEditPolicy();
}
EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (result == null) {
+ if(result == null) {
result = new NonResizableEditPolicy();
}
return result;
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/SelectionOnlyLayoutEditPolicy.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/SelectionOnlyLayoutEditPolicy.java
index 260fd49b1a6..7e0de86946e 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/SelectionOnlyLayoutEditPolicy.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/SelectionOnlyLayoutEditPolicy.java
@@ -17,6 +17,7 @@ import org.eclipse.gef.requests.CreateRequest;
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy;
public class SelectionOnlyLayoutEditPolicy extends LayoutEditPolicy {
+
@Override
protected Command getMoveChildrenCommand(final Request request) {
return null;
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/TimeRulerVisibilityRefreshEditPolicy.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/TimeRulerVisibilityRefreshEditPolicy.java
index 7bc3a167fb8..af03e4a5887 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/TimeRulerVisibilityRefreshEditPolicy.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/TimeRulerVisibilityRefreshEditPolicy.java
@@ -40,7 +40,7 @@ public class TimeRulerVisibilityRefreshEditPolicy extends GraphicalEditPolicy im
public void activate() {
this.timeRulerCompartmentView = getListenedView();
- if (this.timeRulerCompartmentView == null) {
+ if(this.timeRulerCompartmentView == null) {
return;
}
// adds a listener on the View
@@ -51,7 +51,7 @@ public class TimeRulerVisibilityRefreshEditPolicy extends GraphicalEditPolicy im
@Override
public void deactivate() {
- if (this.timeRulerCompartmentView == null) {
+ if(this.timeRulerCompartmentView == null) {
return;
}
// remove the listener from the View
@@ -64,8 +64,8 @@ public class TimeRulerVisibilityRefreshEditPolicy extends GraphicalEditPolicy im
* @return the diagram event broker
*/
protected DiagramEventBroker getDiagramEventBroker() {
- final TransactionalEditingDomain editingDomain = ((IGraphicalEditPart) getHost()).getEditingDomain();
- if (editingDomain != null) {
+ final TransactionalEditingDomain editingDomain = ((IGraphicalEditPart)getHost()).getEditingDomain();
+ if(editingDomain != null) {
return DiagramEventBroker.getInstance(editingDomain);
}
return null;
@@ -73,20 +73,20 @@ public class TimeRulerVisibilityRefreshEditPolicy extends GraphicalEditPolicy im
protected View getListenedView() {
final View view = getView();
- if (view != null) {
+ if(view != null) {
return ViewUtils.findTimeRulerCompartmentView(view);
}
return null;
}
protected View getView() {
- return (View) getHost().getModel();
+ return (View)getHost().getModel();
}
public void notifyChanged(final Notification notification) {
- if (notification.getEventType() == Notification.SET) {
+ if(notification.getEventType() == Notification.SET) {
final Object feature = notification.getFeature();
- if (feature == NotationPackage.eINSTANCE.getView_Visible()) {
+ if(feature == NotationPackage.eINSTANCE.getView_Visible()) {
refreshFigure();
}
}
@@ -98,7 +98,7 @@ public class TimeRulerVisibilityRefreshEditPolicy extends GraphicalEditPolicy im
*/
public void refreshFigure() {
final boolean visible = getListenedView().isVisible();
- final IFigure figure = ((IGraphicalEditPart) getHost()).getFigure();
+ final IFigure figure = ((IGraphicalEditPart)getHost()).getFigure();
final LifelineFigure lifelineFigure = FigureUtils.findChildFigureInstance(figure, LifelineFigure.class);
lifelineFigure.setDisplayTimeRuler(visible);
}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/TimingDiagramDragDropEditPolicy.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/TimingDiagramDragDropEditPolicy.java
index c8e9124ccba..2eda7e42da8 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/TimingDiagramDragDropEditPolicy.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/TimingDiagramDragDropEditPolicy.java
@@ -93,11 +93,7 @@ public class TimingDiagramDragDropEditPolicy extends CommonDiagramDragDropEditPo
/** Elements for which we want to specialize the drop */
@SuppressWarnings("boxing")
- private static final Integer[] SPECIFIC_DROP_ELEMENT_IDS = { InteractionEditPartTN.VISUAL_ID, FullLifelineEditPartCN.VISUAL_ID,
- CompactLifelineEditPartCN.VISUAL_ID, MessageSyncEditPart.VISUAL_ID, MessageAsyncEditPart.VISUAL_ID, MessageReplyEditPart.VISUAL_ID,
- MessageCreateEditPart.VISUAL_ID, MessageDeleteEditPart.VISUAL_ID, MessageFoundEditPart.VISUAL_ID, MessageLostEditPart.VISUAL_ID,
- TimeObservationEditPart.VISUAL_ID, TimeConstraintEditPart.VISUAL_ID, DurationObservationEditPartCN.VISUAL_ID,
- DurationConstraintEditPartCN.VISUAL_ID, GeneralOrderingEditPart.VISUAL_ID, GateEditPart.VISUAL_ID };
+ private static final Integer[] SPECIFIC_DROP_ELEMENT_IDS = { InteractionEditPartTN.VISUAL_ID, FullLifelineEditPartCN.VISUAL_ID, CompactLifelineEditPartCN.VISUAL_ID, MessageSyncEditPart.VISUAL_ID, MessageAsyncEditPart.VISUAL_ID, MessageReplyEditPart.VISUAL_ID, MessageCreateEditPart.VISUAL_ID, MessageDeleteEditPart.VISUAL_ID, MessageFoundEditPart.VISUAL_ID, MessageLostEditPart.VISUAL_ID, TimeObservationEditPart.VISUAL_ID, TimeConstraintEditPart.VISUAL_ID, DurationObservationEditPartCN.VISUAL_ID, DurationConstraintEditPartCN.VISUAL_ID, GeneralOrderingEditPart.VISUAL_ID, GateEditPart.VISUAL_ID };
public TimingDiagramDragDropEditPolicy() {
super(TimingDiagramLinkMappingHelper.getInstance());
@@ -106,7 +102,7 @@ public class TimingDiagramDragDropEditPolicy extends CommonDiagramDragDropEditPo
/** override the drop command */
@Override
protected Command getSpecificDropCommand(final DropObjectsRequest dropRequest, final Element semanticElement, final int nodeVISUALID, final int linkVISUALID) {
- switch (nodeVISUALID) {
+ switch(nodeVISUALID) {
case InteractionEditPartTN.VISUAL_ID:
return new ICommandProxy(dropMainElement(dropRequest, semanticElement, nodeVISUALID));
case FullLifelineEditPartCN.VISUAL_ID:
@@ -115,30 +111,30 @@ public class TimingDiagramDragDropEditPolicy extends CommonDiagramDragDropEditPo
default:
}
- if (getHost().getModel() instanceof View) {
- final View hostView = (View) getHost().getModel();
- if (MessageUtils.isMessage(linkVISUALID)) {
- if (semanticElement instanceof Message) {
- return new ICommandProxy(DropUtils.getDropMessageCommand((Message) semanticElement, hostView, getViewer()));
+ if(getHost().getModel() instanceof View) {
+ final View hostView = (View)getHost().getModel();
+ if(MessageUtils.isMessage(linkVISUALID)) {
+ if(semanticElement instanceof Message) {
+ return new ICommandProxy(DropUtils.getDropMessageCommand((Message)semanticElement, hostView, getViewer()));
}
}
- if (nodeVISUALID == TimeObservationEditPart.VISUAL_ID) {
- return new ICommandProxy(DropUtils.getDropTimeObservationCommand((TimeObservation) semanticElement, hostView, getViewer()));
+ if(nodeVISUALID == TimeObservationEditPart.VISUAL_ID) {
+ return new ICommandProxy(DropUtils.getDropTimeObservationCommand((TimeObservation)semanticElement, hostView, getViewer()));
}
- if (nodeVISUALID == TimeConstraintEditPart.VISUAL_ID) {
- return new ICommandProxy(DropUtils.getDropTimeConstraintCommand((TimeConstraint) semanticElement, hostView, getViewer()));
+ if(nodeVISUALID == TimeConstraintEditPart.VISUAL_ID) {
+ return new ICommandProxy(DropUtils.getDropTimeConstraintCommand((TimeConstraint)semanticElement, hostView, getViewer()));
}
- if (nodeVISUALID == DurationObservationEditPartCN.VISUAL_ID) {
- return new ICommandProxy(DropUtils.getDropDurationObservationCommand((DurationObservation) semanticElement, hostView, getViewer()));
+ if(nodeVISUALID == DurationObservationEditPartCN.VISUAL_ID) {
+ return new ICommandProxy(DropUtils.getDropDurationObservationCommand((DurationObservation)semanticElement, hostView, getViewer()));
}
- if (nodeVISUALID == DurationConstraintEditPartCN.VISUAL_ID) {
- return new ICommandProxy(DropUtils.getDropDurationConstraintCommand((DurationConstraint) semanticElement, hostView, getViewer()));
+ if(nodeVISUALID == DurationConstraintEditPartCN.VISUAL_ID) {
+ return new ICommandProxy(DropUtils.getDropDurationConstraintCommand((DurationConstraint)semanticElement, hostView, getViewer()));
}
- if (nodeVISUALID == GeneralOrderingEditPart.VISUAL_ID) {
- return new ICommandProxy(DropUtils.getDropGeneralOrderingCommand((GeneralOrdering) semanticElement, hostView, getViewer()));
+ if(nodeVISUALID == GeneralOrderingEditPart.VISUAL_ID) {
+ return new ICommandProxy(DropUtils.getDropGeneralOrderingCommand((GeneralOrdering)semanticElement, hostView, getViewer()));
}
- if (nodeVISUALID == GateEditPart.VISUAL_ID) {
- return new ICommandProxy(DropUtils.getDropGateCommand((Gate) semanticElement, hostView, getViewer()));
+ if(nodeVISUALID == GateEditPart.VISUAL_ID) {
+ return new ICommandProxy(DropUtils.getDropGateCommand((Gate)semanticElement, hostView, getViewer()));
}
}
@@ -147,16 +143,16 @@ public class TimingDiagramDragDropEditPolicy extends CommonDiagramDragDropEditPo
}
private ICommand dropLifeline(final DropObjectsRequest dropRequest, final Element semanticElement, final int nodeVISUALID) {
- if (!(semanticElement instanceof Lifeline)) {
+ if(!(semanticElement instanceof Lifeline)) {
throw new IllegalArgumentException();
}
- final Lifeline lifeline = (Lifeline) semanticElement;
+ final Lifeline lifeline = (Lifeline)semanticElement;
final CompositeCommand cc = new CompositeCommand(Messages.TimingDiagramDragDropEditPolicy_DropLifeline);
final ICommand dropMainElementCommand = dropMainElement(dropRequest, semanticElement, nodeVISUALID);
cc.add(dropMainElementCommand);
final LifelineType lifelineType = LifelineUtils.getLifelineType(lifeline);
- if (lifelineType == LifelineType.full) {
+ if(lifelineType == LifelineType.full) {
cc.add(dropStateDefinitions(lifeline, dropMainElementCommand.getCommandResult()));
}
cc.add(dropLifelineFragments(lifeline, dropMainElementCommand.getCommandResult(), lifelineType));
@@ -164,29 +160,29 @@ public class TimingDiagramDragDropEditPolicy extends CommonDiagramDragDropEditPo
}
private static ICommand dropStateDefinitions(final Lifeline lifeline, final CommandResult lifelineCreateViewCommandResult) {
- if (lifelineCreateViewCommandResult == null) {
+ if(lifelineCreateViewCommandResult == null) {
return UnexecutableCommand.INSTANCE;
}
final TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(lifeline);
final Object returnValue = lifelineCreateViewCommandResult.getReturnValue();
return new AbstractTransactionalCommand(editingDomain, Messages.TimingDiagramDragDropEditPolicy_DropStateDefinitions, null, null) {
+
@Override
protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
- if (returnValue instanceof IAdaptable) {
- final IAdaptable adaptable = (IAdaptable) returnValue;
- final View lifelineView = (View) adaptable.getAdapter(View.class);
- if (lifelineView == null) {
+ if(returnValue instanceof IAdaptable) {
+ final IAdaptable adaptable = (IAdaptable)returnValue;
+ final View lifelineView = (View)adaptable.getAdapter(View.class);
+ if(lifelineView == null) {
return CommandResult.newErrorCommandResult("Parent Lifeline not found"); //$NON-NLS-1$
}
final View stateDefinitionCompartmentView = ViewUtils.findStateDefinitionCompartmentView(lifelineView);
final List<String> stateDefinitionIds = StateDefinitionUtils.getStateDefinitionIds(lifeline);
- for (final String stateDefinitionId : stateDefinitionIds) {
+ for(final String stateDefinitionId : stateDefinitionIds) {
final String stateDefinitionName = StateDefinitionUtils.getStateDefinitionName(stateDefinitionId, lifeline);
// create the View for the state definition
final UMLViewProvider umlViewProvider = new UMLViewProvider();
- final Node stateDefinitionView = umlViewProvider.createNode_9(null, stateDefinitionCompartmentView, -1, true,
- PreferencesHint.USE_DEFAULTS);
+ final Node stateDefinitionView = umlViewProvider.createNode_9(null, stateDefinitionCompartmentView, -1, true, PreferencesHint.USE_DEFAULTS);
// restore the same id
StateDefinitionUtils.setStateDefinitionViewID(stateDefinitionView, stateDefinitionId);
// set the name on the View
@@ -200,40 +196,40 @@ public class TimingDiagramDragDropEditPolicy extends CommonDiagramDragDropEditPo
}
private static ICommand dropLifelineFragments(final Lifeline lifeline, final CommandResult lifelineCreateViewCommandResult, final LifelineType lifelineType) {
- if (lifelineCreateViewCommandResult == null) {
+ if(lifelineCreateViewCommandResult == null) {
return UnexecutableCommand.INSTANCE;
}
final TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(lifeline);
final Object returnValue = lifelineCreateViewCommandResult.getReturnValue();
return new AbstractTransactionalCommand(editingDomain, Messages.TimingDiagramDragDropEditPolicy_DropLifelineFragments, null, null) {
+
@Override
protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
- if (returnValue instanceof IAdaptable) {
- final IAdaptable adaptable = (IAdaptable) returnValue;
- final View lifelineView = (View) adaptable.getAdapter(View.class);
- if (lifelineView == null) {
+ if(returnValue instanceof IAdaptable) {
+ final IAdaptable adaptable = (IAdaptable)returnValue;
+ final View lifelineView = (View)adaptable.getAdapter(View.class);
+ if(lifelineView == null) {
return CommandResult.newErrorCommandResult("Parent Lifeline not found"); //$NON-NLS-1$
}
- final View compartmentView = (lifelineType == LifelineType.full ? ViewUtils.findFullLifelineCompartmentView(lifelineView) : ViewUtils
- .findCompactTimelineCompartmentView(lifelineView));
+ final View compartmentView = (lifelineType == LifelineType.full ? ViewUtils.findFullLifelineCompartmentView(lifelineView) : ViewUtils.findCompactTimelineCompartmentView(lifelineView));
final EList<InteractionFragment> fragments = lifeline.getCoveredBys();
final UMLViewProvider umlViewProvider = new UMLViewProvider();
int x = lifelineType == LifelineType.full ? 20 : CustomCompactLifelineCompartmentEditPart.FIRST_STATE_OFFSET;
boolean firstStateInvariant = true;
String previousStateInvariantName = ""; //$NON-NLS-1$
- for (final InteractionFragment fragment : fragments) {
- if (fragment instanceof StateInvariant) {
- if (!firstStateInvariant && lifelineType == LifelineType.full) {
+ for(final InteractionFragment fragment : fragments) {
+ if(fragment instanceof StateInvariant) {
+ if(!firstStateInvariant && lifelineType == LifelineType.full) {
// add a vertical line
umlViewProvider.createNode_39(null, compartmentView, -1, true, PreferencesHint.USE_DEFAULTS);
}
- final StateInvariant stateInvariant = (StateInvariant) fragment;
+ final StateInvariant stateInvariant = (StateInvariant)fragment;
final String stateInvariantName = StateInvariantUtils.getInnerStateInvariantName(stateInvariant);
- if (lifelineType == LifelineType.full) {
- if (Utils.safeEquals(stateInvariantName, previousStateInvariantName)) {
+ if(lifelineType == LifelineType.full) {
+ if(Utils.safeEquals(stateInvariantName, previousStateInvariantName)) {
x += 10;
} else {
x += 25;
@@ -243,40 +239,37 @@ public class TimingDiagramDragDropEditPolicy extends CommonDiagramDragDropEditPo
}
// create the View for the state invariant
- if (lifelineType == LifelineType.full) {
+ if(lifelineType == LifelineType.full) {
umlViewProvider.createStateInvariant_11(stateInvariant, compartmentView, -1, true, PreferencesHint.USE_DEFAULTS);
- } else if (lifelineType == LifelineType.compact) {
+ } else if(lifelineType == LifelineType.compact) {
umlViewProvider.createStateInvariant_28(stateInvariant, compartmentView, -1, true, PreferencesHint.USE_DEFAULTS);
}
firstStateInvariant = false;
previousStateInvariantName = stateInvariantName;
- } else if (fragment instanceof DestructionOccurrenceSpecification) {
- final DestructionOccurrenceSpecification destructionOccurrenceSpecification = (DestructionOccurrenceSpecification) fragment;
+ } else if(fragment instanceof DestructionOccurrenceSpecification) {
+ final DestructionOccurrenceSpecification destructionOccurrenceSpecification = (DestructionOccurrenceSpecification)fragment;
// create the View for the occurrence specification
- final Node occurrenceSpecificationView = umlViewProvider.createDestructionOccurrenceSpecification_27(
- destructionOccurrenceSpecification, compartmentView, -1, true, PreferencesHint.USE_DEFAULTS);
+ final Node occurrenceSpecificationView = umlViewProvider.createDestructionOccurrenceSpecification_27(destructionOccurrenceSpecification, compartmentView, -1, true, PreferencesHint.USE_DEFAULTS);
final Location loc = NotationFactory.eINSTANCE.createLocation();
loc.setX(x);
loc.setY(0);
occurrenceSpecificationView.setLayoutConstraint(loc);
x += 10;
- } else if (fragment instanceof MessageOccurrenceSpecification) {
- final MessageOccurrenceSpecification occurrenceSpecification = (MessageOccurrenceSpecification) fragment;
+ } else if(fragment instanceof MessageOccurrenceSpecification) {
+ final MessageOccurrenceSpecification occurrenceSpecification = (MessageOccurrenceSpecification)fragment;
// create the View for the occurrence specification
- final Node occurrenceSpecificationView = umlViewProvider.createMessageOccurrenceSpecification_13(occurrenceSpecification,
- compartmentView, -1, true, PreferencesHint.USE_DEFAULTS);
+ final Node occurrenceSpecificationView = umlViewProvider.createMessageOccurrenceSpecification_13(occurrenceSpecification, compartmentView, -1, true, PreferencesHint.USE_DEFAULTS);
final Location loc = NotationFactory.eINSTANCE.createLocation();
loc.setX(x);
loc.setY(0);
occurrenceSpecificationView.setLayoutConstraint(loc);
x += 10;
- } else if (fragment instanceof OccurrenceSpecification) {
- final OccurrenceSpecification occurrenceSpecification = (OccurrenceSpecification) fragment;
+ } else if(fragment instanceof OccurrenceSpecification) {
+ final OccurrenceSpecification occurrenceSpecification = (OccurrenceSpecification)fragment;
// create the View for the occurrence specification
- final Node occurrenceSpecificationView = umlViewProvider.createOccurrenceSpecification_12(occurrenceSpecification, compartmentView,
- -1, true, PreferencesHint.USE_DEFAULTS);
+ final Node occurrenceSpecificationView = umlViewProvider.createOccurrenceSpecification_12(occurrenceSpecification, compartmentView, -1, true, PreferencesHint.USE_DEFAULTS);
final Location loc = NotationFactory.eINSTANCE.createLocation();
loc.setX(x);
@@ -294,10 +287,10 @@ public class TimingDiagramDragDropEditPolicy extends CommonDiagramDragDropEditPo
}
private ICommand dropMainElement(final DropObjectsRequest dropRequest, final Element semanticElement, final int nodeVISUALID) {
- if (canBeDropped(semanticElement)) {
- final IHintedType type = ((IHintedType) getUMLElementType(nodeVISUALID));
+ if(canBeDropped(semanticElement)) {
+ final IHintedType type = ((IHintedType)getUMLElementType(nodeVISUALID));
String semanticHint = null;
- if (type != null) {
+ if(type != null) {
semanticHint = type.getSemanticHint();
}
return getDefaultDropNodeCommand(getHost(), semanticHint, dropRequest.getLocation(), semanticElement, dropRequest);
@@ -306,10 +299,9 @@ public class TimingDiagramDragDropEditPolicy extends CommonDiagramDragDropEditPo
}
private boolean canBeDropped(final Element semanticElement) {
- final GraphicalEditPart graphicalParentEditPart = (GraphicalEditPart) getHost();
+ final GraphicalEditPart graphicalParentEditPart = (GraphicalEditPart)getHost();
final EObject graphicalParentObject = graphicalParentEditPart.resolveSemanticElement();
- return (graphicalParentObject instanceof org.eclipse.uml2.uml.Package && semanticElement instanceof Interaction)
- || (graphicalParentObject instanceof Interaction && semanticElement instanceof Lifeline);
+ return (graphicalParentObject instanceof org.eclipse.uml2.uml.Package && semanticElement instanceof Interaction) || (graphicalParentObject instanceof Interaction && semanticElement instanceof Lifeline);
}
/** @return the set of element ids for which we want to specialize the drop */
@@ -325,9 +317,7 @@ public class TimingDiagramDragDropEditPolicy extends CommonDiagramDragDropEditPo
@Override
public int getNodeVisualID(final View containerView, final EObject domainElement) {
- if (domainElement instanceof Gate
- && (String.valueOf(InteractionEditPartTN.VISUAL_ID).equals(containerView.getType()) || String.valueOf(
- InteractionCompartmentEditPartTN.VISUAL_ID).equals(containerView.getType()))) {
+ if(domainElement instanceof Gate && (String.valueOf(InteractionEditPartTN.VISUAL_ID).equals(containerView.getType()) || String.valueOf(InteractionCompartmentEditPartTN.VISUAL_ID).equals(containerView.getType()))) {
// allow dropping a Gate directly on an Interaction or Interaction compartment
return GateEditPart.VISUAL_ID;
}
@@ -353,12 +343,12 @@ public class TimingDiagramDragDropEditPolicy extends CommonDiagramDragDropEditPo
final List<Interaction> updatedInteractionsCache = new ArrayList<Interaction>();
final List<?> droppedObjects = dropRequest.getObjects();
- for (final Object droppedObject : droppedObjects) {
- if (droppedObject instanceof EObject) {
- final EObject droppedEObject = (EObject) droppedObject;
+ for(final Object droppedObject : droppedObjects) {
+ if(droppedObject instanceof EObject) {
+ final EObject droppedEObject = (EObject)droppedObject;
final Interaction interaction = InteractionUtils.getContainingInteraction(droppedEObject);
- if (interaction != null) {
- if (!updatedInteractionsCache.contains(interaction)) {
+ if(interaction != null) {
+ if(!updatedInteractionsCache.contains(interaction)) {
final ValidateInteractionCommand validateCommand = new ValidateInteractionCommand(getEditingDomain(), interaction, true);
cc.add(new ICommandProxy(validateCommand));
updatedInteractionsCache.add(interaction);
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/AbstractMessageFigure.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/AbstractMessageFigure.java
index 361da72be49..ef5c18bc1f7 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/AbstractMessageFigure.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/AbstractMessageFigure.java
@@ -23,6 +23,7 @@ import org.eclipse.swt.widgets.Display;
public abstract class AbstractMessageFigure extends UMLEdgeFigure {
protected static final Font LABEL_FONT = new Font(Display.getCurrent(), "SANS", 9, SWT.NORMAL); //$NON-NLS-1$
+
private WrappingLabel messageLabel;
@Override
@@ -66,28 +67,28 @@ public abstract class AbstractMessageFigure extends UMLEdgeFigure {
@Override
public void setLineWidth(final int w) {
super.setLineWidth(w);
- if (getSourceDecoration() instanceof Shape) {
- ((Shape) getSourceDecoration()).setLineWidth(w);
+ if(getSourceDecoration() instanceof Shape) {
+ ((Shape)getSourceDecoration()).setLineWidth(w);
}
- if (getTargetDecoration() instanceof Shape) {
- ((Shape) getTargetDecoration()).setLineWidth(w);
+ if(getTargetDecoration() instanceof Shape) {
+ ((Shape)getTargetDecoration()).setLineWidth(w);
}
}
@Override
public void setForegroundColor(final Color c) {
super.setForegroundColor(c);
- if (getSourceDecoration() instanceof Shape) {
- ((Shape) getSourceDecoration()).setForegroundColor(c);
- ((Shape) getSourceDecoration()).setBackgroundColor(c);
+ if(getSourceDecoration() instanceof Shape) {
+ ((Shape)getSourceDecoration()).setForegroundColor(c);
+ ((Shape)getSourceDecoration()).setBackgroundColor(c);
}
- if (getTargetDecoration() instanceof Shape) {
- ((Shape) getTargetDecoration()).setForegroundColor(c);
- ((Shape) getTargetDecoration()).setBackgroundColor(c);
+ if(getTargetDecoration() instanceof Shape) {
+ ((Shape)getTargetDecoration()).setForegroundColor(c);
+ ((Shape)getTargetDecoration()).setBackgroundColor(c);
}
}
protected static IMapMode getMapMode() {
return MapModeTypes.IDENTITY_MM;
}
-} \ No newline at end of file
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/CompactLifelineFigure.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/CompactLifelineFigure.java
index 05cd6777166..bf953e8ecd5 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/CompactLifelineFigure.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/CompactLifelineFigure.java
@@ -38,6 +38,7 @@ public class CompactLifelineFigure extends LifelineFigure {
@Override
protected void createContents() {
this.nameLabelContainerFigure = new InvisibleRectangleFigure() {
+
@SuppressWarnings("unused")
String DEBUG_ID = "CompactLifelineFigure_nameLabelContainerFigure"; //$NON-NLS-1$
};
@@ -48,20 +49,21 @@ public class CompactLifelineFigure extends LifelineFigure {
this.nameLabelContainerFigure.setLayoutManager(new CenterLayout());
this.lifelineDataContainerFigure = new InvisibleRectangleFigure() {
+
@SuppressWarnings("unused")
String DEBUG_ID = "CompactLifelineFigure_lifelineDataContainerFigure"; //$NON-NLS-1$
};
this.lifelineDataContainerFigure.setLayoutManager(new AbstractLayout() {
+
public void layout(final IFigure container) {
final Rectangle clientArea = container.getClientArea();
final List<?> children = container.getChildren();
- for (int i = 0; i < children.size(); i++) {
- final IFigure child = (IFigure) children.get(i);
- if (child == getTimelineContainerFigure()) {
+ for(int i = 0; i < children.size(); i++) {
+ final IFigure child = (IFigure)children.get(i);
+ if(child == getTimelineContainerFigure()) {
child.setBounds(new Rectangle(clientArea.x, clientArea.y, clientArea.width, clientArea.height - Constants.TIME_RULER_HEIGHT));
- } else if (child == getTimeRulerContainerFigure()) {
- child.setBounds(new Rectangle(clientArea.x, clientArea.y + clientArea.height - Constants.TIME_RULER_HEIGHT, clientArea.width,
- Constants.TIME_RULER_HEIGHT));
+ } else if(child == getTimeRulerContainerFigure()) {
+ child.setBounds(new Rectangle(clientArea.x, clientArea.y + clientArea.height - Constants.TIME_RULER_HEIGHT, clientArea.width, Constants.TIME_RULER_HEIGHT));
}
}
}
@@ -78,12 +80,14 @@ public class CompactLifelineFigure extends LifelineFigure {
private void createDataContainerContents() {
this.timelineContainerFigure = new InvisibleRectangleFigure() {
+
@SuppressWarnings("unused")
String DEBUG_ID = "CompactLifelineFigure_compactTimelineContainerFigure"; //$NON-NLS-1$
};
this.lifelineDataContainerFigure.add(this.timelineContainerFigure);
this.timeRulerContainerFigure = new TimeRulerFigure() {
+
@SuppressWarnings("unused")
String DEBUG_ID = "CompactLifelineFigure_timeRulerContainerFigure"; //$NON-NLS-1$
};
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/CompactStateFigure.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/CompactStateFigure.java
index 69e4a9ee317..d0e6c45e69d 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/CompactStateFigure.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/CompactStateFigure.java
@@ -27,12 +27,14 @@ import org.eclipse.swt.widgets.Display;
public class CompactStateFigure extends PapyrusNodeFigure implements IPapyrusUMLElementFigure {
public static final int PREFERRED_HEIGHT = 32;
+
private final WrappingLabel label;
+
private boolean infinite;
/**
* @param infinite
- * Whether the state has an end cap (the last state doesn't end)
+ * Whether the state has an end cap (the last state doesn't end)
*/
public void setInfinite(final boolean infinite) {
this.infinite = infinite;
@@ -67,28 +69,26 @@ public class CompactStateFigure extends PapyrusNodeFigure implements IPapyrusUML
final int cornerSize = Math.min(h / 3, w / 3);
final int[] polygon;
- if (this.infinite) {
- polygon = new int[] { x, middleY, x + cornerSize, y, x + w + 1, y, x + w + 1, y + h, x + cornerSize, y + h };
+ if(this.infinite) {
+ polygon = new int[]{ x, middleY, x + cornerSize, y, x + w + 1, y, x + w + 1, y + h, x + cornerSize, y + h };
} else {
- polygon = new int[] { x, middleY, x + cornerSize, y, x + w - cornerSize, y, x + w, middleY, x + w - cornerSize, y + h, x + cornerSize, y + h };
+ polygon = new int[]{ x, middleY, x + cornerSize, y, x + w - cornerSize, y, x + w, middleY, x + w - cornerSize, y + h, x + cornerSize, y + h };
}
g.setAntialias(SWT.ON);
- if (isUsingGradient()) {
+ if(isUsingGradient()) {
applyTransparency(g);
final Pattern pattern;
// apparently, patterns are not scaled automatically, so we need to scale the pattern so that it fits the
// current zoom level
final double scale = g.getAbsoluteScale();
- final int xScaled = (int) (this.bounds.x * scale);
- final int yScaled = (int) (this.bounds.y * scale);
- final int widthScaled = (int) (this.bounds.width * scale);
- final int heightScaled = (int) (height * scale);
- if (getGradientStyle() == GradientStyle.VERTICAL) {
- pattern = new Pattern(Display.getCurrent(), xScaled, yScaled, xScaled, yScaled + heightScaled, FigureUtilities.integerToColor(Integer
- .valueOf(getGradientColor2())), FigureUtilities.integerToColor(Integer.valueOf(getGradientColor1())));
+ final int xScaled = (int)(this.bounds.x * scale);
+ final int yScaled = (int)(this.bounds.y * scale);
+ final int widthScaled = (int)(this.bounds.width * scale);
+ final int heightScaled = (int)(height * scale);
+ if(getGradientStyle() == GradientStyle.VERTICAL) {
+ pattern = new Pattern(Display.getCurrent(), xScaled, yScaled, xScaled, yScaled + heightScaled, FigureUtilities.integerToColor(Integer.valueOf(getGradientColor2())), FigureUtilities.integerToColor(Integer.valueOf(getGradientColor1())));
} else {
- pattern = new Pattern(Display.getCurrent(), xScaled, yScaled, xScaled + widthScaled, this.bounds.y, FigureUtilities.integerToColor(Integer
- .valueOf(getGradientColor2())), FigureUtilities.integerToColor(Integer.valueOf(getGradientColor1())));
+ pattern = new Pattern(Display.getCurrent(), xScaled, yScaled, xScaled + widthScaled, this.bounds.y, FigureUtilities.integerToColor(Integer.valueOf(getGradientColor2())), FigureUtilities.integerToColor(Integer.valueOf(getGradientColor1())));
}
g.setBackgroundPattern(pattern);
g.fillPolygon(polygon);
@@ -122,13 +122,13 @@ public class CompactStateFigure extends PapyrusNodeFigure implements IPapyrusUML
* This function is useful in order to place an OccurrenceSpecification along the border of a StateInvariant.
*
* @param x
- * the x coordinate at which to compute the height
+ * the x coordinate at which to compute the height
* @param figureWidth
- * the width of the CompactStateFigure
+ * the width of the CompactStateFigure
* @param figureHeight
- * the height of the CompactStateFigure
+ * the height of the CompactStateFigure
* @param infinite
- * whether the figure ends with a cap (not infinite) or not (infinite)
+ * whether the figure ends with a cap (not infinite) or not (infinite)
* @return the half height at the given position
*/
public static int computeHalfHeightAtAbscissa(final int x, final int figureWidth, final int figureHeight, final boolean infinite) {
@@ -138,20 +138,20 @@ public class CompactStateFigure extends PapyrusNodeFigure implements IPapyrusUML
final int cornerSize = Math.min(height / 3, width / 3);
final int resultY;
- if (x < cornerSize) {
+ if(x < cornerSize) {
// on the left corner
final double slope = (height / 2.0) / cornerSize;
- resultY = (int) (x * slope);
- } else if (infinite) {
+ resultY = (int)(x * slope);
+ } else if(infinite) {
// on the straight border
resultY = halfHeight;
- } else if (x < width - cornerSize) {
+ } else if(x < width - cornerSize) {
// on the straight border
resultY = halfHeight;
} else {
// on the right corner
- final double slope = (double) halfHeight / cornerSize;
- resultY = (int) (halfHeight - ((x - width + cornerSize) * slope));
+ final double slope = (double)halfHeight / cornerSize;
+ resultY = (int)(halfHeight - ((x - width + cornerSize) * slope));
}
return resultY;
}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/CustomInteractionRectangleFigure.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/CustomInteractionRectangleFigure.java
index f0c7b2e7798..ec8e8a1d965 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/CustomInteractionRectangleFigure.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/CustomInteractionRectangleFigure.java
@@ -41,10 +41,11 @@ public class CustomInteractionRectangleFigure extends InteractionRectangleFigure
protected InteractionFigure createInteractionFigureHeader() {
this.interactionLabel = new WrappingLabel() {
+
@Override
public Dimension getPreferredSize(final int wHint, final int hHint) {
final Dimension preferredSize = super.getPreferredSize(wHint, hHint);
- if (preferredSize.width == 0) {
+ if(preferredSize.width == 0) {
return preferredSize;
}
return new Dimension(preferredSize.width + 2, preferredSize.height + 2);
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/EllipseDecoration.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/EllipseDecoration.java
index f1e865d4cab..8bd8febf7b2 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/EllipseDecoration.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/EllipseDecoration.java
@@ -42,7 +42,7 @@ public class EllipseDecoration extends Ellipse implements RotatableDecoration {
private Rectangle getOptimizedBounds() {
final float lineInset = Math.max(1.0f, getLineWidthFloat()) / 2.0f;
- final int inset = (int) Math.floor(lineInset);
+ final int inset = (int)Math.floor(lineInset);
final Rectangle r = Rectangle.SINGLETON.setBounds(getBounds());
r.x += inset;
r.y += inset;
@@ -53,4 +53,4 @@ public class EllipseDecoration extends Ellipse implements RotatableDecoration {
protected void outlineShape(final Graphics graphics) {
// no outline
}
-} \ No newline at end of file
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/FullLifelineFigure.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/FullLifelineFigure.java
index 3a13e0ecc32..cb8518510dc 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/FullLifelineFigure.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/FullLifelineFigure.java
@@ -30,6 +30,7 @@ public class FullLifelineFigure extends LifelineFigure {
@Override
protected void createContents() {
this.nameLabelContainerFigure = new InvisibleRectangleFigure() {
+
@SuppressWarnings("unused")
String DEBUG_ID = "FullLifelineFigure_nameLabelContainerFigure"; //$NON-NLS-1$
};
@@ -40,20 +41,21 @@ public class FullLifelineFigure extends LifelineFigure {
this.nameLabelContainerFigure.setLayoutManager(new CenterLayout());
this.lifelineDataContainerFigure = new InvisibleRectangleFigure() {
+
@SuppressWarnings("unused")
String DEBUG_ID = "FullLifelineFigure_lifelineDataContainerFigure"; //$NON-NLS-1$
};
this.lifelineDataContainerFigure.setLayoutManager(new AbstractLayout() {
+
public void layout(final IFigure container) {
final Rectangle clientArea = container.getClientArea();
final List<?> children = container.getChildren();
- for (int i = 0; i < children.size(); i++) {
- final IFigure child = (IFigure) children.get(i);
- if (child == getChronogramContainerFigure()) {
+ for(int i = 0; i < children.size(); i++) {
+ final IFigure child = (IFigure)children.get(i);
+ if(child == getChronogramContainerFigure()) {
child.setBounds(new Rectangle(clientArea.x, clientArea.y, clientArea.width, clientArea.height - Constants.TIME_RULER_HEIGHT));
- } else if (child == getTimeRulerContainerFigure()) {
- child.setBounds(new Rectangle(clientArea.x, clientArea.y + clientArea.height - Constants.TIME_RULER_HEIGHT, clientArea.width,
- Constants.TIME_RULER_HEIGHT));
+ } else if(child == getTimeRulerContainerFigure()) {
+ child.setBounds(new Rectangle(clientArea.x, clientArea.y + clientArea.height - Constants.TIME_RULER_HEIGHT, clientArea.width, Constants.TIME_RULER_HEIGHT));
}
}
}
@@ -71,21 +73,22 @@ public class FullLifelineFigure extends LifelineFigure {
private void createDataContainerContents() {
this.chronogramContainerFigure = new InvisibleRectangleFigure() {
+
@SuppressWarnings("unused")
String DEBUG_ID = "FullLifelineFigure_chronogramContainerFigure"; //$NON-NLS-1$
};
this.lifelineDataContainerFigure.add(this.chronogramContainerFigure);
this.chronogramContainerFigure.setLayoutManager(new AbstractLayout() {
+
public void layout(final IFigure container) {
final Rectangle clientArea = container.getClientArea();
final List<?> children = container.getChildren();
- for (int i = 0; i < children.size(); i++) {
- final IFigure child = (IFigure) children.get(i);
- if (child == getStateDefinitionContainerFigure()) {
+ for(int i = 0; i < children.size(); i++) {
+ final IFigure child = (IFigure)children.get(i);
+ if(child == getStateDefinitionContainerFigure()) {
child.setBounds(new Rectangle(clientArea.x, clientArea.y, Constants.STATE_DEFINITIONS_WIDTH, clientArea.height));
- } else if (child == getTimelineContainerFigure()) {
- child.setBounds(new Rectangle(clientArea.x + Constants.STATE_DEFINITIONS_WIDTH, clientArea.y, clientArea.width
- - Constants.STATE_DEFINITIONS_WIDTH, clientArea.height));
+ } else if(child == getTimelineContainerFigure()) {
+ child.setBounds(new Rectangle(clientArea.x + Constants.STATE_DEFINITIONS_WIDTH, clientArea.y, clientArea.width - Constants.STATE_DEFINITIONS_WIDTH, clientArea.height));
}
}
}
@@ -98,6 +101,7 @@ public class FullLifelineFigure extends LifelineFigure {
createChronogramContainerContents();
this.timeRulerContainerFigure = new TimeRulerFigure() {
+
@SuppressWarnings("unused")
String DEBUG_ID = "FullLifelineFigure_timeRulerContainerFigure"; //$NON-NLS-1$
};
@@ -107,12 +111,14 @@ public class FullLifelineFigure extends LifelineFigure {
private void createChronogramContainerContents() {
this.stateDefinitionContainerFigure = new InvisibleRectangleFigure() {
+
@SuppressWarnings("unused")
String DEBUG_ID = "FullLifelineFigure_stateDefinitionContainerFigure"; //$NON-NLS-1$
};
this.chronogramContainerFigure.add(this.stateDefinitionContainerFigure);
this.timelineContainerFigure = new InvisibleRectangleFigure() {
+
@SuppressWarnings("unused")
String DEBUG_ID = "FullLifelineFigure_timelineContainerFigure"; //$NON-NLS-1$
};
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/GeneralOrderingHorizontalFigure.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/GeneralOrderingHorizontalFigure.java
index 7434b54a42f..1e2ba26aecc 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/GeneralOrderingHorizontalFigure.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/GeneralOrderingHorizontalFigure.java
@@ -39,14 +39,14 @@ public class GeneralOrderingHorizontalFigure extends PapyrusNodeFigure {
g.setLineWidth(1);
// horizontal line
- g.setLineDash(new int[] { 4, 4 });
+ g.setLineDash(new int[]{ 4, 4 });
g.drawLine(x, middleY, x + w, middleY);
- g.setLineDash(new int[] {});
+ g.setLineDash(new int[]{});
// arrow
g.setAntialias(SWT.ON);
g.setBackgroundColor(getForegroundColor());
- g.fillPolygon(new int[] { middleX - a, this.bounds.y, middleX + a, middleY, middleX - a, this.bounds.y + this.bounds.height });
+ g.fillPolygon(new int[]{ middleX - a, this.bounds.y, middleX + a, middleY, middleX - a, this.bounds.y + this.bounds.height });
g.popState();
}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/InvisibleRectangleFigure.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/InvisibleRectangleFigure.java
index 4948f1c2e26..4ee68b24b97 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/InvisibleRectangleFigure.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/InvisibleRectangleFigure.java
@@ -12,10 +12,10 @@ package org.eclipse.papyrus.uml.diagram.timing.custom.figures;
import org.eclipse.draw2d.Graphics;
import org.eclipse.draw2d.RectangleFigure;
-import org.eclipse.draw2d.Shape;
/** A rectangle that is not painted: useful for simplifying layouts */
public class InvisibleRectangleFigure extends RectangleFigure {
+
/**
* Creates a RectangleFigure.
*/
@@ -37,4 +37,4 @@ public class InvisibleRectangleFigure extends RectangleFigure {
protected void outlineShape(final Graphics graphics) {
// don't draw an outline
}
-} \ No newline at end of file
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/LifelineFigure.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/LifelineFigure.java
index 458ae8c0207..e979c65d193 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/LifelineFigure.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/LifelineFigure.java
@@ -25,29 +25,35 @@ import org.eclipse.swt.graphics.Image;
public class LifelineFigure extends PapyrusNodeFigure implements IPapyrusNodeUMLElementFigure {
protected final int LABEL_WIDTH = 30;
+
protected RectangleFigure nameLabelContainerFigure;
+
protected LifelineVerticalLabel nameLabel;
+
protected RectangleFigure timeRulerContainerFigure;
+
protected RectangleFigure lifelineDataContainerFigure;
+
protected RectangleFigure timelineContainerFigure;
private boolean selected;
+
private boolean displayTimeRuler;
public LifelineFigure() {
setShadow(false);
createContents();
setLayoutManager(new AbstractLayout() {
+
public void layout(final IFigure container) {
final Rectangle clientArea = container.getClientArea();
final List<?> children = container.getChildren();
- for (int i = 0; i < children.size(); i++) {
- final IFigure child = (IFigure) children.get(i);
- if (child == getNameLabelContainerFigure()) {
+ for(int i = 0; i < children.size(); i++) {
+ final IFigure child = (IFigure)children.get(i);
+ if(child == getNameLabelContainerFigure()) {
child.setBounds(new Rectangle(clientArea.x, clientArea.y, LifelineFigure.this.LABEL_WIDTH, clientArea.height));
- } else if (child == getLifelineDataContainerFigure()) {
- child.setBounds(new Rectangle(clientArea.x + LifelineFigure.this.LABEL_WIDTH, clientArea.y, clientArea.width
- - LifelineFigure.this.LABEL_WIDTH, clientArea.height));
+ } else if(child == getLifelineDataContainerFigure()) {
+ child.setBounds(new Rectangle(clientArea.x + LifelineFigure.this.LABEL_WIDTH, clientArea.y, clientArea.width - LifelineFigure.this.LABEL_WIDTH, clientArea.height));
}
}
}
@@ -84,7 +90,7 @@ public class LifelineFigure extends PapyrusNodeFigure implements IPapyrusNodeUML
@Override
public void paintFigure(final Graphics graphics) {
super.paintFigure(graphics);
- if (this.selected) {
+ if(this.selected) {
graphics.pushState();
graphics.setForegroundColor(ColorConstants.black);
graphics.setLineWidth(1);
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/LifelineVerticalLabel.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/LifelineVerticalLabel.java
index 521a82c6a2b..9db8f3be301 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/LifelineVerticalLabel.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/LifelineVerticalLabel.java
@@ -21,11 +21,12 @@ import org.eclipse.swt.widgets.Display;
public class LifelineVerticalLabel extends VerticalLabel implements ILabelFigure {
private boolean selected;
+
private boolean focus;
@Override
public Color getBackgroundColor() {
- if (this.selected) {
+ if(this.selected) {
return Display.getDefault().getSystemColor(SWT.COLOR_LIST_SELECTION);
}
// the transparency color for the label
@@ -34,7 +35,7 @@ public class LifelineVerticalLabel extends VerticalLabel implements ILabelFigure
@Override
public Color getForegroundColor() {
- if (this.selected) {
+ if(this.selected) {
return Display.getDefault().getSystemColor(SWT.COLOR_LIST_SELECTION_TEXT);
}
return super.getForegroundColor();
@@ -70,7 +71,7 @@ public class LifelineVerticalLabel extends VerticalLabel implements ILabelFigure
@Override
protected void paintFigure(final Graphics graphics) {
super.paintFigure(graphics);
- if (this.focus) {
+ if(this.focus) {
graphics.drawFocus(getBounds().getResized(-1, -1));
}
}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/MessageDeleteFigure.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/MessageDeleteFigure.java
index dc41e0ad889..10499a9fd3e 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/MessageDeleteFigure.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/MessageDeleteFigure.java
@@ -19,6 +19,7 @@ public class MessageDeleteFigure extends AbstractMessageFigure {
@Override
protected RotatableDecoration createTargetDecoration() {
final PolygonDecoration df = new PolygonDecoration() {
+
@Override
protected void outlineShape(final Graphics g) {
// no outline: this is a filled arrow
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/MessageSyncFigure.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/MessageSyncFigure.java
index e679ea85951..7e50f113df1 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/MessageSyncFigure.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/MessageSyncFigure.java
@@ -19,6 +19,7 @@ public class MessageSyncFigure extends AbstractMessageFigure {
@Override
protected RotatableDecoration createTargetDecoration() {
final PolygonDecoration df = new PolygonDecoration() {
+
@Override
protected void outlineShape(final Graphics g) {
// no outline: this is a filled arrow
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/SmallSquareFigure.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/SmallSquareFigure.java
index ed8feee47a5..b837dd49b4e 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/SmallSquareFigure.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/SmallSquareFigure.java
@@ -19,6 +19,7 @@ import org.eclipse.swt.graphics.Image;
public class SmallSquareFigure extends PapyrusNodeFigure implements IPapyrusUMLElementFigure {
public static final int SQUARE_SIZE = 5;
+
/** How many pixels the Figure must be moved upwards and leftwards in order to center it */
public static final int RADIUS = SQUARE_SIZE / 2;
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/StateDefinitionFigure.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/StateDefinitionFigure.java
index 43deec99903..502914419b3 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/StateDefinitionFigure.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/StateDefinitionFigure.java
@@ -45,7 +45,7 @@ public class StateDefinitionFigure extends NodeNamedElementFigure {
}
private void paintFocusRectangle(final Graphics g) {
- if (isSelected()) {
+ if(isSelected()) {
g.pushState();
g.setXORMode(true);
g.setForegroundColor(ColorConstants.menuBackgroundSelected);
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/TimeRulerFigure.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/TimeRulerFigure.java
index f41e5684b87..9bd2d289b2d 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/TimeRulerFigure.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/TimeRulerFigure.java
@@ -13,6 +13,7 @@ import org.eclipse.draw2d.Graphics;
import org.eclipse.draw2d.geometry.Rectangle;
public class TimeRulerFigure extends InvisibleRectangleFigure {
+
@Override
protected void outlineShape(final Graphics graphics) {
final Rectangle bounds = getBounds();
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/VerticalLabel.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/VerticalLabel.java
index 49ed0dfc66c..53d5565cd91 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/VerticalLabel.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/VerticalLabel.java
@@ -26,15 +26,19 @@ import org.eclipse.swt.widgets.Display;
public class VerticalLabel extends AbstractImageFigure {
private Image img;
+
private String myText;
+
private Font myImageFont;
+
private Color myForegroundColor;
+
private Color myBackgroundColor;
@Override
protected void paintFigure(final Graphics g) {
final Image image = getImage();
- if (image != null) {
+ if(image != null) {
g.drawImage(image, this.bounds.x, this.bounds.y);
}
}
@@ -49,7 +53,7 @@ public class VerticalLabel extends AbstractImageFigure {
/** {@inheritDoc} */
@Override
public void removeNotify() {
- if (this.img != null) {
+ if(this.img != null) {
this.img.dispose();
this.img = null;
}
@@ -59,20 +63,20 @@ public class VerticalLabel extends AbstractImageFigure {
/** {@inheritDoc} */
public Image getImage() {
boolean update = false;
- if (this.myImageFont != getFont()) {
+ if(this.myImageFont != getFont()) {
this.myImageFont = getFont();
update = true;
}
- if (needsUpdate(this.myForegroundColor, getForegroundColor())) {
+ if(needsUpdate(this.myForegroundColor, getForegroundColor())) {
this.myForegroundColor = getForegroundColor();
update = true;
}
- if (needsUpdate(this.myBackgroundColor, getBackgroundColor())) {
+ if(needsUpdate(this.myBackgroundColor, getBackgroundColor())) {
this.myBackgroundColor = getBackgroundColor();
update = true;
}
- if (update) {
+ if(update) {
updateImage();
}
return this.img;
@@ -82,7 +86,7 @@ public class VerticalLabel extends AbstractImageFigure {
* Updates the image with the string provided.
*
* @param text
- * to display
+ * to display
*/
public void setText(final String text) {
this.myText = text;
@@ -99,18 +103,18 @@ public class VerticalLabel extends AbstractImageFigure {
* @return image created
*/
public void updateImage() {
- if (this.img != null) {
+ if(this.img != null) {
this.img.dispose();
this.img = null;
}
- if (getText() == null || getFont() == null) {
+ if(getText() == null || getFont() == null) {
return;
}
setImage(createRotatedImageOfString(getText(), getFont(), getForegroundColor(), getBackgroundColor(), isOpaque()));
}
private void setImage(final Image image) {
- if (this.img == image) {
+ if(this.img == image) {
return;
}
this.img = image;
@@ -129,7 +133,7 @@ public class VerticalLabel extends AbstractImageFigure {
final int width = metrics.getAscent() + metrics.getDescent() + metrics.getLeading();
final ImageData data = new ImageData(width, height, 32, new PaletteData(0x0000ff00, 0x00ff0000, 0xff000000));
- if (!opaque) {
+ if(!opaque) {
data.transparentPixel = data.palette.getPixel(background.getRGB());
}
@@ -149,7 +153,7 @@ public class VerticalLabel extends AbstractImageFigure {
}
private static final boolean needsUpdate(final Color cachedColor, final Color actualColor) {
- if (cachedColor == null && actualColor == null) {
+ if(cachedColor == null && actualColor == null) {
return false;
}
return cachedColor == null || !cachedColor.equals(actualColor);
@@ -157,7 +161,7 @@ public class VerticalLabel extends AbstractImageFigure {
@Override
public Dimension getPreferredSize(final int wHint, final int hHint) {
- if (this.img != null) {
+ if(this.img != null) {
return new Rectangle(this.img.getBounds()).getSize();
}
return super.getPreferredSize(wHint, hHint);
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/VerticalMarkFigure.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/VerticalMarkFigure.java
index e653cd353e9..29859a226a6 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/VerticalMarkFigure.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/VerticalMarkFigure.java
@@ -18,6 +18,7 @@ import org.eclipse.swt.graphics.Image;
public class VerticalMarkFigure extends org.eclipse.draw2d.Figure implements IPapyrusUMLElementFigure {
public static final int PREFERRED_WIDTH = 5;
+
public static final int PREFERRED_HEIGHT = 12;
public VerticalMarkFigure() {
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/helper/TimingDiagramLinkMappingHelper.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/helper/TimingDiagramLinkMappingHelper.java
index f2a4e1ff641..4046168e1d9 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/helper/TimingDiagramLinkMappingHelper.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/helper/TimingDiagramLinkMappingHelper.java
@@ -29,7 +29,7 @@ public class TimingDiagramLinkMappingHelper implements ILinkMappingHelper {
* @return single instance of {@link TimingDiagramLinkMappingHelper}
*/
public static TimingDiagramLinkMappingHelper getInstance() {
- if (INSTANCE == null) {
+ if(INSTANCE == null) {
INSTANCE = new TimingDiagramLinkMappingHelper();
}
return INSTANCE;
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/helper/advice/DefaultTypeHelperAdvice.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/helper/advice/DefaultTypeHelperAdvice.java
index 6aeb6b7ca14..4e44ce591ad 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/helper/advice/DefaultTypeHelperAdvice.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/helper/advice/DefaultTypeHelperAdvice.java
@@ -24,12 +24,12 @@ public class DefaultTypeHelperAdvice extends AbstractEditHelperAdvice {
@Override
public boolean approveRequest(final IEditCommandRequest request) {
- if (request instanceof DestroyElementRequest) {
- final DestroyElementRequest destroyElementRequest = (DestroyElementRequest) request;
+ if(request instanceof DestroyElementRequest) {
+ final DestroyElementRequest destroyElementRequest = (DestroyElementRequest)request;
final EObject elementToDestroy = destroyElementRequest.getElementToDestroy();
- if (elementToDestroy instanceof View) {
- final View view = (View) elementToDestroy;
- if (VERTICAL_LINE_ID.equals(view.getType()) && TimingDiagramEditPart.MODEL_ID == ViewUtils.getContainingDiagramType(view)) {
+ if(elementToDestroy instanceof View) {
+ final View view = (View)elementToDestroy;
+ if(VERTICAL_LINE_ID.equals(view.getType()) && TimingDiagramEditPart.MODEL_ID == ViewUtils.getContainingDiagramType(view)) {
return false;
}
}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/helper/advice/GateHelperAdvice.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/helper/advice/GateHelperAdvice.java
index 35064e4851a..7357fccc600 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/helper/advice/GateHelperAdvice.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/helper/advice/GateHelperAdvice.java
@@ -30,16 +30,16 @@ public class GateHelperAdvice extends AbstractEditHelperAdvice {
@Override
protected ICommand getAfterDestroyDependentsCommand(final DestroyDependentsRequest request) {
final EObject destructee = request.getElementToDestroy();
- if (destructee instanceof Gate) {
- final Gate gate = (Gate) destructee;
+ if(destructee instanceof Gate) {
+ final Gate gate = (Gate)destructee;
final Collection<EObject> elementsToDestroy = GateUtils.getElementsToDelete(gate);
- if (!elementsToDestroy.isEmpty()) {
+ if(!elementsToDestroy.isEmpty()) {
final CompositeCommand compositeCommand = new CompositeCommand(Messages.GateHelperAdvice_DestroyGate);
// destroy related elements
- for (final EObject eObject : elementsToDestroy) {
+ for(final EObject eObject : elementsToDestroy) {
final DestroyElementRequest destroyElementRequest = new DestroyElementRequest(eObject, false);
final DestroyElementCommand destroyElementCommand = new DestroyElementCommand(destroyElementRequest);
- if (destroyElementCommand.canExecute()) {
+ if(destroyElementCommand.canExecute()) {
compositeCommand.add(destroyElementCommand);
}
}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/helper/advice/OccurrenceSpecificationHelperAdvice.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/helper/advice/OccurrenceSpecificationHelperAdvice.java
index 7c4ba3281b6..2ffc4272555 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/helper/advice/OccurrenceSpecificationHelperAdvice.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/helper/advice/OccurrenceSpecificationHelperAdvice.java
@@ -32,21 +32,21 @@ public class OccurrenceSpecificationHelperAdvice extends AbstractEditHelperAdvic
@Override
protected ICommand getAfterDestroyDependentsCommand(final DestroyDependentsRequest request) {
final EObject destructee = request.getElementToDestroy();
- if (destructee instanceof OccurrenceSpecification) {
- final OccurrenceSpecification occurrenceSpecification = (OccurrenceSpecification) destructee;
+ if(destructee instanceof OccurrenceSpecification) {
+ final OccurrenceSpecification occurrenceSpecification = (OccurrenceSpecification)destructee;
final Collection<EObject> elementsToDestroy = OccurrenceSpecificationUtils.getElementsToDelete(occurrenceSpecification);
- if (!elementsToDestroy.isEmpty()) {
+ if(!elementsToDestroy.isEmpty()) {
final CompositeCommand compositeCommand = new CompositeCommand(Messages.OccurrenceSpecificationHelperAdvice_DestroyOccurrenceSpecification);
// destroy related elements
- for (final EObject eObject : elementsToDestroy) {
+ for(final EObject eObject : elementsToDestroy) {
final DestroyElementRequest destroyElementRequest = new DestroyElementRequest(eObject, false);
final DestroyElementCommand destroyElementCommand = new DestroyElementCommand(destroyElementRequest);
- if (destroyElementCommand.canExecute()) {
+ if(destroyElementCommand.canExecute()) {
compositeCommand.add(destroyElementCommand);
}
}
final IUndoableOperation updateFragmentNamesCommand = LifelineUtils.getUpdateFragmentNamesCommand(occurrenceSpecification);
- if (updateFragmentNamesCommand != null) {
+ if(updateFragmentNamesCommand != null) {
compositeCommand.add(updateFragmentNamesCommand);
}
return compositeCommand;
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/helper/advice/StateInvariantHelperAdvice.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/helper/advice/StateInvariantHelperAdvice.java
index 62bf11b0b54..8e3ddff7506 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/helper/advice/StateInvariantHelperAdvice.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/helper/advice/StateInvariantHelperAdvice.java
@@ -34,19 +34,19 @@ public class StateInvariantHelperAdvice extends AbstractEditHelperAdvice {
@Override
protected ICommand getAfterDestroyDependentsCommand(final DestroyDependentsRequest request) {
final EObject destructee = request.getElementToDestroy();
- if (destructee instanceof StateInvariant) {
+ if(destructee instanceof StateInvariant) {
try {
- final StateInvariant stateInvariant = (StateInvariant) destructee;
+ final StateInvariant stateInvariant = (StateInvariant)destructee;
final Collection<EObject> elementsToDestroy = StateInvariantUtils.getElementsToDelete(stateInvariant);
- if (!elementsToDestroy.isEmpty()) {
+ if(!elementsToDestroy.isEmpty()) {
final CompositeCommand compositeCommand = new CompositeCommand(Messages.StateInvariantHelperAdvice_DestroyStateInvariant);
- for (final EObject eObject : elementsToDestroy) {
+ for(final EObject eObject : elementsToDestroy) {
final DestroyElementRequest destroyElementRequest = new DestroyElementRequest(eObject, false);
compositeCommand.add(new DestroyElementCommand(destroyElementRequest));
}
final IUndoableOperation updateFragmentNamesCommand = LifelineUtils.getUpdateFragmentNamesCommand(stateInvariant);
- if (updateFragmentNamesCommand != null) {
+ if(updateFragmentNamesCommand != null) {
compositeCommand.add(updateFragmentNamesCommand);
}
return compositeCommand;
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/layouts/FillLayout.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/layouts/FillLayout.java
index 3ba7e926a21..1d365eb2a64 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/layouts/FillLayout.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/layouts/FillLayout.java
@@ -19,14 +19,15 @@ import org.eclipse.draw2d.geometry.Dimension;
import org.eclipse.draw2d.geometry.Rectangle;
public class FillLayout extends AbstractLayout {
+
public void layout(final IFigure container) {
final Rectangle clientArea = container.getClientArea();
final List<?> children = container.getChildren();
- for (int i = 0; i < children.size(); i++) {
- final IFigure child = (IFigure) children.get(i);
+ for(int i = 0; i < children.size(); i++) {
+ final IFigure child = (IFigure)children.get(i);
child.setBounds(clientArea);
- if (child instanceof FreeformLayer) {
- final FreeformLayer freeformLayer = (FreeformLayer) child;
+ if(child instanceof FreeformLayer) {
+ final FreeformLayer freeformLayer = (FreeformLayer)child;
freeformLayer.setFreeformBounds(clientArea);
}
}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/layouts/TimeRulerLayout.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/layouts/TimeRulerLayout.java
index 788ddab1b29..ef14640691a 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/layouts/TimeRulerLayout.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/layouts/TimeRulerLayout.java
@@ -29,7 +29,7 @@ public class TimeRulerLayout extends AbstractLayout {
final Rectangle clientArea = container.getParent().getClientArea();
@SuppressWarnings("unchecked")
final List<IFigure> children = container.getChildren();
- for (int i = 0; i < children.size(); i++) {
+ for(int i = 0; i < children.size(); i++) {
final IFigure child = children.get(i);
child.setBounds(clientArea);
}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parsers/CompactStateInvariantNameParser.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parsers/CompactStateInvariantNameParser.java
index 995ad070342..8639de0bc92 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parsers/CompactStateInvariantNameParser.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parsers/CompactStateInvariantNameParser.java
@@ -48,7 +48,7 @@ public class CompactStateInvariantNameParser implements ISemanticParser {
public String getEditString(final IAdaptable adaptable, final int flags) {
final StateInvariant stateInvariant = getStateInvariant(adaptable);
final String name = StateInvariantUtils.getInnerStateInvariantName(stateInvariant);
- if (name == null) {
+ if(name == null) {
return ""; //$NON-NLS-1$
}
return name;
@@ -61,17 +61,18 @@ public class CompactStateInvariantNameParser implements ISemanticParser {
public ICommand getParseCommand(final IAdaptable adaptable, final String newString, final int flags) {
final StateInvariant stateInvariant = getStateInvariant(adaptable);
final TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(stateInvariant);
- if (editingDomain == null) {
+ if(editingDomain == null) {
return UnexecutableCommand.INSTANCE;
}
return new AbstractTransactionalCommand(editingDomain, Messages.CompactStateInvariantNameParser_SetStateInvariantName, null) {
+
@Override
protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
// set the name on the Constraint and OpaqueExpression
StateInvariantUtils.setInnerStateInvariantName(stateInvariant, newString);
// set the name directly on the StateInvariant (note that this triggers a refresh of the label)
stateInvariant.setName(newString);
- for (final Lifeline coveredLifeline : stateInvariant.getCovereds()) {
+ for(final Lifeline coveredLifeline : stateInvariant.getCovereds()) {
LifelineUtils.updateFragmentNames(coveredLifeline, null);
// XXX what if the StateInvariant appears both on a compact and on a full lifeline?
StateDefinitionUtils.updateStateDefinitionNamesForCompactLifeline(coveredLifeline);
@@ -82,13 +83,13 @@ public class CompactStateInvariantNameParser implements ISemanticParser {
}
private static StateInvariant getStateInvariant(final IAdaptable adaptable) {
- return (StateInvariant) adaptable.getAdapter(EObject.class);
+ return (StateInvariant)adaptable.getAdapter(EObject.class);
}
public String getPrintString(final IAdaptable adaptable, final int flags) {
final StateInvariant stateInvariant = getStateInvariant(adaptable);
final String name = StateInvariantUtils.getInnerStateInvariantName(stateInvariant);
- if (name == null || name.length() == 0) {
+ if(name == null || name.length() == 0) {
return Messages.CompactStateInvariantNameParser_Unnamed;
}
return name;
@@ -104,12 +105,12 @@ public class CompactStateInvariantNameParser implements ISemanticParser {
public List<?> getSemanticElementsBeingParsed(final EObject element) {
final List<EObject> list = new ArrayList<EObject>();
- if (element instanceof StateInvariant) {
- final StateInvariant stateInvariant = (StateInvariant) element;
+ if(element instanceof StateInvariant) {
+ final StateInvariant stateInvariant = (StateInvariant)element;
final Constraint invariant = stateInvariant.getInvariant();
- if (invariant != null) {
+ if(invariant != null) {
final ValueSpecification specification = invariant.getSpecification();
- if (specification != null) {
+ if(specification != null) {
list.add(specification);
}
}
@@ -119,7 +120,6 @@ public class CompactStateInvariantNameParser implements ISemanticParser {
public boolean areSemanticElementsAffected(final EObject listener, final Object notification) {
final EStructuralFeature feature = EcoreUtils.getEStructuralFeature(notification);
- return UMLPackage.eINSTANCE.getStateInvariant_Invariant().equals(feature) || UMLPackage.eINSTANCE.getConstraint_Specification().equals(feature)
- || UMLPackage.eINSTANCE.getOpaqueExpression_Body().equals(feature);
+ return UMLPackage.eINSTANCE.getStateInvariant_Invariant().equals(feature) || UMLPackage.eINSTANCE.getConstraint_Specification().equals(feature) || UMLPackage.eINSTANCE.getOpaqueExpression_Body().equals(feature);
}
}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parsers/ConstraintParser.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parsers/ConstraintParser.java
index 8a84c116423..aef1e6718a5 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parsers/ConstraintParser.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parsers/ConstraintParser.java
@@ -32,10 +32,8 @@ import org.eclipse.papyrus.uml.diagram.timing.custom.Messages;
import org.eclipse.papyrus.uml.diagram.timing.custom.utils.EcoreUtils;
import org.eclipse.uml2.uml.Constraint;
import org.eclipse.uml2.uml.Duration;
-import org.eclipse.uml2.uml.DurationConstraint;
import org.eclipse.uml2.uml.DurationInterval;
import org.eclipse.uml2.uml.LiteralString;
-import org.eclipse.uml2.uml.TimeConstraint;
import org.eclipse.uml2.uml.TimeExpression;
import org.eclipse.uml2.uml.TimeInterval;
import org.eclipse.uml2.uml.UMLPackage;
@@ -45,10 +43,13 @@ import org.eclipse.uml2.uml.ValueSpecification;
public class ConstraintParser implements ISemanticParser {
private static final String ERROR = "<error>"; //$NON-NLS-1$
+
private static final Pattern pattern = Pattern.compile("\\{(.*?)\\.\\.(.*?)\\}"); //$NON-NLS-1$
private class MinMax {
+
LiteralString min;
+
LiteralString max;
public MinMax(final LiteralString min, final LiteralString max) {
@@ -72,7 +73,7 @@ public class ConstraintParser implements ISemanticParser {
public String getEditString(final IAdaptable element, final int flags) {
final Constraint constraint = doAdapt(element);
final MinMax minMax = getMinMax(constraint);
- if (minMax == null) {
+ if(minMax == null) {
return ERROR;
}
return getMinMaxLabel(minMax);
@@ -85,11 +86,11 @@ public class ConstraintParser implements ISemanticParser {
public ICommand getParseCommand(final IAdaptable element, final String newString, final int flags) {
final Constraint constraint = doAdapt(element);
final MinMax minMax = getMinMax(constraint);
- if (minMax == null) {
+ if(minMax == null) {
return UnexecutableCommand.INSTANCE;
}
final Matcher matcher = ConstraintParser.pattern.matcher(newString);
- if (matcher.matches()) {
+ if(matcher.matches()) {
final String min = matcher.group(1);
final String max = matcher.group(2);
final TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(constraint);
@@ -99,14 +100,14 @@ public class ConstraintParser implements ISemanticParser {
}
private MinMax getMinMax(final Constraint constraint) {
- if (constraint == null) {
+ if(constraint == null) {
return null;
}
final ValueSpecification specification = constraint.getSpecification();
- if (specification instanceof TimeInterval) {
- return getTimeIntervalMinMax((TimeInterval) specification);
- } else if (specification instanceof DurationInterval) {
- return getDurationIntervalMinMax((DurationInterval) specification);
+ if(specification instanceof TimeInterval) {
+ return getTimeIntervalMinMax((TimeInterval)specification);
+ } else if(specification instanceof DurationInterval) {
+ return getDurationIntervalMinMax((DurationInterval)specification);
}
return null;
@@ -116,21 +117,21 @@ public class ConstraintParser implements ISemanticParser {
final ValueSpecification min = timeInterval.getMin();
final ValueSpecification max = timeInterval.getMax();
- if (!(min instanceof TimeExpression) || !(max instanceof TimeExpression)) {
+ if(!(min instanceof TimeExpression) || !(max instanceof TimeExpression)) {
return null;
}
- final TimeExpression minTime = (TimeExpression) min;
- final TimeExpression maxTime = (TimeExpression) max;
+ final TimeExpression minTime = (TimeExpression)min;
+ final TimeExpression maxTime = (TimeExpression)max;
final ValueSpecification minValue = minTime.getExpr();
final ValueSpecification maxValue = maxTime.getExpr();
- if (!(minValue instanceof LiteralString) || !(maxValue instanceof LiteralString)) {
+ if(!(minValue instanceof LiteralString) || !(maxValue instanceof LiteralString)) {
return null;
}
- final LiteralString minStr = (LiteralString) minValue;
- final LiteralString maxStr = (LiteralString) maxValue;
+ final LiteralString minStr = (LiteralString)minValue;
+ final LiteralString maxStr = (LiteralString)maxValue;
return new MinMax(minStr, maxStr);
}
@@ -139,21 +140,21 @@ public class ConstraintParser implements ISemanticParser {
final ValueSpecification min = durationInterval.getMin();
final ValueSpecification max = durationInterval.getMax();
- if (!(min instanceof Duration) || !(max instanceof Duration)) {
+ if(!(min instanceof Duration) || !(max instanceof Duration)) {
return null;
}
- final Duration minDuration = (Duration) min;
- final Duration maxDuration = (Duration) max;
+ final Duration minDuration = (Duration)min;
+ final Duration maxDuration = (Duration)max;
final ValueSpecification minValue = minDuration.getExpr();
final ValueSpecification maxValue = maxDuration.getExpr();
- if (!(minValue instanceof LiteralString) || !(maxValue instanceof LiteralString)) {
+ if(!(minValue instanceof LiteralString) || !(maxValue instanceof LiteralString)) {
return null;
}
- final LiteralString minStr = (LiteralString) minValue;
- final LiteralString maxStr = (LiteralString) maxValue;
+ final LiteralString minStr = (LiteralString)minValue;
+ final LiteralString maxStr = (LiteralString)maxValue;
return new MinMax(minStr, maxStr);
}
@@ -162,12 +163,12 @@ public class ConstraintParser implements ISemanticParser {
return ParserEditStatus.EDITABLE_STATUS;
}
- private static ICommand createSetMinMaxCommand(final Constraint constraint, final MinMax minMax, final String min, final String max,
- final TransactionalEditingDomain editingDomain) {
- if (editingDomain == null) {
+ private static ICommand createSetMinMaxCommand(final Constraint constraint, final MinMax minMax, final String min, final String max, final TransactionalEditingDomain editingDomain) {
+ if(editingDomain == null) {
return UnexecutableCommand.INSTANCE;
}
return new AbstractTransactionalCommand(editingDomain, Messages.ConstraintParser_SetConstraint, null) {
+
@Override
protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
minMax.getMin().setValue(min);
@@ -184,13 +185,13 @@ public class ConstraintParser implements ISemanticParser {
* Obtain the constraint element from the adaptable.
*
* @param element
- * the given IAdaptable
+ * the given IAdaptable
* @return the constraint or null if it can't be found.
*/
protected static Constraint doAdapt(final IAdaptable element) {
final Object obj = element.getAdapter(EObject.class);
- if (obj instanceof Constraint) {
- return (Constraint) obj;
+ if(obj instanceof Constraint) {
+ return (Constraint)obj;
}
return null;
}
@@ -205,10 +206,10 @@ public class ConstraintParser implements ISemanticParser {
public List<?> getSemanticElementsBeingParsed(final EObject element) {
final List<EObject> list = new ArrayList<EObject>();
- if (element instanceof Constraint) {
- final Constraint constraint = (Constraint) element;
+ if(element instanceof Constraint) {
+ final Constraint constraint = (Constraint)element;
final MinMax minMax = getMinMax(constraint);
- if (minMax != null) {
+ if(minMax != null) {
list.add(minMax.getMin());
list.add(minMax.getMax());
}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parsers/OccurrenceSpecificationNameParser.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parsers/OccurrenceSpecificationNameParser.java
index b791193fd39..2c775757a05 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parsers/OccurrenceSpecificationNameParser.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parsers/OccurrenceSpecificationNameParser.java
@@ -37,7 +37,7 @@ public class OccurrenceSpecificationNameParser implements IParser {
public String getEditString(final IAdaptable adaptable, final int flags) {
final OccurrenceSpecification occurrenceSpecification = getOccurrenceSpecification(adaptable);
- if (occurrenceSpecification == null) {
+ if(occurrenceSpecification == null) {
return ""; //$NON-NLS-1$
}
return nonNullString(occurrenceSpecification.getName());
@@ -49,14 +49,15 @@ public class OccurrenceSpecificationNameParser implements IParser {
public ICommand getParseCommand(final IAdaptable adaptable, final String newString, final int flags) {
final OccurrenceSpecification occurrenceSpecification = getOccurrenceSpecification(adaptable);
- if (occurrenceSpecification == null) {
+ if(occurrenceSpecification == null) {
return UnexecutableCommand.INSTANCE;
}
final TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(occurrenceSpecification);
- if (editingDomain == null) {
+ if(editingDomain == null) {
return UnexecutableCommand.INSTANCE;
}
return new AbstractTransactionalCommand(editingDomain, Messages.OccurrenceSpecificationNameParser_SetOccurrenceSpecificationName, null) {
+
@Override
protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
occurrenceSpecification.setName(newString);
@@ -68,7 +69,7 @@ public class OccurrenceSpecificationNameParser implements IParser {
public String getPrintString(final IAdaptable adaptable, final int flags) {
final OccurrenceSpecification occurrenceSpecification = getOccurrenceSpecification(adaptable);
- if (occurrenceSpecification == null || OccurrenceSpecificationUtils.isAutogeneratedName(occurrenceSpecification)) {
+ if(occurrenceSpecification == null || OccurrenceSpecificationUtils.isAutogeneratedName(occurrenceSpecification)) {
// don't display the auto-generated name (pollutes the view without any benefit)
return ""; //$NON-NLS-1$
}
@@ -85,14 +86,14 @@ public class OccurrenceSpecificationNameParser implements IParser {
private static OccurrenceSpecification getOccurrenceSpecification(final IAdaptable adaptable) {
final Object adapter = adaptable.getAdapter(EObject.class);
- if (adapter instanceof OccurrenceSpecification) {
- return (OccurrenceSpecification) adapter;
+ if(adapter instanceof OccurrenceSpecification) {
+ return (OccurrenceSpecification)adapter;
}
return null;
}
private static String nonNullString(final String string) {
- if (string == null) {
+ if(string == null) {
return ""; //$NON-NLS-1$
}
return string;
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parsers/StateDefinitionParser.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parsers/StateDefinitionParser.java
index dc14e4ac885..d085c89faac 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parsers/StateDefinitionParser.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parsers/StateDefinitionParser.java
@@ -35,10 +35,10 @@ import org.eclipse.uml2.uml.Lifeline;
public class StateDefinitionParser implements IParser {
public String getEditString(final IAdaptable adaptable, final int flags) {
- final View stateDefinitionLabelView = (View) adaptable.getAdapter(View.class);
- final View stateDefinitionView = (View) stateDefinitionLabelView.eContainer();
+ final View stateDefinitionLabelView = (View)adaptable.getAdapter(View.class);
+ final View stateDefinitionView = (View)stateDefinitionLabelView.eContainer();
final String name = StateDefinitionUtils.getStateDefinitionName(stateDefinitionView);
- if (name == null) {
+ if(name == null) {
return ""; //$NON-NLS-1$
}
return name;
@@ -49,16 +49,17 @@ public class StateDefinitionParser implements IParser {
}
public ICommand getParseCommand(final IAdaptable adaptable, final String newString, final int flags) {
- final View stateDefinitionLabelView = (View) adaptable.getAdapter(View.class);
- final View stateDefinitionView = (View) stateDefinitionLabelView.eContainer();
+ final View stateDefinitionLabelView = (View)adaptable.getAdapter(View.class);
+ final View stateDefinitionView = (View)stateDefinitionLabelView.eContainer();
final View lifelineView = ViewUtils.findSuperViewWithId(stateDefinitionView, FullLifelineEditPartCN.VISUAL_ID);
- final Lifeline lifeline = (Lifeline) lifelineView.getElement();
+ final Lifeline lifeline = (Lifeline)lifelineView.getElement();
final TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(lifeline);
- if (editingDomain == null) {
+ if(editingDomain == null) {
return UnexecutableCommand.INSTANCE;
}
return new AbstractTransactionalCommand(editingDomain, Messages.StateDefinitionParser_SetStateDefinitionName, null) {
+
@Override
protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
StateDefinitionUtils.setStateDefinitionName(stateDefinitionView, newString);
@@ -69,10 +70,10 @@ public class StateDefinitionParser implements IParser {
}
public String getPrintString(final IAdaptable adaptable, final int flags) {
- final View stateDefinitionLabelView = (View) adaptable.getAdapter(View.class);
- final View stateDefinitionView = (View) stateDefinitionLabelView.eContainer();
+ final View stateDefinitionLabelView = (View)adaptable.getAdapter(View.class);
+ final View stateDefinitionView = (View)stateDefinitionLabelView.eContainer();
final String name = StateDefinitionUtils.getStateDefinitionName(stateDefinitionView);
- if (name == null || name.length() == 0) {
+ if(name == null || name.length() == 0) {
return Messages.StateDefinitionParser_Unnamed;
}
return name;
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/AbstractTwoPointCreationTool.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/AbstractTwoPointCreationTool.java
index 4f60487d5e5..546b00923fa 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/AbstractTwoPointCreationTool.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/AbstractTwoPointCreationTool.java
@@ -33,12 +33,15 @@ public abstract class AbstractTwoPointCreationTool extends AspectUnspecifiedType
/** The tool is in this state after clicking on the start element of the duration */
private static final int STATE_FIRST = 1 << 16;
+
/** A request parameter that indicates the first clicked element */
public final static String FIRST_TARGET = "FIRST_TARGET"; //$NON-NLS-1$
+
/** A request parameter that indicates the second clicked element */
public final static String SECOND_TARGET = "SECOND_TARGET"; //$NON-NLS-1$
protected EditPart first = null;
+
protected EditPart second = null;
public AbstractTwoPointCreationTool(final IElementType elementType) {
@@ -63,7 +66,7 @@ public abstract class AbstractTwoPointCreationTool extends AspectUnspecifiedType
@Override
protected boolean handleButtonDown(final int button) {
- if (button != 1) {
+ if(button != 1) {
setState(STATE_INVALID);
handleInvalidInput();
}
@@ -71,13 +74,13 @@ public abstract class AbstractTwoPointCreationTool extends AspectUnspecifiedType
final Command command = getCommand();
final EditPart targetEditPart = getTargetEditPart();
- if (isInState(STATE_INITIAL) && command.canExecute()) {
+ if(isInState(STATE_INITIAL) && command.canExecute()) {
this.first = targetEditPart;
setState(STATE_FIRST);
// make it possible to double-click so that the first and second elements are the same
handleMove();
firstElementSelected();
- } else if (isInState(STATE_FIRST) && command.canExecute()) {
+ } else if(isInState(STATE_FIRST) && command.canExecute()) {
this.second = targetEditPart;
eraseTargetFeedback();
// update the request and command with the second edit part
@@ -93,18 +96,18 @@ public abstract class AbstractTwoPointCreationTool extends AspectUnspecifiedType
@Override
protected Request createTargetRequest() {
final CreateAspectUnspecifiedTypeRequest request = new CreateAspectUnspecifiedTypeRequest(getElementTypes(), getPreferencesHint()) {
+
@SuppressWarnings("unchecked")
@Override
protected void createRequests() {
- final IElementType elementType = (IElementType) getElementTypes().get(0);
+ final IElementType elementType = (IElementType)getElementTypes().get(0);
// set the first and second edit parts on the CreateElementRequest that will be received
// by the create command
final CreateElementRequest createElementRequest = new CreateElementRequest(elementType);
createElementRequest.setParameter(FIRST_TARGET, AbstractTwoPointCreationTool.this.first);
createElementRequest.setParameter(SECOND_TARGET, AbstractTwoPointCreationTool.this.second);
- final ViewAndElementDescriptor viewDescriptor = new ViewAndElementDescriptor(new CreateElementRequestAdapter(createElementRequest), Node.class,
- getGraphicalHint((IHintedType) elementType), getPreferencesHint());
+ final ViewAndElementDescriptor viewDescriptor = new ViewAndElementDescriptor(new CreateElementRequestAdapter(createElementRequest), Node.class, getGraphicalHint((IHintedType)elementType), getPreferencesHint());
final Request request = new CreateViewAndElementRequest(viewDescriptor);
request.setExtendedData(getExtendedData());
request.setType(getType());
@@ -151,7 +154,7 @@ public abstract class AbstractTwoPointCreationTool extends AspectUnspecifiedType
final Request request = getTargetRequest();
final EditPart firstTarget;
final EditPart secondTarget;
- if (isInState(STATE_INITIAL)) {
+ if(isInState(STATE_INITIAL)) {
firstTarget = getTargetEditPart();
secondTarget = null;
} else {
@@ -159,13 +162,14 @@ public abstract class AbstractTwoPointCreationTool extends AspectUnspecifiedType
secondTarget = getTargetEditPart();
}
- if (!validateFirstTarget(firstTarget)) {
+ if(!validateFirstTarget(firstTarget)) {
return UnexecutableCommand.INSTANCE;
}
- if (isInState(STATE_INITIAL)) {
+ if(isInState(STATE_INITIAL)) {
// dummy executable command (to accept a creation in progress)
return new Command() {
+
@Override
public void execute() {
throw new IllegalStateException("This dummy command must never be executed"); //$NON-NLS-1$
@@ -173,7 +177,7 @@ public abstract class AbstractTwoPointCreationTool extends AspectUnspecifiedType
};
}
- if (!validateSecondTarget(firstTarget, secondTarget)) {
+ if(!validateSecondTarget(firstTarget, secondTarget)) {
return UnexecutableCommand.INSTANCE;
}
return getCommand(firstTarget, secondTarget, request);
@@ -183,11 +187,11 @@ public abstract class AbstractTwoPointCreationTool extends AspectUnspecifiedType
* Return the creation command that should be executed after clicking the second node.
*
* @param firstTarget
- * the first node that was clicked
+ * the first node that was clicked
* @param secondTarget
- * the second node that was clicked
+ * the second node that was clicked
* @param request
- * the request for which a creation command should be returned
+ * the request for which a creation command should be returned
* @return the creation command
*/
protected abstract Command getCommand(EditPart firstTarget, EditPart secondTarget, Request request);
@@ -196,7 +200,7 @@ public abstract class AbstractTwoPointCreationTool extends AspectUnspecifiedType
* Validate the first selection
*
* @param firstTarget
- * the first selected element
+ * the first selected element
* @return whether the first selected element is valid
*/
protected abstract boolean validateFirstTarget(final EditPart firstTarget);
@@ -205,9 +209,9 @@ public abstract class AbstractTwoPointCreationTool extends AspectUnspecifiedType
* Validate the second selection
*
* @param firstTarget
- * the first selected element
+ * the first selected element
* @param secondTarget
- * the second selected element
+ * the second selected element
* @return whether the second selected element is valid
*/
protected abstract boolean validateSecondTarget(final EditPart firstTarget, final EditPart secondTarget);
@@ -222,24 +226,23 @@ public abstract class AbstractTwoPointCreationTool extends AspectUnspecifiedType
* Set a help message in the status bar.
*
* @param message
- * a message that should help the user using the tool
+ * a message that should help the user using the tool
*/
protected static void setStatusMessage(final String message) {
- PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor().getEditorSite().getActionBars().getStatusLineManager()
- .setMessage(message);
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor().getEditorSite().getActionBars().getStatusLineManager().setMessage(message);
}
/** Does the View for the first EditPart appear before the View for the second EditPart in their container? */
protected static boolean ordered(final EditPart first, final EditPart second) {
- if (!(first.getModel() instanceof View) || !(second.getModel() instanceof View)) {
+ if(!(first.getModel() instanceof View) || !(second.getModel() instanceof View)) {
return false;
}
- final View firstView = (View) first.getModel();
- final View secondView = (View) second.getModel();
- if (firstView.eContainer() != secondView.eContainer()) {
+ final View firstView = (View)first.getModel();
+ final View secondView = (View)second.getModel();
+ if(firstView.eContainer() != secondView.eContainer()) {
return false;
}
- final View compartment = (View) firstView.eContainer();
+ final View compartment = (View)firstView.eContainer();
final int firstIndex = compartment.getChildren().indexOf(firstView);
final int secondIndex = compartment.getChildren().indexOf(secondView);
return firstIndex <= secondIndex;
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/CustomPaletteFactory.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/CustomPaletteFactory.java
index 768a2653d5a..ef6a986918e 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/CustomPaletteFactory.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/CustomPaletteFactory.java
@@ -50,55 +50,70 @@ import org.eclipse.papyrus.uml.diagram.timing.providers.UMLElementTypes;
import org.eclipse.uml2.uml.UMLPackage;
public class CustomPaletteFactory extends UMLPaletteFactory {
+
private final static String CREATEOCCURRENCESPECIFICATIONCREATIONTOOL = "createOccurrenceSpecificationCreationTool"; //$NON-NLS-1$
+
private final static String CREATEDESTRUCTIONOCCURRENCESPECIFICATIONCREATIONTOOL = "createDestructionOccurrenceSpecificationCreationTool"; //$NON-NLS-1$
+
private final static String CREATESTATEDEFINITIONCREATIONTOOL = "createStateDefinitionCreationTool"; //$NON-NLS-1$
+
private final static String CREATEMESSAGESYNCCREATIONTOOL = "createMessageSyncCreationTool"; //$NON-NLS-1$
+
private final static String CREATEMESSAGEASYNCCREATIONTOOL = "createMessageAsyncCreationTool"; //$NON-NLS-1$
+
private final static String CREATEMESSAGEREPLYCREATIONTOOL = "createMessageReplyCreationTool"; //$NON-NLS-1$
+
private final static String CREATECREATEMESSAGECREATIONTOOL = "createCreateMessageCreationTool"; //$NON-NLS-1$
+
private final static String CREATEDELETEMESSAGECREATIONTOOL = "createDeleteMessageCreationTool"; //$NON-NLS-1$
+
private final static String CREATELOSTMESSAGECREATIONTOOL = "createLostMessageCreationTool"; //$NON-NLS-1$
+
private final static String CREATEFOUNDMESSAGECREATIONTOOL = "createFoundMessageCreationTool"; //$NON-NLS-1$
+
private final static String CREATETIMEOBSERVATIONCREATIONTOOL = "createTimeObservationCreationTool"; //$NON-NLS-1$
+
private final static String CREATETIMECONSTRAINTCREATIONTOOL = "createTimeConstraintCreationTool"; //$NON-NLS-1$
+
private final static String CREATEDURATIONOBSERVATIONCREATIONTOOL = "createDurationObservationCreationTool"; //$NON-NLS-1$
+
private final static String CREATEDURATIONCONSTRAINTCREATIONTOOL = "createDurationConstraintCreationTool"; //$NON-NLS-1$
+
private final static String CREATEGENERALORDERINGCREATIONTOOL = "createGeneralOrderingCreationTool"; //$NON-NLS-1$
public final static String ORIGINAL_TARGET = "ORIGINAL_TARGET"; //$NON-NLS-1$
@Override
public Tool createTool(final String toolId) {
- if (toolId.equals(CREATEOCCURRENCESPECIFICATIONCREATIONTOOL)) {
+ if(toolId.equals(CREATEOCCURRENCESPECIFICATIONCREATIONTOOL)) {
return createOccurrenceSpecificationCreationTool();
- } else if (toolId.equals(CREATEDESTRUCTIONOCCURRENCESPECIFICATIONCREATIONTOOL)) {
+ } else if(toolId.equals(CREATEDESTRUCTIONOCCURRENCESPECIFICATIONCREATIONTOOL)) {
return createDestructionOccurrenceSpecificationCreationTool();
- } else if (toolId.equals(CREATESTATEDEFINITIONCREATIONTOOL)) {
+ } else if(toolId.equals(CREATESTATEDEFINITIONCREATIONTOOL)) {
return createStateDefinitionCreationTool();
- } else if (toolId.equals(CREATEMESSAGESYNCCREATIONTOOL)) {
+ } else if(toolId.equals(CREATEMESSAGESYNCCREATIONTOOL)) {
return createSyncMessageCreationTool();
- } else if (toolId.equals(CREATEMESSAGEASYNCCREATIONTOOL)) {
+ } else if(toolId.equals(CREATEMESSAGEASYNCCREATIONTOOL)) {
return createAsyncMessageCreationTool();
- } else if (toolId.equals(CREATEMESSAGEREPLYCREATIONTOOL)) {
+ } else if(toolId.equals(CREATEMESSAGEREPLYCREATIONTOOL)) {
return createReplyMessageCreationTool();
- } else if (toolId.equals(CREATECREATEMESSAGECREATIONTOOL)) {
+ } else if(toolId.equals(CREATECREATEMESSAGECREATIONTOOL)) {
return createCreateMessageCreationTool();
- } else if (toolId.equals(CREATEDELETEMESSAGECREATIONTOOL)) {
+ } else if(toolId.equals(CREATEDELETEMESSAGECREATIONTOOL)) {
return createDeleteMessageCreationTool();
- } else if (toolId.equals(CREATELOSTMESSAGECREATIONTOOL)) {
+ } else if(toolId.equals(CREATELOSTMESSAGECREATIONTOOL)) {
return createLostMessageCreationTool();
- } else if (toolId.equals(CREATEFOUNDMESSAGECREATIONTOOL)) {
+ } else if(toolId.equals(CREATEFOUNDMESSAGECREATIONTOOL)) {
return createFoundMessageCreationTool();
- } else if (toolId.equals(CREATETIMEOBSERVATIONCREATIONTOOL)) {
+ } else if(toolId.equals(CREATETIMEOBSERVATIONCREATIONTOOL)) {
return createTimeObservationCreationTool();
- } else if (toolId.equals(CREATETIMECONSTRAINTCREATIONTOOL)) {
+ } else if(toolId.equals(CREATETIMECONSTRAINTCREATIONTOOL)) {
return createTimeConstraintCreationTool();
- } else if (toolId.equals(CREATEDURATIONOBSERVATIONCREATIONTOOL)) {
+ } else if(toolId.equals(CREATEDURATIONOBSERVATIONCREATIONTOOL)) {
return createDurationObservationCreationTool();
- } else if (toolId.equals(CREATEDURATIONCONSTRAINTCREATIONTOOL)) {
+ } else if(toolId.equals(CREATEDURATIONCONSTRAINTCREATIONTOOL)) {
return createDurationConstraintCreationTool();
- } else if (toolId.equals(CREATEGENERALORDERINGCREATIONTOOL)) {
+ } else if(toolId.equals(CREATEGENERALORDERINGCREATIONTOOL)) {
return createNewGeneralOrderingCreationTool();
}
return super.createTool(toolId);
@@ -122,6 +137,7 @@ public class CustomPaletteFactory extends UMLPaletteFactory {
private static Tool createNewTimeTool(final IElementType elementType) {
return new AspectUnspecifiedTypeCreationTool(Collections.singletonList(elementType)) {
+
/**
* Redirect the creation request to the parent (Lifeline compartment), but keep the original target in the
* extended data for the creation command.
@@ -130,8 +146,7 @@ public class CustomPaletteFactory extends UMLPaletteFactory {
protected Command getCommand() {
EditPart target = getTargetEditPart();
final Request request = getTargetRequest();
- if (target != null
- && EditPartUtils.isEditPartFor(target, UMLPackage.eINSTANCE.getOccurrenceSpecification(), UMLPackage.eINSTANCE.getStateInvariant())) {
+ if(target != null && EditPartUtils.isEditPartFor(target, UMLPackage.eINSTANCE.getOccurrenceSpecification(), UMLPackage.eINSTANCE.getStateInvariant())) {
@SuppressWarnings("unchecked")
final Map<Object, Object> extendedData = request.getExtendedData();
extendedData.put(ORIGINAL_TARGET, target);
@@ -165,9 +180,10 @@ public class CustomPaletteFactory extends UMLPaletteFactory {
types.add(UMLElementTypes.Node_9);
final Tool tool = new AspectUnspecifiedTypeCreationTool(types) {
+
@Override
protected Command getCommand() {
- if (!(getTargetEditPart() instanceof FullLifelineStateDefinitionCompartmentEditPartCN)) {
+ if(!(getTargetEditPart() instanceof FullLifelineStateDefinitionCompartmentEditPartCN)) {
return UnexecutableCommand.INSTANCE;
}
return super.getCommand();
@@ -198,17 +214,18 @@ public class CustomPaletteFactory extends UMLPaletteFactory {
private static Tool createLostMessageCreationTool() {
return new AspectUnspecifiedTypeConnectionTool(Collections.singletonList(UMLElementTypes.Message_50)) {
+
@Override
protected Command getCommand() {
final Object type = getTargetRequest().getType();
- if (RequestConstants.REQ_CONNECTION_END == type) {
- final CreateAspectUnspecifiedTypeConnectionRequest request = (CreateAspectUnspecifiedTypeConnectionRequest) getTargetRequest();
+ if(RequestConstants.REQ_CONNECTION_END == type) {
+ final CreateAspectUnspecifiedTypeConnectionRequest request = (CreateAspectUnspecifiedTypeConnectionRequest)getTargetRequest();
final EditPart sourceEditPart = request.getSourceEditPart();
// Note: the bounds must be computed before executing the command because the source may be an
// OccurrenceSpecification that will get swapped to a MessageOccurrenceSpecification, thereby
// changing the Figure and EditPart.
- final IFigure figure = ((GraphicalEditPart) sourceEditPart).getFigure();
+ final IFigure figure = ((GraphicalEditPart)sourceEditPart).getFigure();
final Point figureLocation = new Point(figure.getBounds().getCenter());
figure.getParent().translateToAbsolute(figureLocation);
final Point location = request.getLocation();
@@ -221,8 +238,8 @@ public class CustomPaletteFactory extends UMLPaletteFactory {
final TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(sourceEditPart.getModel());
// add a command that sets the initial anchor position using an EAnnotation
- compoundCommand.add(new ICommandProxy(new AbstractTransactionalCommand(editingDomain, Messages.CustomPaletteFactory_SetLostMessageOrigin,
- null) {
+ compoundCommand.add(new ICommandProxy(new AbstractTransactionalCommand(editingDomain, Messages.CustomPaletteFactory_SetLostMessageOrigin, null) {
+
@Override
protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
final Connector connector = findCreatedConnector(superCommand);
@@ -239,23 +256,24 @@ public class CustomPaletteFactory extends UMLPaletteFactory {
private static Tool createFoundMessageCreationTool() {
return new AspectUnspecifiedTypeConnectionTool(Collections.singletonList(UMLElementTypes.Message_53)) {
+
@Override
protected Command getCommand() {
- final CreateAspectUnspecifiedTypeConnectionRequest request = (CreateAspectUnspecifiedTypeConnectionRequest) getTargetRequest();
+ final CreateAspectUnspecifiedTypeConnectionRequest request = (CreateAspectUnspecifiedTypeConnectionRequest)getTargetRequest();
final EditPart targetEditPart = request.getTargetEditPart();
final Object type = getTargetRequest().getType();
- if (RequestConstants.REQ_CONNECTION_START == type) {
+ if(RequestConstants.REQ_CONNECTION_START == type) {
MessageUtils.saveRequestStartLocation(request);
}
- if (RequestConstants.REQ_CONNECTION_END == type) {
+ if(RequestConstants.REQ_CONNECTION_END == type) {
final Point startLocation = MessageUtils.retrieveRequestStartLocation(request);
// Note: the bounds must be computed before executing the command because the source may be an
// OccurrenceSpecification that will get swapped to a MessageOccurrenceSpecification, thereby
// changing the Figure and EditPart.
- final IFigure figure = ((GraphicalEditPart) targetEditPart).getFigure();
+ final IFigure figure = ((GraphicalEditPart)targetEditPart).getFigure();
final Point figureLocation = new Point(figure.getBounds().getCenter());
figure.getParent().translateToAbsolute(figureLocation);
final double scale = FigureUtils.getScale(figure);
@@ -267,8 +285,8 @@ public class CustomPaletteFactory extends UMLPaletteFactory {
final TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(targetEditPart.getModel());
// add a command that sets the initial anchor position using an EAnnotation
- compoundCommand.add(new ICommandProxy(new AbstractTransactionalCommand(editingDomain, Messages.CustomPaletteFactory_SetFoundMessageTarget,
- null) {
+ compoundCommand.add(new ICommandProxy(new AbstractTransactionalCommand(editingDomain, Messages.CustomPaletteFactory_SetFoundMessageTarget, null) {
+
@Override
protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
final Connector connector = findCreatedConnector(superCommand);
@@ -285,19 +303,19 @@ public class CustomPaletteFactory extends UMLPaletteFactory {
/** Find the Connector in the haystack (buried deep in a CommandResult within the command). */
protected static Connector findCreatedConnector(final Command command) {
- if (command instanceof ICommandProxy) {
- final ICommandProxy commandProxy = (ICommandProxy) command;
+ if(command instanceof ICommandProxy) {
+ final ICommandProxy commandProxy = (ICommandProxy)command;
final ICommand iCommand = commandProxy.getICommand();
final CommandResult commandResult = iCommand.getCommandResult();
final Object returnValue = commandResult.getReturnValue();
- if (returnValue instanceof List<?>) {
- final List<?> resultList = (List<?>) returnValue;
- for (final Object resultElement : resultList) {
- if (resultElement instanceof ConnectionViewAndElementDescriptor) {
- final ConnectionViewAndElementDescriptor connectionViewAndElementDescriptor = (ConnectionViewAndElementDescriptor) resultElement;
- final View view = (View) connectionViewAndElementDescriptor.getAdapter(View.class);
- if (view instanceof Connector) {
- final Connector connector = (Connector) view;
+ if(returnValue instanceof List<?>) {
+ final List<?> resultList = (List<?>)returnValue;
+ for(final Object resultElement : resultList) {
+ if(resultElement instanceof ConnectionViewAndElementDescriptor) {
+ final ConnectionViewAndElementDescriptor connectionViewAndElementDescriptor = (ConnectionViewAndElementDescriptor)resultElement;
+ final View view = (View)connectionViewAndElementDescriptor.getAdapter(View.class);
+ if(view instanceof Connector) {
+ final Connector connector = (Connector)view;
return connector;
}
}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/DestructionOccurrenceSpecificationCreationTool.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/DestructionOccurrenceSpecificationCreationTool.java
index fa23f53c96c..f53f89118d0 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/DestructionOccurrenceSpecificationCreationTool.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/DestructionOccurrenceSpecificationCreationTool.java
@@ -44,15 +44,14 @@ public class DestructionOccurrenceSpecificationCreationTool extends CreationTool
@Override
protected Command getCommand() {
final EditPart targetEditPart = getTargetEditPart();
- final CompositeCommand compositeCommand = new CompositeCommand(
- Messages.DestructionOccurrenceSpecificationCreationTool_CreateDestructionOccurrenceSpecification);
+ final CompositeCommand compositeCommand = new CompositeCommand(Messages.DestructionOccurrenceSpecificationCreationTool_CreateDestructionOccurrenceSpecification);
EditPart timeline;
- if (targetEditPart instanceof FullStateInvariantEditPartCN) {
- final FullStateInvariantEditPartCN fullStateInvariantEditPartCN = (FullStateInvariantEditPartCN) targetEditPart;
+ if(targetEditPart instanceof FullStateInvariantEditPartCN) {
+ final FullStateInvariantEditPartCN fullStateInvariantEditPartCN = (FullStateInvariantEditPartCN)targetEditPart;
timeline = EditPartUtils.findParentEditPartWithId(targetEditPart, FullLifelineTimelineCompartmentEditPartCN.VISUAL_ID);
compositeCommand.add(new CutAndInsertOccurrenceSpecificationCommand(fullStateInvariantEditPartCN, getLocation(), true));
- } else if (targetEditPart instanceof CompactStateInvariantEditPartCN) {
- final CompactStateInvariantEditPartCN compactStateInvariantEditPartCN = (CompactStateInvariantEditPartCN) targetEditPart;
+ } else if(targetEditPart instanceof CompactStateInvariantEditPartCN) {
+ final CompactStateInvariantEditPartCN compactStateInvariantEditPartCN = (CompactStateInvariantEditPartCN)targetEditPart;
timeline = EditPartUtils.findParentEditPartWithId(targetEditPart, CompactLifelineCompartmentEditPartCN.VISUAL_ID);
compositeCommand.add(new CutAndInsertOccurrenceSpecificationCompactLifelineCommand(compactStateInvariantEditPartCN, getLocation(), true));
} else {
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/DurationCreationTool.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/DurationCreationTool.java
index 91a28227ca5..4f460889aba 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/DurationCreationTool.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/DurationCreationTool.java
@@ -24,14 +24,12 @@ public class DurationCreationTool extends AbstractTwoPointCreationTool {
@Override
protected boolean validateFirstTarget(final EditPart firstTarget) {
- return firstTarget != null
- && EditPartUtils.isEditPartFor(firstTarget, UMLPackage.eINSTANCE.getOccurrenceSpecification(), UMLPackage.eINSTANCE.getStateInvariant());
+ return firstTarget != null && EditPartUtils.isEditPartFor(firstTarget, UMLPackage.eINSTANCE.getOccurrenceSpecification(), UMLPackage.eINSTANCE.getStateInvariant());
}
@Override
protected boolean validateSecondTarget(final EditPart firstTarget, final EditPart secondTarget) {
- if (secondTarget == null
- || !EditPartUtils.isEditPartFor(secondTarget, UMLPackage.eINSTANCE.getOccurrenceSpecification(), UMLPackage.eINSTANCE.getStateInvariant())) {
+ if(secondTarget == null || !EditPartUtils.isEditPartFor(secondTarget, UMLPackage.eINSTANCE.getOccurrenceSpecification(), UMLPackage.eINSTANCE.getStateInvariant())) {
return false;
}
return ordered(firstTarget, secondTarget);
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/FloatingMessageAnchor.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/FloatingMessageAnchor.java
index b1b5ea96f77..91a2286abcc 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/FloatingMessageAnchor.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/FloatingMessageAnchor.java
@@ -20,7 +20,9 @@ import org.eclipse.papyrus.uml.diagram.timing.custom.utils.MessageUtils;
* gets its relative location from an EAnnotation stored on the Connector.
*/
public class FloatingMessageAnchor extends ConnectionAnchorBase {
+
private final ConnectionEditPart connectionEditPart;
+
private final Point defaultOffset;
public FloatingMessageAnchor(final ConnectionEditPart connEditPart, final Point defaultOffset) {
@@ -38,9 +40,9 @@ public class FloatingMessageAnchor extends ConnectionAnchorBase {
public Point getLocation(final Point reference) {
final Point point = MessageUtils.getMessageConnectorLocation(this.connectionEditPart);
- if (point != null) {
+ if(point != null) {
return new Point(reference.x + point.x, reference.y + point.y);
}
return new Point(reference.x + this.defaultOffset.x, reference.y + this.defaultOffset.y);
}
-} \ No newline at end of file
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/GeneralOrderingCreationTool.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/GeneralOrderingCreationTool.java
index 0aa648b9642..3018ae310ec 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/GeneralOrderingCreationTool.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/GeneralOrderingCreationTool.java
@@ -29,7 +29,7 @@ public class GeneralOrderingCreationTool extends AbstractTwoPointCreationTool {
@Override
protected boolean validateSecondTarget(final EditPart firstTarget, final EditPart secondTarget) {
- if (secondTarget == null || !EditPartUtils.isEditPartFor(secondTarget, UMLPackage.eINSTANCE.getOccurrenceSpecification())) {
+ if(secondTarget == null || !EditPartUtils.isEditPartFor(secondTarget, UMLPackage.eINSTANCE.getOccurrenceSpecification())) {
return false;
}
return ordered(firstTarget, secondTarget);
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/OccurrenceSpecificationCreationTool.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/OccurrenceSpecificationCreationTool.java
index 527cd94994b..062f7505474 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/OccurrenceSpecificationCreationTool.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/OccurrenceSpecificationCreationTool.java
@@ -46,12 +46,12 @@ public class OccurrenceSpecificationCreationTool extends CreationTool {
final EditPart targetEditPart = getTargetEditPart();
final CompositeCommand compositeCommand = new CompositeCommand(Messages.OccurrenceSpecificationCreationTool_CreateOccurrenceSpecification);
EditPart timeline;
- if (targetEditPart instanceof FullStateInvariantEditPartCN) {
- final FullStateInvariantEditPartCN fullStateInvariantEditPartCN = (FullStateInvariantEditPartCN) targetEditPart;
+ if(targetEditPart instanceof FullStateInvariantEditPartCN) {
+ final FullStateInvariantEditPartCN fullStateInvariantEditPartCN = (FullStateInvariantEditPartCN)targetEditPart;
timeline = EditPartUtils.findParentEditPartWithId(targetEditPart, FullLifelineTimelineCompartmentEditPartCN.VISUAL_ID);
compositeCommand.add(new CutAndInsertOccurrenceSpecificationCommand(fullStateInvariantEditPartCN, getLocation(), false));
- } else if (targetEditPart instanceof CompactStateInvariantEditPartCN) {
- final CompactStateInvariantEditPartCN compactStateInvariantEditPartCN = (CompactStateInvariantEditPartCN) targetEditPart;
+ } else if(targetEditPart instanceof CompactStateInvariantEditPartCN) {
+ final CompactStateInvariantEditPartCN compactStateInvariantEditPartCN = (CompactStateInvariantEditPartCN)targetEditPart;
timeline = EditPartUtils.findParentEditPartWithId(targetEditPart, CompactLifelineCompartmentEditPartCN.VISUAL_ID);
compositeCommand.add(new AddOccurrenceSpecificationInCompactLifelineCommand(compactStateInvariantEditPartCN, getLocation()));
} else {
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/PropertyDiagramUpdater.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/PropertyDiagramUpdater.java
index 0aa144c31b8..d92283f08ea 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/PropertyDiagramUpdater.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/PropertyDiagramUpdater.java
@@ -38,53 +38,53 @@ public class PropertyDiagramUpdater implements ICustomDiagramUpdater {
}
public static List<UMLNodeDescriptor> getLifelineFullLifelineTimelineCompartment_8SemanticChildren(final View view) {
- if (false == view.eContainer() instanceof View) {
+ if(false == view.eContainer() instanceof View) {
return Collections.emptyList();
}
- final View containerView = (View) view.eContainer();
- if (!containerView.isSetElement()) {
+ final View containerView = (View)view.eContainer();
+ if(!containerView.isSetElement()) {
return Collections.emptyList();
}
- final Lifeline modelElement = (Lifeline) containerView.getElement();
+ final Lifeline modelElement = (Lifeline)containerView.getElement();
final LinkedList<UMLNodeDescriptor> result = new LinkedList<UMLNodeDescriptor>();
- if ((modelElement).getCoveredBys().size() > 0) {
+ if((modelElement).getCoveredBys().size() > 0) {
final Interaction interaction = modelElement.getInteraction();
- for (final Object element : interaction.getFragments()) {
+ for(final Object element : interaction.getFragments()) {
- final InteractionFragment childElement = (InteractionFragment) element;
+ final InteractionFragment childElement = (InteractionFragment)element;
final int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
- if (visualID == FullStateInvariantEditPartCN.VISUAL_ID) {
+ if(visualID == FullStateInvariantEditPartCN.VISUAL_ID) {
result.add(new UMLNodeDescriptor(childElement, visualID));
continue;
}
- if (visualID == OccurrenceSpecificationEditPartCN.VISUAL_ID) {
+ if(visualID == OccurrenceSpecificationEditPartCN.VISUAL_ID) {
result.add(new UMLNodeDescriptor(childElement, visualID));
continue;
}
- if (visualID == MessageOccurrenceSpecificationEditPartCN.VISUAL_ID) {
+ if(visualID == MessageOccurrenceSpecificationEditPartCN.VISUAL_ID) {
result.add(new UMLNodeDescriptor(childElement, visualID));
continue;
}
- if (visualID == DestructionOccurrenceSpecificationEditPartCN.VISUAL_ID) {
+ if(visualID == DestructionOccurrenceSpecificationEditPartCN.VISUAL_ID) {
result.add(new UMLNodeDescriptor(childElement, visualID));
continue;
}
}
}
- if ((modelElement).getCoveredBys().size() > 0) {
+ if((modelElement).getCoveredBys().size() > 0) {
final Interaction interaction = modelElement.getInteraction();
- for (final Object element : interaction.getOwnedRules()) {
- final Constraint childElement = (Constraint) element;
+ for(final Object element : interaction.getOwnedRules()) {
+ final Constraint childElement = (Constraint)element;
final int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
- if (visualID == DurationConstraintEditPartCN.VISUAL_ID) {
+ if(visualID == DurationConstraintEditPartCN.VISUAL_ID) {
result.add(new UMLNodeDescriptor(childElement, visualID));
continue;
}
- if (visualID == DurationObservationEditPartCN.VISUAL_ID) {
+ if(visualID == DurationObservationEditPartCN.VISUAL_ID) {
result.add(new UMLNodeDescriptor(childElement, visualID));
continue;
}
@@ -94,53 +94,53 @@ public class PropertyDiagramUpdater implements ICustomDiagramUpdater {
}
public static List<UMLNodeDescriptor> createLifelineCompactLifelineCompartment_23Children(final View view) {
- if (false == view.eContainer() instanceof View) {
+ if(false == view.eContainer() instanceof View) {
return Collections.emptyList();
}
- final View containerView = (View) view.eContainer();
- if (!containerView.isSetElement()) {
+ final View containerView = (View)view.eContainer();
+ if(!containerView.isSetElement()) {
return Collections.emptyList();
}
- final Lifeline modelElement = (Lifeline) containerView.getElement();
+ final Lifeline modelElement = (Lifeline)containerView.getElement();
final LinkedList<UMLNodeDescriptor> result = new LinkedList<UMLNodeDescriptor>();
- if ((modelElement).getCoveredBys().size() > 0) {
+ if((modelElement).getCoveredBys().size() > 0) {
final Interaction interaction = modelElement.getInteraction();
- for (final Object element : interaction.getFragments()) {
+ for(final Object element : interaction.getFragments()) {
- final InteractionFragment childElement = (InteractionFragment) element;
+ final InteractionFragment childElement = (InteractionFragment)element;
final int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
- if (visualID == CompactStateInvariantEditPartCN.VISUAL_ID) {
+ if(visualID == CompactStateInvariantEditPartCN.VISUAL_ID) {
result.add(new UMLNodeDescriptor(childElement, visualID));
continue;
}
- if (visualID == OccurrenceSpecificationEditPartCN.VISUAL_ID) {
+ if(visualID == OccurrenceSpecificationEditPartCN.VISUAL_ID) {
result.add(new UMLNodeDescriptor(childElement, visualID));
continue;
}
- if (visualID == MessageOccurrenceSpecificationEditPartCN.VISUAL_ID) {
+ if(visualID == MessageOccurrenceSpecificationEditPartCN.VISUAL_ID) {
result.add(new UMLNodeDescriptor(childElement, visualID));
continue;
}
- if (visualID == DestructionOccurrenceSpecificationEditPartCN.VISUAL_ID) {
+ if(visualID == DestructionOccurrenceSpecificationEditPartCN.VISUAL_ID) {
result.add(new UMLNodeDescriptor(childElement, visualID));
continue;
}
}
}
- if ((modelElement).getCoveredBys().size() > 0) {
+ if((modelElement).getCoveredBys().size() > 0) {
final Interaction interaction = modelElement.getInteraction();
- for (final Object element : interaction.getOwnedRules()) {
- final Constraint childElement = (Constraint) element;
+ for(final Object element : interaction.getOwnedRules()) {
+ final Constraint childElement = (Constraint)element;
final int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
- if (visualID == DurationConstraintEditPartCN.VISUAL_ID) {
+ if(visualID == DurationConstraintEditPartCN.VISUAL_ID) {
result.add(new UMLNodeDescriptor(childElement, visualID));
continue;
}
- if (visualID == DurationObservationEditPartCN.VISUAL_ID) {
+ if(visualID == DurationObservationEditPartCN.VISUAL_ID) {
result.add(new UMLNodeDescriptor(childElement, visualID));
continue;
}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/SpecificTypeCreationTool.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/SpecificTypeCreationTool.java
index 49ec232aeaa..e3393a48ac6 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/SpecificTypeCreationTool.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/parts/SpecificTypeCreationTool.java
@@ -21,16 +21,18 @@ import org.eclipse.papyrus.uml.diagram.common.service.AspectUnspecifiedTypeConne
/** A creation tool that only allows creating connections between specific types. */
public class SpecificTypeCreationTool extends AspectUnspecifiedTypeConnectionTool {
+
private final Collection<EClass> sourceTypes;
+
private final Collection<EClass> targetTypes;
/**
* @param connectionTypeToCreate
- * the element type of the connection to create
+ * the element type of the connection to create
* @param sourceTypes
- * the connection will only be allowed if the source is of one of these types
+ * the connection will only be allowed if the source is of one of these types
* @param targetTypes
- * the connection will only be allowed if the target is of one of these types
+ * the connection will only be allowed if the target is of one of these types
*/
public SpecificTypeCreationTool(final IElementType connectionTypeToCreate, final Collection<EClass> sourceTypes, final Collection<EClass> targetTypes) {
super(Collections.singletonList(connectionTypeToCreate));
@@ -42,20 +44,20 @@ public class SpecificTypeCreationTool extends AspectUnspecifiedTypeConnectionToo
protected Command getCommand() {
final EditPart targetEditPart = getTargetEditPart();
EObject element = null;
- if (targetEditPart != null && targetEditPart.getModel() instanceof View) {
- element = ((View) targetEditPart.getModel()).getElement();
+ if(targetEditPart != null && targetEditPart.getModel() instanceof View) {
+ element = ((View)targetEditPart.getModel()).getElement();
}
// only allow creating a connection that starts from the sourceType
- if (isInState(STATE_INITIAL)) {
- if (!isOfType(element, this.sourceTypes)) {
+ if(isInState(STATE_INITIAL)) {
+ if(!isOfType(element, this.sourceTypes)) {
return null;
}
}
// only allow creating a connection that goes to the targetType
- if (isInState(STATE_CONNECTION_STARTED) || isInState(STATE_TERMINAL)) {
- if (!isOfType(element, this.targetTypes)) {
+ if(isInState(STATE_CONNECTION_STARTED) || isInState(STATE_TERMINAL)) {
+ if(!isOfType(element, this.targetTypes)) {
return null;
}
}
@@ -63,11 +65,11 @@ public class SpecificTypeCreationTool extends AspectUnspecifiedTypeConnectionToo
}
private static boolean isOfType(final EObject element, final Collection<EClass> types) {
- for (final EClass eClass : types) {
- if (eClass.isInstance(element)) {
+ for(final EClass eClass : types) {
+ if(eClass.isInstance(element)) {
return true;
}
}
return false;
}
-} \ No newline at end of file
+}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/providers/CustomEditPolicyProvider.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/providers/CustomEditPolicyProvider.java
index b26e7cebb35..35a16df7f83 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/providers/CustomEditPolicyProvider.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/providers/CustomEditPolicyProvider.java
@@ -40,19 +40,19 @@ public class CustomEditPolicyProvider extends AbstractProvider implements IEditP
* {@inheritDoc}
*/
public void createEditPolicies(final EditPart editPart) {
- if (!(editPart instanceof AppliedStereotypeMultilinePropertyEditPart)) {
+ if(!(editPart instanceof AppliedStereotypeMultilinePropertyEditPart)) {
// editPart.installEditPolicy(NavigationEditPolicy.NAVIGATION_POLICY, new NavigationEditPolicy());
- if (editPart instanceof IPrimaryEditPart) {
+ if(editPart instanceof IPrimaryEditPart) {
// if (EMFHelper.getEObject(editPart) != null) {
// editPart.installEditPolicy(AppliedStereotypeCommentCreationEditPolicy.APPLIED_STEREOTYPE_COMMENT,
// new AppliedStereotypeCommentCreationEditPolicy());
// }
- if (!(editPart instanceof ConnectionEditPart)) {
+ if(!(editPart instanceof ConnectionEditPart)) {
// editPart.installEditPolicy(EditPolicyRoles.POPUPBAR_ROLE, new HyperLinkPopupBarEditPolicy());
}
}
- if (editPart instanceof NamedElementEditPart) {
+ if(editPart instanceof NamedElementEditPart) {
editPart.installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeCompartmentEditPolicy());
}
}
@@ -63,14 +63,14 @@ public class CustomEditPolicyProvider extends AbstractProvider implements IEditP
* {@inheritDoc}
*/
public boolean provides(final IOperation operation) {
- final CreateEditPoliciesOperation epOperation = (CreateEditPoliciesOperation) operation;
- if (!(epOperation.getEditPart() instanceof GraphicalEditPart) && !(epOperation.getEditPart() instanceof ConnectionEditPart)) {
+ final CreateEditPoliciesOperation epOperation = (CreateEditPoliciesOperation)operation;
+ if(!(epOperation.getEditPart() instanceof GraphicalEditPart) && !(epOperation.getEditPart() instanceof ConnectionEditPart)) {
return false;
}
final EditPart gep = epOperation.getEditPart();
- final String diagramType = ((View) gep.getModel()).getDiagram().getType();
- if (!TimingDiagramEditPart.MODEL_ID.equals(diagramType)) {
+ final String diagramType = ((View)gep.getModel()).getDiagram().getType();
+ if(!TimingDiagramEditPart.MODEL_ID.equals(diagramType)) {
return false;
}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/providers/StereotypePropertiesEditPartProvider.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/providers/StereotypePropertiesEditPartProvider.java
index 3896319ebd0..e2fc2878dc4 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/providers/StereotypePropertiesEditPartProvider.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/providers/StereotypePropertiesEditPartProvider.java
@@ -56,19 +56,19 @@ public class StereotypePropertiesEditPartProvider extends RestrictedAbstractEdit
*/
@Override
public boolean provides(final IOperation operation) {
- if (operation instanceof CreateGraphicEditPartOperation) {
- final View newView = ((IEditPartOperation) operation).getView();
- if (newView == null) {
+ if(operation instanceof CreateGraphicEditPartOperation) {
+ final View newView = ((IEditPartOperation)operation).getView();
+ if(newView == null) {
return false;
}
final String graphicalType = newView.getType();
- if ((newView instanceof Node) && (!this.nodeMap.containsKey(graphicalType))) {
+ if((newView instanceof Node) && (!this.nodeMap.containsKey(graphicalType))) {
return false;
}
- if ((newView instanceof Edge) && (!this.edgeMap.containsKey(graphicalType))) {
+ if((newView instanceof Edge) && (!this.edgeMap.containsKey(graphicalType))) {
return false;
}
}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/Constants.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/Constants.java
index 43ba86f4579..89063dc39b5 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/Constants.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/Constants.java
@@ -13,6 +13,7 @@ import org.eclipse.papyrus.uml.diagram.timing.edit.parts.FullStateInvariantEditP
import org.eclipse.papyrus.uml.diagram.timing.edit.parts.FullStateInvariantVerticalLineEditPart;
public final class Constants {
+
private Constants() {
// not instantiable
}
@@ -24,10 +25,14 @@ public final class Constants {
public static final int MINIMUM_DISTANCE_BETWEEN_OCCURRENCE_SPECIFICATIONS = 4;
public static final int MARGIN_BETWEEN_LIFELINES = 8;
+
public static final int TIME_RULER_HEIGHT = 30;
+
public static final int STATE_DEFINITIONS_WIDTH = 100;
public static final String fullStateInvariantId = Integer.toString(FullStateInvariantEditPartCN.VISUAL_ID);
+
public static final String compactStateInvariantId = Integer.toString(CompactStateInvariantEditPartCN.VISUAL_ID);
+
public static final String verticalLineId = Integer.toString(FullStateInvariantVerticalLineEditPart.VISUAL_ID);
}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/DropUtils.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/DropUtils.java
index b582ce4c60b..6ac554738a6 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/DropUtils.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/DropUtils.java
@@ -80,16 +80,16 @@ public final class DropUtils {
}
public static ICommand getDropMessageCommand(final Message message, final View dropTarget, final EditPartViewer viewer) {
- if (message.getMessageKind() == MessageKind.LOST_LITERAL) {
+ if(message.getMessageKind() == MessageKind.LOST_LITERAL) {
return getDropLostMessageCommand(message, dropTarget, viewer);
}
- if (message.getMessageKind() == MessageKind.FOUND_LITERAL) {
+ if(message.getMessageKind() == MessageKind.FOUND_LITERAL) {
return getDropFoundMessageCommand(message, dropTarget, viewer);
}
final MessageEnd sendEvent = message.getSendEvent();
final MessageEnd receiveEvent = message.getReceiveEvent();
- if (sendEvent == null || receiveEvent == null) {
+ if(sendEvent == null || receiveEvent == null) {
return UnexecutableCommand.INSTANCE;
}
@@ -100,29 +100,29 @@ public final class DropUtils {
filterMessageSourceOrTargetViews(sourceViews);
filterMessageSourceOrTargetViews(targetViews);
- if (sourceViews.size() != 1 || targetViews.size() != 1) {
+ if(sourceViews.size() != 1 || targetViews.size() != 1) {
return UnexecutableCommand.INSTANCE;
}
final View sourceView = sourceViews.get(0);
final View targetView = targetViews.get(0);
- if (sourceView == null || sourceView.getDiagram() == null || targetView == null || targetView.getDiagram() == null) {
+ if(sourceView == null || sourceView.getDiagram() == null || targetView == null || targetView.getDiagram() == null) {
return UnexecutableCommand.INSTANCE;
}
final View interactionView = ViewUtils.findSuperViewWithId(dropTarget, InteractionEditPartTN.VISUAL_ID);
// the drop must be targeted inside the interaction
- if (interactionView == null) {
+ if(interactionView == null) {
return UnexecutableCommand.INSTANCE;
}
// the source and target views must be inside the interaction view
- if (!ViewUtils.isContained(sourceView, interactionView) || !ViewUtils.isContained(targetView, interactionView)) {
+ if(!ViewUtils.isContained(sourceView, interactionView) || !ViewUtils.isContained(targetView, interactionView)) {
return UnexecutableCommand.INSTANCE;
}
// don't allow multiple Views for the same Message in the same Diagram
- if (ViewUtils.containsConnectorFor(dropTarget, message)) {
+ if(ViewUtils.containsConnectorFor(dropTarget, message)) {
return UnexecutableCommand.INSTANCE;
}
// create the connection for the existing message, from the sourceView to the targetView
@@ -131,7 +131,7 @@ public final class DropUtils {
private static ICommand getDropLostMessageCommand(final Message message, final View dropTarget, final EditPartViewer viewer) {
final MessageEnd sendEvent = message.getSendEvent();
- if (sendEvent == null) {
+ if(sendEvent == null) {
return UnexecutableCommand.INSTANCE;
}
return getDropLostOrFoundMessage(message, dropTarget, viewer, sendEvent);
@@ -139,7 +139,7 @@ public final class DropUtils {
private static ICommand getDropFoundMessageCommand(final Message message, final View dropTarget, final EditPartViewer viewer) {
final MessageEnd receiveEvent = message.getReceiveEvent();
- if (receiveEvent == null) {
+ if(receiveEvent == null) {
return UnexecutableCommand.INSTANCE;
}
return getDropLostOrFoundMessage(message, dropTarget, viewer, receiveEvent);
@@ -148,27 +148,27 @@ public final class DropUtils {
private static ICommand getDropLostOrFoundMessage(final Message message, final View dropTarget, final EditPartViewer viewer, final MessageEnd endEvent) {
final List<View> endViews = DiagramEditPartsUtil.findViews(endEvent, viewer);
filterMessageSourceOrTargetViews(endViews);
- if (endViews.size() != 1) {
+ if(endViews.size() != 1) {
return UnexecutableCommand.INSTANCE;
}
final View endView = endViews.get(0);
final View interactionView = ViewUtils.findSuperViewWithId(dropTarget, InteractionEditPartTN.VISUAL_ID);
View lifelineView = ViewUtils.findSuperViewWithId(endView, FullLifelineEditPartCN.VISUAL_ID);
- if (lifelineView == null) {
+ if(lifelineView == null) {
lifelineView = ViewUtils.findSuperViewWithId(endView, CompactLifelineEditPartCN.VISUAL_ID);
}
- if (interactionView == null || lifelineView == null) {
+ if(interactionView == null || lifelineView == null) {
return UnexecutableCommand.INSTANCE;
}
- if (!ViewUtils.isContained(endView, interactionView)) {
+ if(!ViewUtils.isContained(endView, interactionView)) {
return UnexecutableCommand.INSTANCE;
}
- if (ViewUtils.containsConnectorFor(dropTarget, message)) {
+ if(ViewUtils.containsConnectorFor(dropTarget, message)) {
return UnexecutableCommand.INSTANCE;
}
// create the connection for the lost message, from the endView to the lifelineView
- if (message.getMessageKind() == MessageKind.LOST_LITERAL) {
+ if(message.getMessageKind() == MessageKind.LOST_LITERAL) {
return createMessageConnectionView(message, viewer, endView, lifelineView);
}
// create the connection for the found message, from the lifelineView to the endView
@@ -177,50 +177,48 @@ public final class DropUtils {
private static ICommand createMessageConnectionView(final Message message, final EditPartViewer viewer, final View sourceView, final View targetView) {
final IElementType elementType = MessageUtils.getElementType(message);
- final String semanticHint = ((IHintedType) elementType).getSemanticHint();
- final ConnectionViewDescriptor connectionViewDescriptor = new CreateConnectionViewRequest.ConnectionViewDescriptor(elementType, semanticHint,
- ViewUtil.APPEND, true, PreferencesHint.USE_DEFAULTS);
+ final String semanticHint = ((IHintedType)elementType).getSemanticHint();
+ final ConnectionViewDescriptor connectionViewDescriptor = new CreateConnectionViewRequest.ConnectionViewDescriptor(elementType, semanticHint, ViewUtil.APPEND, true, PreferencesHint.USE_DEFAULTS);
final IAdaptable sourceViewAdapter = new EObjectAdapter(sourceView);
final IAdaptable targetViewAdapter = new EObjectAdapter(targetView);
final TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(message);
- final CommonDeferredCreateConnectionViewCommand createConnectionViewCommand = new CommonDeferredCreateConnectionViewCommand(editingDomain,
- semanticHint, sourceViewAdapter, targetViewAdapter, viewer, PreferencesHint.USE_DEFAULTS, connectionViewDescriptor, null);
+ final CommonDeferredCreateConnectionViewCommand createConnectionViewCommand = new CommonDeferredCreateConnectionViewCommand(editingDomain, semanticHint, sourceViewAdapter, targetViewAdapter, viewer, PreferencesHint.USE_DEFAULTS, connectionViewDescriptor, null);
createConnectionViewCommand.setElement(message);
return createConnectionViewCommand;
}
private static void filterMessageSourceOrTargetViews(final List<View> views) {
final ListIterator<View> listIterator = views.listIterator();
- while (listIterator.hasNext()) {
+ while(listIterator.hasNext()) {
final View view = listIterator.next();
final int visualID = UMLVisualIDRegistry.getVisualID(view);
- if (!OccurrenceSpecificationUtils.isOccurrenceSpecificationEditPart(visualID) && visualID != GateEditPart.VISUAL_ID) {
+ if(!OccurrenceSpecificationUtils.isOccurrenceSpecificationEditPart(visualID) && visualID != GateEditPart.VISUAL_ID) {
listIterator.remove();
}
}
}
private interface IDropLinkedNodeInLifelineAction<T extends EObject> {
+
void drop(T element, View compartmentView);
}
- public static ICommand getDropLinkedNodeInLifelineCommand(final EObject droppedElement, final Collection<EObject> linkedElements, final View dropTarget,
- final EditPartViewer viewer, final IDropLinkedNodeInLifelineAction<? extends EObject> dropAction) {
+ public static ICommand getDropLinkedNodeInLifelineCommand(final EObject droppedElement, final Collection<EObject> linkedElements, final View dropTarget, final EditPartViewer viewer, final IDropLinkedNodeInLifelineAction<? extends EObject> dropAction) {
final View interactionView = ViewUtils.findSuperViewWithId(dropTarget, InteractionEditPartTN.VISUAL_ID);
// the drop must be targeted inside the interaction
- if (interactionView == null || ViewUtils.containsViewFor(interactionView, droppedElement)) {
+ if(interactionView == null || ViewUtils.containsViewFor(interactionView, droppedElement)) {
return UnexecutableCommand.INSTANCE;
}
final Set<View> targetLifelines = new HashSet<View>();
- for (final EObject eObject : linkedElements) {
- if (eObject instanceof InteractionFragment) {
- final InteractionFragment interactionFragment = (InteractionFragment) eObject;
+ for(final EObject eObject : linkedElements) {
+ if(eObject instanceof InteractionFragment) {
+ final InteractionFragment interactionFragment = (InteractionFragment)eObject;
final EList<Lifeline> covereds = interactionFragment.getCovereds();
- for (final Lifeline lifeline : covereds) {
+ for(final Lifeline lifeline : covereds) {
final List<View> lifelineViews = DiagramEditPartsUtil.findViews(lifeline, viewer);
- for (final View lifelineView : lifelineViews) {
- if (LifelineUtils.isLifelineView(lifelineView) && ViewUtils.isContained(lifelineView, interactionView)) {
+ for(final View lifelineView : lifelineViews) {
+ if(LifelineUtils.isLifelineView(lifelineView) && ViewUtils.isContained(lifelineView, interactionView)) {
targetLifelines.add(lifelineView);
}
}
@@ -235,17 +233,17 @@ public final class DropUtils {
@SuppressWarnings("unchecked")
@Override
protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
- for (final View targetLifeline : targetLifelines) {
+ for(final View targetLifeline : targetLifelines) {
final View compartmentView = ViewUtils.findChildTimelineCompartmentView(targetLifeline);
- ((IDropLinkedNodeInLifelineAction<EObject>) dropAction).drop(droppedElement, compartmentView);
+ ((IDropLinkedNodeInLifelineAction<EObject>)dropAction).drop(droppedElement, compartmentView);
}
return CommandResult.newOKCommandResult();
}
});
// add command to layout the new Node
- for (final View targetLifeline : targetLifelines) {
- final EditPart lifelineEditPart = (EditPart) viewer.getEditPartRegistry().get(targetLifeline);
+ for(final View targetLifeline : targetLifelines) {
+ final EditPart lifelineEditPart = (EditPart)viewer.getEditPartRegistry().get(targetLifeline);
final EditPart compartmentEditPart = LifelineUtils.getLifelineCompartment(lifelineEditPart);
compositeCommand.add(new CommandProxy(compartmentEditPart.getCommand(AbstractTimelineLayoutPolicy.UPDATE_LAYOUT_REQUEST)));
}
@@ -254,10 +252,10 @@ public final class DropUtils {
}
protected static class DropTimeObservationAction implements IDropLinkedNodeInLifelineAction<TimeObservation> {
+
public void drop(final TimeObservation timeObservation, final View compartmentView) {
- final Node timeObservationNode = new UMLViewProvider().createTimeObservation_16(timeObservation, compartmentView, ViewUtil.APPEND, true,
- PreferencesHint.USE_DEFAULTS);
- if (timeObservationNode != null) {
+ final Node timeObservationNode = new UMLViewProvider().createTimeObservation_16(timeObservation, compartmentView, ViewUtil.APPEND, true, PreferencesHint.USE_DEFAULTS);
+ if(timeObservationNode != null) {
final Location loc = NotationFactory.eINSTANCE.createLocation();
loc.setX(0);
loc.setY(40);
@@ -268,15 +266,14 @@ public final class DropUtils {
public static ICommand getDropTimeObservationCommand(final TimeObservation timeObservation, final View dropTarget, final EditPartViewer viewer) {
final NamedElement event = timeObservation.getEvent();
- return getDropLinkedNodeInLifelineCommand(timeObservation, Collections.<EObject> singletonList(event), dropTarget, viewer,
- new DropTimeObservationAction());
+ return getDropLinkedNodeInLifelineCommand(timeObservation, Collections.<EObject> singletonList(event), dropTarget, viewer, new DropTimeObservationAction());
}
protected static class DropTimeConstraintAction implements IDropLinkedNodeInLifelineAction<TimeConstraint> {
+
public void drop(final TimeConstraint timeConstraint, final View compartmentView) {
- final Node timeConstraintNode = new UMLViewProvider().createTimeConstraint_15(timeConstraint, compartmentView, ViewUtil.APPEND, true,
- PreferencesHint.USE_DEFAULTS);
- if (timeConstraintNode != null) {
+ final Node timeConstraintNode = new UMLViewProvider().createTimeConstraint_15(timeConstraint, compartmentView, ViewUtil.APPEND, true, PreferencesHint.USE_DEFAULTS);
+ if(timeConstraintNode != null) {
final Bounds bounds = NotationFactory.eINSTANCE.createBounds();
bounds.setY(40);
timeConstraintNode.setLayoutConstraint(bounds);
@@ -291,10 +288,10 @@ public final class DropUtils {
}
protected static class DropDurationObservationAction implements IDropLinkedNodeInLifelineAction<DurationObservation> {
+
public void drop(final DurationObservation durationObservation, final View compartmentView) {
- final Node durationObservationNode = new UMLViewProvider().createDurationObservation_17(durationObservation, compartmentView, ViewUtil.APPEND,
- true, PreferencesHint.USE_DEFAULTS);
- if (durationObservationNode != null) {
+ final Node durationObservationNode = new UMLViewProvider().createDurationObservation_17(durationObservation, compartmentView, ViewUtil.APPEND, true, PreferencesHint.USE_DEFAULTS);
+ if(durationObservationNode != null) {
final Location loc = NotationFactory.eINSTANCE.createLocation();
loc.setX(0);
loc.setY(40);
@@ -310,10 +307,10 @@ public final class DropUtils {
}
protected static class DropDurationConstraintAction implements IDropLinkedNodeInLifelineAction<DurationConstraint> {
+
public void drop(final DurationConstraint durationConstraint, final View compartmentView) {
- final Node durationConstraintNode = new UMLViewProvider().createDurationConstraint_18(durationConstraint, compartmentView, ViewUtil.APPEND, true,
- PreferencesHint.USE_DEFAULTS);
- if (durationConstraintNode != null) {
+ final Node durationConstraintNode = new UMLViewProvider().createDurationConstraint_18(durationConstraint, compartmentView, ViewUtil.APPEND, true, PreferencesHint.USE_DEFAULTS);
+ if(durationConstraintNode != null) {
final Bounds bounds = NotationFactory.eINSTANCE.createBounds();
bounds.setY(5);
durationConstraintNode.setLayoutConstraint(bounds);
@@ -328,10 +325,10 @@ public final class DropUtils {
}
protected static class DropGeneralOrderingAction implements IDropLinkedNodeInLifelineAction<GeneralOrdering> {
+
public void drop(final GeneralOrdering generalOrdering, final View compartmentView) {
- final Node generalOrderingNode = new UMLViewProvider().createGeneralOrdering_67(generalOrdering, compartmentView, ViewUtil.APPEND, true,
- PreferencesHint.USE_DEFAULTS);
- if (generalOrderingNode != null) {
+ final Node generalOrderingNode = new UMLViewProvider().createGeneralOrdering_67(generalOrdering, compartmentView, ViewUtil.APPEND, true, PreferencesHint.USE_DEFAULTS);
+ if(generalOrderingNode != null) {
final Bounds bounds = NotationFactory.eINSTANCE.createBounds();
bounds.setY(30);
generalOrderingNode.setLayoutConstraint(bounds);
@@ -347,20 +344,21 @@ public final class DropUtils {
}
public static ICommand getDropGateCommand(final Gate gate, final View dropTarget, final EditPartViewer viewer) {
- final Node interactionView = (Node) ViewUtils.findSuperViewWithId(dropTarget, InteractionEditPartTN.VISUAL_ID);
+ final Node interactionView = (Node)ViewUtils.findSuperViewWithId(dropTarget, InteractionEditPartTN.VISUAL_ID);
// the drop must be targeted on the interaction
- if (interactionView == null || ViewUtils.containsViewFor(interactionView, gate)) {
+ if(interactionView == null || ViewUtils.containsViewFor(interactionView, gate)) {
return UnexecutableCommand.INSTANCE;
}
final TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(interactionView);
final CompositeCommand compositeCommand = new CompositeCommand(Messages.DropUtils_DropGate);
- compositeCommand.add(new CommandProxy(new RefreshCommandForUndo((GraphicalEditPart) viewer.getRootEditPart())));
+ compositeCommand.add(new CommandProxy(new RefreshCommandForUndo((GraphicalEditPart)viewer.getRootEditPart())));
compositeCommand.add(new AbstractTransactionalCommand(editingDomain, Messages.DropUtils_DropGate, null) {
+
@Override
protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
final Node gateNode = new UMLViewProvider().createGate_69(gate, interactionView, ViewUtil.APPEND, true, PreferencesHint.USE_DEFAULTS);
try {
- final int index = ((Interaction) gate.eContainer()).getFormalGates().indexOf(gate);
+ final int index = ((Interaction)gate.eContainer()).getFormalGates().indexOf(gate);
final Location loc = NotationFactory.eINSTANCE.createLocation();
// space Gates regularly (useful when dropping several Gates)
loc.setX(-10);
@@ -372,7 +370,7 @@ public final class DropUtils {
return CommandResult.newOKCommandResult();
}
});
- compositeCommand.add(new CommandProxy(new RefreshCommandForDo((GraphicalEditPart) viewer.getRootEditPart())));
+ compositeCommand.add(new CommandProxy(new RefreshCommandForDo((GraphicalEditPart)viewer.getRootEditPart())));
return compositeCommand;
}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/EcoreUtils.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/EcoreUtils.java
index cbc930b3f5c..3641c868b28 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/EcoreUtils.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/EcoreUtils.java
@@ -22,6 +22,7 @@ import org.eclipse.emf.ecore.EStructuralFeature.Setting;
import org.eclipse.emf.ecore.util.EcoreUtil;
public final class EcoreUtils {
+
private EcoreUtils() {
// utility class
}
@@ -31,15 +32,15 @@ public final class EcoreUtils {
* a subtype of original).
*
* @param original
- * the object to replace
+ * the object to replace
* @param replacement
- * the replacement object
+ * the replacement object
*/
public static void replaceEObjectInstance(final EObject original, final EObject replacement) {
final Collection<Setting> settings = EcoreUtil.UsageCrossReferencer.find(original, original.eResource().getResourceSet());
final Set<EStructuralFeature> referencingFeatures = new HashSet<EStructuralFeature>();
- for (final Setting setting : settings) {
+ for(final Setting setting : settings) {
referencingFeatures.add(setting.getEStructuralFeature());
}
@@ -47,9 +48,9 @@ public final class EcoreUtils {
copyFeatures(original, replacement, referencingFeatures);
// put the replacement object in all the referencing features of the original object
- for (final Setting setting : settings) {
+ for(final Setting setting : settings) {
final EStructuralFeature feature = setting.getEStructuralFeature();
- if (feature.isChangeable() && !feature.isDerived()) {
+ if(feature.isChangeable() && !feature.isDerived()) {
// if it is already in the list, remove it and put it at the right index
EcoreUtil.remove(setting, replacement);
// replace the original by the replacement
@@ -65,34 +66,34 @@ public final class EcoreUtils {
* Copies all the features from the source object to the target object, ignoring the referencingFeatures
*
* @param source
- * the object that will give its values to the target object
+ * the object that will give its values to the target object
* @param target
- * the object that will receive its values from the source object
+ * the object that will receive its values from the source object
* @param referencingFeatures
- * features to ignore in the copy
+ * features to ignore in the copy
*/
@SuppressWarnings({ "unchecked", "rawtypes" })
private static void copyFeatures(final EObject source, final EObject target, final Set<EStructuralFeature> referencingFeatures) {
final EList<EStructuralFeature> eAllStructuralFeatures = source.eClass().getEAllStructuralFeatures();
- for (final EStructuralFeature feature : eAllStructuralFeatures) {
- if (referencingFeatures.contains(feature)) {
+ for(final EStructuralFeature feature : eAllStructuralFeatures) {
+ if(referencingFeatures.contains(feature)) {
// the value will be set through the object referencing the "from" object
continue;
}
- if (feature instanceof EReference) {
- final EReference reference = (EReference) feature;
- if (reference.isContainer()) {
+ if(feature instanceof EReference) {
+ final EReference reference = (EReference)feature;
+ if(reference.isContainer()) {
// the container will be set at the end
continue;
}
}
- if (feature.isChangeable() && !feature.isDerived()) {
- if (feature.isMany()) {
+ if(feature.isChangeable() && !feature.isDerived()) {
+ if(feature.isMany()) {
final Object result = source.eGet(feature);
- if (result instanceof List<?>) {
- final List list1 = (List) result;
- final List list2 = (List) target.eGet(feature);
+ if(result instanceof List<?>) {
+ final List list1 = (List)result;
+ final List list2 = (List)target.eGet(feature);
list2.addAll(list1);
}
} else {
@@ -107,17 +108,17 @@ public final class EcoreUtils {
* Return the first element in the container hierarchy of the given element that is of the given class.
*
* @param element
- * the starting point
+ * the starting point
* @param clazz
- * the class of the parent that is searched
+ * the class of the parent that is searched
* @return the first containing element of the given class, or <code>null</code> if none
*/
@SuppressWarnings("unchecked")
public static <T> T getContaining(final EObject element, final Class<T> clazz) {
EObject container = element;
- while (container != null) {
- if (clazz.isInstance(container)) {
- return (T) container;
+ while(container != null) {
+ if(clazz.isInstance(container)) {
+ return (T)container;
}
container = container.eContainer();
}
@@ -126,10 +127,10 @@ public final class EcoreUtils {
public static EStructuralFeature getEStructuralFeature(final Object notification) {
EStructuralFeature featureImpl = null;
- if (notification instanceof Notification) {
- final Object feature = ((Notification) notification).getFeature();
- if (feature instanceof EStructuralFeature) {
- featureImpl = (EStructuralFeature) feature;
+ if(notification instanceof Notification) {
+ final Object feature = ((Notification)notification).getFeature();
+ if(feature instanceof EStructuralFeature) {
+ featureImpl = (EStructuralFeature)feature;
}
}
return featureImpl;
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/EditPartUtils.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/EditPartUtils.java
index 207f59a0415..08242a8b577 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/EditPartUtils.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/EditPartUtils.java
@@ -30,7 +30,7 @@ public class EditPartUtils {
public static EditPart findFirstChildEditPartWithId(final EditPart editPart, final int visualId) {
final List<? extends EditPart> result = findChildEditPartsWithId(editPart, visualId);
- if (result.isEmpty()) {
+ if(result.isEmpty()) {
return null;
}
return result.get(0);
@@ -44,26 +44,26 @@ public class EditPartUtils {
private static void internalFindChildEditPartsWithId(final EditPart editPart, final int visualId, final List<EditPart> result) {
final Object model = editPart.getModel();
- if (model instanceof View) {
- final View view = (View) model;
- if (UMLVisualIDRegistry.getVisualID(view) == visualId) {
+ if(model instanceof View) {
+ final View view = (View)model;
+ if(UMLVisualIDRegistry.getVisualID(view) == visualId) {
result.add(editPart);
}
}
@SuppressWarnings("unchecked")
final List<EditPart> children = editPart.getChildren();
- for (final EditPart child : children) {
+ for(final EditPart child : children) {
internalFindChildEditPartsWithId(child, visualId, result);
}
}
public static EditPart findParentEditPartWithId(final EditPart editPart, final int visualId) {
EditPart parent = editPart;
- while (parent != null) {
+ while(parent != null) {
final Object model = parent.getModel();
- if (model instanceof View) {
- final View parentView = (View) model;
- if (UMLVisualIDRegistry.getVisualID(parentView) == visualId) {
+ if(model instanceof View) {
+ final View parentView = (View)model;
+ if(UMLVisualIDRegistry.getVisualID(parentView) == visualId) {
return parent;
}
parent = parent.getParent();
@@ -78,18 +78,18 @@ public class EditPartUtils {
* Find the EditPart whose Figure is closest to the given y-coordinate.
*
* @param ordinate
- * the y-coordinate
+ * the y-coordinate
* @param editParts
- * the EditParts among which to choose
+ * the EditParts among which to choose
* @return the EditPart closest to the given vertical coordinate
*/
public static GraphicalEditPart findEditPartClosestToOrdinate(final int ordinate, final List<? extends GraphicalEditPart> editParts) {
- if (editParts.isEmpty()) {
+ if(editParts.isEmpty()) {
return null;
}
final TreeMap<Integer, GraphicalEditPart> distanceMap = new TreeMap<Integer, GraphicalEditPart>();
- for (final GraphicalEditPart editPart : editParts) {
+ for(final GraphicalEditPart editPart : editParts) {
final IFigure figure = editPart.getFigure();
final Rectangle bounds = new Rectangle(figure.getBounds());
figure.getParent().translateToAbsolute(bounds);
@@ -103,26 +103,24 @@ public class EditPartUtils {
public static boolean isEditPartFor(final EditPart editPart, final EClass... eClasses) {
final Object model = editPart.getModel();
- if (model instanceof View) {
- final View view = (View) model;
+ if(model instanceof View) {
+ final View view = (View)model;
return ViewUtils.isViewFor(view, eClasses);
}
return false;
}
public static CompartmentEditPart findParentTimelineCompartment(final EditPart editPart) {
- CompartmentEditPart compartmentEditPart = (FullLifelineTimelineCompartmentEditPartCN) EditPartUtils.findParentEditPartWithId(editPart,
- FullLifelineTimelineCompartmentEditPartCN.VISUAL_ID);
- if (compartmentEditPart == null) {
- compartmentEditPart = (CompactLifelineCompartmentEditPartCN) EditPartUtils.findParentEditPartWithId(editPart,
- CompactLifelineCompartmentEditPartCN.VISUAL_ID);
+ CompartmentEditPart compartmentEditPart = (FullLifelineTimelineCompartmentEditPartCN)EditPartUtils.findParentEditPartWithId(editPart, FullLifelineTimelineCompartmentEditPartCN.VISUAL_ID);
+ if(compartmentEditPart == null) {
+ compartmentEditPart = (CompactLifelineCompartmentEditPartCN)EditPartUtils.findParentEditPartWithId(editPart, CompactLifelineCompartmentEditPartCN.VISUAL_ID);
}
return compartmentEditPart;
}
/** Reveals the given EditPart in its viewer */
public static void revealEditPart(final EditPart editPart) {
- if (editPart != null && editPart.getViewer() != null) {
+ if(editPart != null && editPart.getViewer() != null) {
editPart.getViewer().reveal(editPart);
}
}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/FigureUtils.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/FigureUtils.java
index a62097cf2ca..6a8a7a07157 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/FigureUtils.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/FigureUtils.java
@@ -31,23 +31,23 @@ public final class FigureUtils {
* Returns a child figure of the given type recursively contained in the given parent figure.
*
* @param parent
- * the parent figure
+ * the parent figure
* @param childFigureClass
- * the type of the child figure that is looked for
+ * the type of the child figure that is looked for
* @return the child figure if found, or <code>null</code> if the parent figure contains no child figure of the
* given type
*/
@SuppressWarnings("unchecked")
public static <T extends IFigure> T findChildFigureInstance(final IFigure parent, final Class<T> childFigureClass) {
final List<IFigure> children = parent.getChildren();
- for (final IFigure child : children) {
- if (childFigureClass.isAssignableFrom(child.getClass())) {
- return (T) child;
+ for(final IFigure child : children) {
+ if(childFigureClass.isAssignableFrom(child.getClass())) {
+ return (T)child;
}
// look recursively
final IFigure subresult = findChildFigureInstance(child, childFigureClass);
- if (subresult != null) {
- return (T) subresult;
+ if(subresult != null) {
+ return (T)subresult;
}
}
// not found
@@ -63,9 +63,9 @@ public final class FigureUtils {
@SuppressWarnings("unchecked")
public static <T extends IFigure> void internalFindChildFigureInstances(final IFigure parent, final List<T> result, final Class<T> childFigureClass) {
final List<IFigure> children = parent.getChildren();
- for (final IFigure child : children) {
- if (childFigureClass.isAssignableFrom(child.getClass())) {
- result.add((T) child);
+ for(final IFigure child : children) {
+ if(childFigureClass.isAssignableFrom(child.getClass())) {
+ result.add((T)child);
} else {
internalFindChildFigureInstances(child, result, childFigureClass);
}
@@ -77,18 +77,18 @@ public final class FigureUtils {
* Returns the first parent figure of the given type recursively containing the given figure.
*
* @param figure
- * the figure
+ * the figure
* @param parentFigureClass
- * the type of the parent figure that is looked for
+ * the type of the parent figure that is looked for
* @return the parent figure if found, or <code>null</code> if the figure is not contained by any figure of the
* given type
*/
@SuppressWarnings("unchecked")
public static <T extends IFigure> T findParentFigureInstance(final IFigure figure, final Class<T> parentFigureClass) {
IFigure parent = figure.getParent();
- while (parent != null) {
- if (parentFigureClass.isAssignableFrom(parent.getClass())) {
- return (T) parent;
+ while(parent != null) {
+ if(parentFigureClass.isAssignableFrom(parent.getClass())) {
+ return (T)parent;
}
parent = parent.getParent();
}
@@ -98,13 +98,12 @@ public final class FigureUtils {
/**
* Constrain the given bounds (whose presumed purpose is to become the new bounds for the given Figure), so that
* they don't stick out of the bounds of the {@link ResizableCompartmentFigure} in which the given figure is
- * contained. Returns the original bounds if the given Figure is not contained in a
- * {@link ResizableCompartmentFigure}.
+ * contained. Returns the original bounds if the given Figure is not contained in a {@link ResizableCompartmentFigure}.
*
* @param bounds
- * The bounds to constrain (will not be modified)
+ * The bounds to constrain (will not be modified)
* @param figure
- * the figure in the containing {@link ResizableCompartmentFigure} of which the bound must be constrained
+ * the figure in the containing {@link ResizableCompartmentFigure} of which the bound must be constrained
* @return the bounds, constrained so that they don't stick out of the {@link ResizableCompartmentFigure} in which
* the Figure is contained
*
@@ -112,7 +111,7 @@ public final class FigureUtils {
public static Rectangle constrainBoundsWithinContainingCompartment(final Rectangle bounds, final IFigure figure) {
final Rectangle result = new Rectangle(bounds);
final ResizableCompartmentFigure parentCompartment = FigureUtils.findParentFigureInstance(figure, ResizableCompartmentFigure.class);
- if (parentCompartment == null) {
+ if(parentCompartment == null) {
return result;
}
final Rectangle parentBounds = parentCompartment.getBounds();
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/GateUtils.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/GateUtils.java
index e317c696b1c..b33808d68c5 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/GateUtils.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/GateUtils.java
@@ -28,16 +28,15 @@ public final class GateUtils {
* Get all elements to delete when deleting a Gate.
*
* @param gate
- * the Gate being deleted
+ * the Gate being deleted
* @return the elements (EObjects and Views) that should be deleted together with the Gate
*/
public static Collection<EObject> getElementsToDelete(final Gate gate) {
final Set<EObject> elementsToDestroy = new HashSet<EObject>();
final Collection<Setting> settings = EcoreUtil.UsageCrossReferencer.find(gate, gate.eResource().getResourceSet());
- for (final Setting setting : settings) {
+ for(final Setting setting : settings) {
// delete messages originating from or going to that gate
- if (setting.getEStructuralFeature() == UMLPackage.eINSTANCE.getMessage_SendEvent()
- || setting.getEStructuralFeature() == UMLPackage.eINSTANCE.getMessage_ReceiveEvent()) {
+ if(setting.getEStructuralFeature() == UMLPackage.eINSTANCE.getMessage_SendEvent() || setting.getEStructuralFeature() == UMLPackage.eINSTANCE.getMessage_ReceiveEvent()) {
elementsToDestroy.add(setting.getEObject());
}
}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/GeneralOrderingUtils.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/GeneralOrderingUtils.java
index 1212eea38a7..52bdaa62171 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/GeneralOrderingUtils.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/GeneralOrderingUtils.java
@@ -19,6 +19,7 @@ import org.eclipse.uml2.uml.GeneralOrdering;
import org.eclipse.uml2.uml.UMLPackage;
public final class GeneralOrderingUtils {
+
private GeneralOrderingUtils() {
// utility class
}
@@ -35,17 +36,16 @@ public final class GeneralOrderingUtils {
* Find {@link GeneralOrdering}s linked to the given element.
*
* @param element
- * the element for which related {@link GeneralOrdering}s must be found
+ * the element for which related {@link GeneralOrdering}s must be found
* @param hideOnly
- * whether to only return Views
+ * whether to only return Views
* @param expectedParentView
- * if not <code>null</code>, then only return Views under this parent View
+ * if not <code>null</code>, then only return Views under this parent View
* @return the list of linked {@link GeneralOrdering}s to remove
*/
- public static Collection<? extends EObject> getReferencingGeneralOrderingsToRemove(final EObject element, final boolean hideOnly,
- final View expectedParentView) {
- final EReference[] references = new EReference[] { UMLPackage.eINSTANCE.getGeneralOrdering_Before(), UMLPackage.eINSTANCE.getGeneralOrdering_After() };
- final Class<?>[] expectedClasses = new Class<?>[] { GeneralOrdering.class };
+ public static Collection<? extends EObject> getReferencingGeneralOrderingsToRemove(final EObject element, final boolean hideOnly, final View expectedParentView) {
+ final EReference[] references = new EReference[]{ UMLPackage.eINSTANCE.getGeneralOrdering_Before(), UMLPackage.eINSTANCE.getGeneralOrdering_After() };
+ final Class<?>[] expectedClasses = new Class<?>[]{ GeneralOrdering.class };
return Utils.getReferencingElementsToRemove(element, references, hideOnly, expectedParentView, expectedClasses);
}
}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/InteractionUtils.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/InteractionUtils.java
index 47411ed8c7e..b86ced34994 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/InteractionUtils.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/InteractionUtils.java
@@ -23,13 +23,13 @@ public final class InteractionUtils {
* not recursively contained in any {@link Interaction}.
*
* @param eObject
- * the model element for which we want to find the containing {@link Interaction}.
+ * the model element for which we want to find the containing {@link Interaction}.
* @return the parent {@link Interaction} or <code>null</code> if none.
*/
public static Interaction getContainingInteraction(final EObject eObject) {
- if (eObject != null) {
- if (eObject instanceof Interaction) {
- return (Interaction) eObject;
+ if(eObject != null) {
+ if(eObject instanceof Interaction) {
+ return (Interaction)eObject;
}
final EObject eContainer = eObject.eContainer();
return getContainingInteraction(eContainer);
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/LifelineUtils.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/LifelineUtils.java
index b14d9b6e751..596aa93f874 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/LifelineUtils.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/LifelineUtils.java
@@ -39,7 +39,6 @@ import org.eclipse.papyrus.uml.diagram.timing.edit.parts.FullLifelineEditPartCN;
import org.eclipse.papyrus.uml.diagram.timing.edit.parts.FullLifelineTimelineCompartmentEditPartCN;
import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimingDiagramEditPart;
import org.eclipse.papyrus.uml.diagram.timing.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.uml.diagram.timing.providers.UMLViewProvider;
import org.eclipse.uml2.uml.InteractionFragment;
import org.eclipse.uml2.uml.Lifeline;
import org.eclipse.uml2.uml.OccurrenceSpecification;
@@ -54,6 +53,7 @@ public final class LifelineUtils {
/** The key for the EAnnotation on a Lifeline that indicates whether the Lifeline is a compact or full lifeline */
private static final String LIFELINE_ANNOTATION = "org.eclipse.papyrus.uml.diagram.timing.lifeline"; //$NON-NLS-1$
+
private static final String LIFELINE_TYPE = "type"; //$NON-NLS-1$
private LifelineUtils() {
@@ -64,14 +64,14 @@ public final class LifelineUtils {
* Get the type of the given lifeline
*
* @param lifeline
- * the lifeline whose type to get
+ * the lifeline whose type to get
* @return the type
*/
public static LifelineType getLifelineType(final Lifeline lifeline) {
final EAnnotation eAnnotation = lifeline.getEAnnotation(LIFELINE_ANNOTATION);
- if (eAnnotation != null) {
+ if(eAnnotation != null) {
final String type = eAnnotation.getDetails().get(LIFELINE_TYPE);
- if (type != null) {
+ if(type != null) {
return LifelineType.valueOf(type);
}
}
@@ -80,17 +80,17 @@ public final class LifelineUtils {
}
/**
- * Set the type of the given lifeline (between compact and full) using an annotation. This is needed in order to let
- * {@link UMLViewProvider} choose the right view depending on this annotation.
+ * Set the type of the given lifeline (between compact and full) using an annotation. This is needed in order to let {@link UMLViewProvider}
+ * choose the right view depending on this annotation.
*
* @param lifeline
- * the lifeline whose type to set
+ * the lifeline whose type to set
* @param lifelineType
- * the type to set
+ * the type to set
*/
public static void setLifelineType(final Lifeline lifeline, final LifelineType lifelineType) {
EAnnotation eAnnotation = lifeline.getEAnnotation(LIFELINE_ANNOTATION);
- if (eAnnotation == null) {
+ if(eAnnotation == null) {
eAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
eAnnotation.setSource(LIFELINE_ANNOTATION);
lifeline.getEAnnotations().add(eAnnotation);
@@ -104,14 +104,14 @@ public final class LifelineUtils {
* indicate a state change have a name that indicates their incoming and outgoing state.
*
* @param lifeline
- * the Lifeline to update
+ * the Lifeline to update
* @param lifelineView
- * the Lifeline's view, containing the StateDefinitions (ignored for a Compact lifeline)
+ * the Lifeline's view, containing the StateDefinitions (ignored for a Compact lifeline)
*/
@SuppressWarnings("boxing")
public static void updateFragmentNames(final Lifeline lifeline, final View lifelineView) {
View fullLifelineView = lifelineView;
- if (lifelineView != null && !Integer.toString(FullLifelineEditPartCN.VISUAL_ID).equals(lifelineView.getType())) {
+ if(lifelineView != null && !Integer.toString(FullLifelineEditPartCN.VISUAL_ID).equals(lifelineView.getType())) {
fullLifelineView = null;
}
final Map<String, Integer> stateInvariantCounts = new HashMap<String, Integer>();
@@ -119,13 +119,13 @@ public final class LifelineUtils {
final Map<StateInvariant, String> stateInvariantNames = new HashMap<StateInvariant, String>();
// first, handle StateInvariant names
- for (int i = 0; i < fragments.size(); i++) {
+ for(int i = 0; i < fragments.size(); i++) {
final InteractionFragment interactionFragment = fragments.get(i);
- if (interactionFragment instanceof StateInvariant) {
- final StateInvariant stateInvariant = (StateInvariant) interactionFragment;
+ if(interactionFragment instanceof StateInvariant) {
+ final StateInvariant stateInvariant = (StateInvariant)interactionFragment;
final String stateInvariantId = StateInvariantUtils.getStateInvariantId(stateInvariant);
final String baseStateInvariantName;
- if (stateInvariantId != null && fullLifelineView != null) {
+ if(stateInvariantId != null && fullLifelineView != null) {
// in a full lifeline,
final View stateDefinitionView = StateDefinitionUtils.getStateDefinitionViewWithId(stateInvariantId, fullLifelineView);
baseStateInvariantName = StateDefinitionUtils.getStateDefinitionName(stateDefinitionView);
@@ -135,11 +135,11 @@ public final class LifelineUtils {
baseStateInvariantName = StateInvariantUtils.getInnerStateInvariantName(stateInvariant);
}
- if (baseStateInvariantName == null) {
+ if(baseStateInvariantName == null) {
continue;
}
Integer count = stateInvariantCounts.get(baseStateInvariantName);
- if (count == null) {
+ if(count == null) {
count = 0;
}
count++;
@@ -155,21 +155,21 @@ public final class LifelineUtils {
// start at 1 and end at (size - 1) since we only care about OccurrenceSpecifications that
// appear between StateInvariants
final int nFragments = fragments.size();
- for (int i = 0; i < nFragments; i++) {
+ for(int i = 0; i < nFragments; i++) {
final InteractionFragment interactionFragment = fragments.get(i);
- if (interactionFragment instanceof OccurrenceSpecification) {
- final OccurrenceSpecification occurrenceSpecification = (OccurrenceSpecification) interactionFragment;
+ if(interactionFragment instanceof OccurrenceSpecification) {
+ final OccurrenceSpecification occurrenceSpecification = (OccurrenceSpecification)interactionFragment;
// don't override user modifications
- if (!OccurrenceSpecificationUtils.isAutogeneratedName(occurrenceSpecification)) {
+ if(!OccurrenceSpecificationUtils.isAutogeneratedName(occurrenceSpecification)) {
continue;
}
- if (i == 0) {
+ if(i == 0) {
// first fragment is an occurrence => creation
occurrenceSpecification.setName(Messages.LifelineUtils_CreationOccurrence);
continue;
}
- if (i == nFragments - 1) {
+ if(i == nFragments - 1) {
// last fragment is an occurrence => destruction
occurrenceSpecification.setName(Messages.LifelineUtils_DestructionOccurrence);
continue;
@@ -177,17 +177,17 @@ public final class LifelineUtils {
final InteractionFragment previous = fragments.get(i - 1);
final InteractionFragment next = fragments.get(i + 1);
- if (!(previous instanceof StateInvariant) || !(next instanceof StateInvariant)) {
+ if(!(previous instanceof StateInvariant) || !(next instanceof StateInvariant)) {
continue;
}
- final StateInvariant precedingStateInvariant = (StateInvariant) previous;
- final StateInvariant followingStateInvariant = (StateInvariant) next;
+ final StateInvariant precedingStateInvariant = (StateInvariant)previous;
+ final StateInvariant followingStateInvariant = (StateInvariant)next;
String previousName = stateInvariantNames.get(precedingStateInvariant);
String followingName = stateInvariantNames.get(followingStateInvariant);
- if (previousName == null) {
+ if(previousName == null) {
previousName = "<unnamed>"; //$NON-NLS-1$
}
- if (followingName == null) {
+ if(followingName == null) {
followingName = "<unnamed>"; //$NON-NLS-1$
}
occurrenceSpecification.setName(previousName + "_To_" + followingName); //$NON-NLS-1$
@@ -200,37 +200,38 @@ public final class LifelineUtils {
* element.
*
* @param element
- * an element contained in a Lifeline
+ * an element contained in a Lifeline
* @return a command to update the names of Lifeline fragments
*/
public static IUndoableOperation getUpdateFragmentNamesCommand(final EObject element) {
final Set<View> impactedLifelines = new HashSet<View>();
final Set<View> crossReferencingViews = CrossReferencerUtil.getCrossReferencingViews(element, TimingDiagramEditPart.MODEL_ID);
- for (final View referencingView : crossReferencingViews) {
+ for(final View referencingView : crossReferencingViews) {
View lifeline = ViewUtils.findSuperViewWithId(referencingView, FullLifelineEditPartCN.VISUAL_ID);
- if (lifeline == null) {
+ if(lifeline == null) {
lifeline = ViewUtils.findSuperViewWithId(referencingView, CompactLifelineEditPartCN.VISUAL_ID);
}
- if (lifeline != null) {
+ if(lifeline != null) {
impactedLifelines.add(lifeline);
}
}
- if (impactedLifelines.isEmpty()) {
+ if(impactedLifelines.isEmpty()) {
return null;
}
final CompositeCommand compositeCommand = new CompositeCommand(Messages.LifelineUtils_UpdateFragmentNames);
// update fragment names
- for (final View lifelineView : impactedLifelines) {
+ for(final View lifelineView : impactedLifelines) {
Assert.isLegal(lifelineView.getElement() instanceof Lifeline);
final TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(lifelineView);
compositeCommand.add(new AbstractTransactionalCommand(editingDomain, Messages.LifelineUtils_UpdateLifelineFragmentNames, null) {
+
@Override
protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
final EObject element = lifelineView.getElement();
// note: the element becomes the Interaction when the Lifeline is deleted
- if (element instanceof Lifeline) {
- final Lifeline lifeline = (Lifeline) element;
+ if(element instanceof Lifeline) {
+ final Lifeline lifeline = (Lifeline)element;
updateFragmentNames(lifeline, lifelineView);
}
return CommandResult.newOKCommandResult();
@@ -255,12 +256,12 @@ public final class LifelineUtils {
public static EditPart getLifelineCompartment(final EditPart lifelineEditPart) {
EditPart compartment;
- if (lifelineEditPart instanceof FullLifelineEditPartCN) {
+ if(lifelineEditPart instanceof FullLifelineEditPartCN) {
compartment = EditPartUtils.findFirstChildEditPartWithId(lifelineEditPart, FullLifelineTimelineCompartmentEditPartCN.VISUAL_ID);
} else {
compartment = EditPartUtils.findFirstChildEditPartWithId(lifelineEditPart, CompactLifelineCompartmentEditPartCN.VISUAL_ID);
}
- if (compartment == null) {
+ if(compartment == null) {
throw new IllegalStateException("No compartment in Lifeline"); //$NON-NLS-1$
}
return compartment;
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/MessageUtils.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/MessageUtils.java
index 28290d1f0ed..92db529d3ff 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/MessageUtils.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/MessageUtils.java
@@ -69,8 +69,11 @@ import org.eclipse.uml2.uml.UMLPackage;
public final class MessageUtils {
private static final String MESSAGE_CONNECTOR_LOCATION = "messageConnectorLocation"; //$NON-NLS-1$
+
private static final String START_LOCATION = "startLocation"; //$NON-NLS-1$
+
private static final String X = "x"; //$NON-NLS-1$
+
private static final String Y = "y"; //$NON-NLS-1$
/** Used for feedback when drawing a MessageFound */
@@ -81,50 +84,43 @@ public final class MessageUtils {
}
public static boolean isMessage(final IElementType requestElementType) {
- return requestElementType == UMLElementTypes.Message_3 || requestElementType == UMLElementTypes.Message_4
- || requestElementType == UMLElementTypes.Message_41 || requestElementType == UMLElementTypes.Message_44
- || requestElementType == UMLElementTypes.Message_47 || requestElementType == UMLElementTypes.Message_50
- || requestElementType == UMLElementTypes.Message_53;
+ return requestElementType == UMLElementTypes.Message_3 || requestElementType == UMLElementTypes.Message_4 || requestElementType == UMLElementTypes.Message_41 || requestElementType == UMLElementTypes.Message_44 || requestElementType == UMLElementTypes.Message_47 || requestElementType == UMLElementTypes.Message_50 || requestElementType == UMLElementTypes.Message_53;
}
public static boolean isMessage(final int visualID) {
- return visualID == MessageSyncEditPart.VISUAL_ID || visualID == MessageAsyncEditPart.VISUAL_ID || visualID == MessageReplyEditPart.VISUAL_ID
- || visualID == MessageCreateEditPart.VISUAL_ID || visualID == MessageDeleteEditPart.VISUAL_ID || visualID == MessageFoundEditPart.VISUAL_ID
- || visualID == MessageLostEditPart.VISUAL_ID;
+ return visualID == MessageSyncEditPart.VISUAL_ID || visualID == MessageAsyncEditPart.VISUAL_ID || visualID == MessageReplyEditPart.VISUAL_ID || visualID == MessageCreateEditPart.VISUAL_ID || visualID == MessageDeleteEditPart.VISUAL_ID || visualID == MessageFoundEditPart.VISUAL_ID || visualID == MessageLostEditPart.VISUAL_ID;
}
public static MessageKind getMessageKind(final IElementType requestElementType) {
- if (requestElementType == UMLElementTypes.Message_3 || requestElementType == UMLElementTypes.Message_4
- || requestElementType == UMLElementTypes.Message_41 || requestElementType == UMLElementTypes.Message_44
- || requestElementType == UMLElementTypes.Message_47) {
+ if(requestElementType == UMLElementTypes.Message_3 || requestElementType == UMLElementTypes.Message_4 || requestElementType == UMLElementTypes.Message_41 || requestElementType == UMLElementTypes.Message_44 || requestElementType == UMLElementTypes.Message_47) {
return MessageKind.UNKNOWN_LITERAL;
}
- if (requestElementType == UMLElementTypes.Message_50) {
+ if(requestElementType == UMLElementTypes.Message_50) {
return MessageKind.LOST_LITERAL;
}
- if (requestElementType == UMLElementTypes.Message_53) {
+ if(requestElementType == UMLElementTypes.Message_53) {
return MessageKind.FOUND_LITERAL;
}
return null;
}
public static MessageSort getMessageSort(final IElementType requestElementType) {
- if (requestElementType == UMLElementTypes.Message_3) {
+ if(requestElementType == UMLElementTypes.Message_3) {
return MessageSort.SYNCH_CALL_LITERAL;
}
- if (requestElementType == UMLElementTypes.Message_4) {
+ if(requestElementType == UMLElementTypes.Message_4) {
return MessageSort.ASYNCH_CALL_LITERAL;
}
- if (requestElementType == UMLElementTypes.Message_41) {
+ if(requestElementType == UMLElementTypes.Message_41) {
return MessageSort.REPLY_LITERAL;
}
- if (requestElementType == UMLElementTypes.Message_44) {
+ if(requestElementType == UMLElementTypes.Message_44) {
return MessageSort.CREATE_MESSAGE_LITERAL;
}
- if (requestElementType == UMLElementTypes.Message_47) {
+ if(requestElementType == UMLElementTypes.Message_47) {
return MessageSort.DELETE_MESSAGE_LITERAL;
}
- if (requestElementType == UMLElementTypes.Message_50 || requestElementType == UMLElementTypes.Message_53) {
+ if(requestElementType == UMLElementTypes.Message_50 || requestElementType == UMLElementTypes.Message_53) {
// lost or found message
return MessageSort.SYNCH_CALL_LITERAL;
}
@@ -132,7 +128,7 @@ public final class MessageUtils {
}
public static IElementType getElementType(final Message message) {
- switch (message.getMessageKind()) {
+ switch(message.getMessageKind()) {
case LOST_LITERAL:
return UMLElementTypes.Message_50;
case FOUND_LITERAL:
@@ -140,7 +136,7 @@ public final class MessageUtils {
default:
}
- switch (message.getMessageSort()) {
+ switch(message.getMessageSort()) {
case SYNCH_CALL_LITERAL:
return UMLElementTypes.Message_3;
case ASYNCH_CALL_LITERAL:
@@ -160,20 +156,19 @@ public final class MessageUtils {
* Create a command to move a FloatingMessageAnchor, by changing the EAnnotation stored on the Connector.
*
* @param request
- * the request that contains the new Location
+ * the request that contains the new Location
* @param connectionEditPart
- * the EditPart for the connector
+ * the EditPart for the connector
* @param referenceFigure
- * the figure to which the anchor is relative
+ * the figure to which the anchor is relative
* @param commandName
- * a name for the command
+ * a name for the command
* @param editingDomain
- * the editing domain
+ * the editing domain
* @return the command to move the anchor
*/
- public static Command createMoveMessageAnchorCommand(final LocationRequest request, final ConnectionEditPart connectionEditPart,
- final IFigure referenceFigure, final String commandName, final TransactionalEditingDomain editingDomain) {
- final Connector connector = (Connector) connectionEditPart.getModel();
+ public static Command createMoveMessageAnchorCommand(final LocationRequest request, final ConnectionEditPart connectionEditPart, final IFigure referenceFigure, final String commandName, final TransactionalEditingDomain editingDomain) {
+ final Connector connector = (Connector)connectionEditPart.getModel();
final Point location = request.getLocation();
final Point figureLocation = new Point(referenceFigure.getBounds().getCenter());
referenceFigure.getParent().translateToAbsolute(figureLocation);
@@ -183,6 +178,7 @@ public final class MessageUtils {
final CompoundCommand compoundCommand = new CompoundCommand();
compoundCommand.add(new RefreshCommandForUndo(connectionEditPart));
compoundCommand.add(new ICommandProxy(new AbstractTransactionalCommand(editingDomain, commandName, null) {
+
@Override
protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
setMessageConnectorLocation(connector, anchorLocation);
@@ -195,7 +191,7 @@ public final class MessageUtils {
public static void setMessageConnectorLocation(final Connector connector, final Point location) {
EAnnotation eAnnotation = connector.getEAnnotation(MESSAGE_CONNECTOR_LOCATION);
- if (eAnnotation == null) {
+ if(eAnnotation == null) {
eAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
eAnnotation.setSource(MESSAGE_CONNECTOR_LOCATION);
connector.getEAnnotations().add(eAnnotation);
@@ -206,9 +202,9 @@ public final class MessageUtils {
public static Point getMessageConnectorLocation(final ConnectionEditPart connectionEditPart) {
final double scale = FigureUtils.getScale(connectionEditPart.getFigure());
- final Connector connector = (Connector) connectionEditPart.getModel();
+ final Connector connector = (Connector)connectionEditPart.getModel();
final EAnnotation eAnnotation = connector.getEAnnotation(MESSAGE_CONNECTOR_LOCATION);
- if (eAnnotation != null) {
+ if(eAnnotation != null) {
return new Point(Integer.parseInt(eAnnotation.getDetails().get(X)), Integer.parseInt(eAnnotation.getDetails().get(Y))).scale(scale);
}
return null;
@@ -225,7 +221,7 @@ public final class MessageUtils {
public static Point retrieveRequestStartLocation(final CreateRequest request) {
@SuppressWarnings("unchecked")
final Map<Object, Object> extendedData = request.getExtendedData();
- return (Point) extendedData.get(START_LOCATION);
+ return (Point)extendedData.get(START_LOCATION);
}
public static Point getLastStartLocation() {
@@ -236,16 +232,16 @@ public final class MessageUtils {
* Find {@link Message}s linked to the given element.
*
* @param element
- * the element for which related {@link Message}s must be found
+ * the element for which related {@link Message}s must be found
* @param hideOnly
- * whether to only return Views
+ * whether to only return Views
* @param expectedParentView
- * if not <code>null</code>, then only return Views under this parent View
+ * if not <code>null</code>, then only return Views under this parent View
* @return the list of linked {@link Message}s to remove
*/
public static Collection<? extends EObject> getReferencingMessagesToRemove(final EObject element, final boolean hideOnly, final View expectedParentView) {
- final EReference[] references = new EReference[] { UMLPackage.eINSTANCE.getMessage_ReceiveEvent(), UMLPackage.eINSTANCE.getMessage_SendEvent() };
- final Class<?>[] expectedClasses = new Class<?>[] { Message.class };
+ final EReference[] references = new EReference[]{ UMLPackage.eINSTANCE.getMessage_ReceiveEvent(), UMLPackage.eINSTANCE.getMessage_SendEvent() };
+ final Class<?>[] expectedClasses = new Class<?>[]{ Message.class };
return Utils.getReferencingElementsToRemove(element, references, hideOnly, expectedParentView, expectedClasses);
}
@@ -257,32 +253,30 @@ public final class MessageUtils {
*/
public static MessageEnd convertToMessageOccurrenceSpecification(final EObject element, final boolean destruction) {
// destruction => DestructionOccurrenceSpecification
- if (element instanceof MessageEnd && !destruction || element instanceof DestructionOccurrenceSpecification) {
- return (MessageEnd) element;
+ if(element instanceof MessageEnd && !destruction || element instanceof DestructionOccurrenceSpecification) {
+ return (MessageEnd)element;
}
- if (element instanceof OccurrenceSpecification) {
+ if(element instanceof OccurrenceSpecification) {
// convert OccurrenceSpecification to MessageOccurrenceSpecification (or its subtype
// DestructionOccurrenceSpecification if destruction is true)
- final OccurrenceSpecification occurrenceSpecification = (OccurrenceSpecification) element;
+ final OccurrenceSpecification occurrenceSpecification = (OccurrenceSpecification)element;
final boolean autogeneratedName = OccurrenceSpecificationUtils.isAutogeneratedName(occurrenceSpecification);
final Set<View> views = CrossReferencerUtil.getCrossReferencingViews(occurrenceSpecification, TimingDiagramEditPart.MODEL_ID);
- final MessageOccurrenceSpecification messageOccurrenceSpecification = destruction ? UMLFactory.eINSTANCE.createDestructionOccurrenceSpecification()
- : UMLFactory.eINSTANCE.createMessageOccurrenceSpecification();
+ final MessageOccurrenceSpecification messageOccurrenceSpecification = destruction ? UMLFactory.eINSTANCE.createDestructionOccurrenceSpecification() : UMLFactory.eINSTANCE.createMessageOccurrenceSpecification();
// "autogenerated" EAnnotation is transferred on "do", but is lost on "redo" unless we set it explicitly
OccurrenceSpecificationUtils.setAutogeneratedName(messageOccurrenceSpecification, autogeneratedName);
EcoreUtils.replaceEObjectInstance(occurrenceSpecification, messageOccurrenceSpecification);
// update the type of each View (the element has already been updated at this point)
- for (final View view : views) {
+ for(final View view : views) {
final int type = UMLVisualIDRegistry.getVisualID(view);
- if (!OccurrenceSpecificationUtils.isOccurrenceSpecificationEditPart(type)) {
+ if(!OccurrenceSpecificationUtils.isOccurrenceSpecificationEditPart(type)) {
continue;
}
- view.setType(Integer.toString(destruction ? DestructionOccurrenceSpecificationEditPartCN.VISUAL_ID
- : MessageOccurrenceSpecificationEditPartCN.VISUAL_ID));
+ view.setType(Integer.toString(destruction ? DestructionOccurrenceSpecificationEditPartCN.VISUAL_ID : MessageOccurrenceSpecificationEditPartCN.VISUAL_ID));
/*
* The element must be updated manually here, because since BasicDecorationNodeImpl#getElement changes
* the element without changing the "set" flag, the UsageCrossReferencer used above doesn't consider the
@@ -291,12 +285,11 @@ public final class MessageUtils {
*/
@SuppressWarnings("unchecked")
final List<View> children = new ArrayList<View>(view.getChildren());
- for (final View childView : children) {
+ for(final View childView : children) {
final int childType = UMLVisualIDRegistry.getVisualID(childView);
- if (OccurrenceSpecificationLabelEditPart.VISUAL_ID == childType || MessageOccurrenceSpecificationLabelEditPart.VISUAL_ID == childType) {
+ if(OccurrenceSpecificationLabelEditPart.VISUAL_ID == childType || MessageOccurrenceSpecificationLabelEditPart.VISUAL_ID == childType) {
childView.setElement(messageOccurrenceSpecification);
- childView.setType(Integer.toString(destruction ? DestructionOccurrenceSpecificationLabelEditPart.VISUAL_ID
- : MessageOccurrenceSpecificationLabelEditPart.VISUAL_ID));
+ childView.setType(Integer.toString(destruction ? DestructionOccurrenceSpecificationLabelEditPart.VISUAL_ID : MessageOccurrenceSpecificationLabelEditPart.VISUAL_ID));
}
}
}
@@ -306,9 +299,8 @@ public final class MessageUtils {
}
/**
- * Whether the given element is a {@link MessageEnd} ({@link MessageOccurrenceSpecification},
- * {@link DestructionOccurrenceSpecification} or {@link Gate}), or can be converted to one (
- * {@link OccurrenceSpecification}).
+ * Whether the given element is a {@link MessageEnd} ({@link MessageOccurrenceSpecification}, {@link DestructionOccurrenceSpecification} or
+ * {@link Gate}), or can be converted to one ( {@link OccurrenceSpecification}).
*/
public static boolean isPotentialMessageEnd(final EObject element) {
return element instanceof MessageEnd || element instanceof OccurrenceSpecification;
@@ -320,18 +312,18 @@ public final class MessageUtils {
public static boolean isValidMessage(final MessageSort messageSort, final MessageKind messageKind, final EObject source, final EObject target) {
// found message <=> source == null
- if (source == null != (messageKind == MessageKind.FOUND_LITERAL)) {
+ if(source == null != (messageKind == MessageKind.FOUND_LITERAL)) {
return false;
}
// lost message <=> target == null
- if (target == null != (messageKind == MessageKind.LOST_LITERAL)) {
+ if(target == null != (messageKind == MessageKind.LOST_LITERAL)) {
return false;
}
- if ((messageSort == MessageSort.DELETE_MESSAGE_LITERAL || messageSort == MessageSort.CREATE_MESSAGE_LITERAL) && target instanceof Gate) {
+ if((messageSort == MessageSort.DELETE_MESSAGE_LITERAL || messageSort == MessageSort.CREATE_MESSAGE_LITERAL) && target instanceof Gate) {
return false;
}
- if (messageSort == MessageSort.CREATE_MESSAGE_LITERAL && target instanceof DestructionOccurrenceSpecification) {
+ if(messageSort == MessageSort.CREATE_MESSAGE_LITERAL && target instanceof DestructionOccurrenceSpecification) {
return false;
}
return true;
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/ModelValidationUtils.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/ModelValidationUtils.java
index 6805ec7f5bb..abe9e328992 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/ModelValidationUtils.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/ModelValidationUtils.java
@@ -47,13 +47,13 @@ public final class ModelValidationUtils {
* </ul>
*
* @param interaction
- * the Interaction to validate
+ * the Interaction to validate
* @param autoCorrection
- * whether to fix the model if it is not considered valid for us
+ * whether to fix the model if it is not considered valid for us
* @param interactive
- * whether to display notifications to the user, and ask for confirmation using dialog boxes
- * @return whether the Interaction is valid for the Papyrus timing diagram, after potential fixes were applied (if
- * <code>autoCorrection</code> is <code>true</code>)
+ * whether to display notifications to the user, and ask for confirmation using dialog boxes
+ * @return whether the Interaction is valid for the Papyrus timing diagram, after potential fixes were applied (if <code>autoCorrection</code> is
+ * <code>true</code>)
*/
public static boolean validate(final Interaction interaction, final boolean autoCorrection, final boolean interactive) {
final StringBuilder messageBuilder = new StringBuilder();
@@ -64,7 +64,7 @@ public final class ModelValidationUtils {
boolean isDestructionOccurrenceOK = false;
boolean isOSbetweenSIOK = false;
- for (final Lifeline lifeline : interaction.getLifelines()) {
+ for(final Lifeline lifeline : interaction.getLifelines()) {
// There must be no fragment after a DestructionOccurrence
isDestructionOccurrenceOK = validateDestructionOccurrence(lifeline, autoCorrection, messageBuilder);
// There must be an OccurrenceSpecification in between 2 StateInvariants
@@ -72,16 +72,16 @@ public final class ModelValidationUtils {
}
final Display display = Display.getCurrent();
- if (display != null) {
+ if(display != null) {
final String popupMessage = messageBuilder.toString().trim();
- if (popupMessage.length() > 0) {
+ if(popupMessage.length() > 0) {
// open a popup to notify the user about validation errors, and fixes that were applied
final PapyrusAsyncNotificationPopup popup = new PapyrusAsyncNotificationPopup(display, new FormToolkit(display));
popup.setTitle(Messages.ModelValidationUtils_ModelValidation);
popup.setText(popupMessage);
popup.open();
}
- } else if (interactive) {
+ } else if(interactive) {
throw new IllegalStateException("This method must be called on the UI thread when executed interactively"); //$NON-NLS-1$
}
@@ -89,9 +89,9 @@ public final class ModelValidationUtils {
}
private static void appendMessage(final StringBuilder message, final String string) {
- if (message.length() > 0) {
+ if(message.length() > 0) {
// start adding dashes if there is more than one message
- if (message.charAt(0) != '-') {
+ if(message.charAt(0) != '-') {
final String msg = message.toString();
message.setLength(0);
message.append("- ").append(msg); //$NON-NLS-1$
@@ -106,20 +106,20 @@ public final class ModelValidationUtils {
* in the same order as the fragments of the Interaction.
*
* @param interaction
- * the Interaction whose Lifelines to reorder
+ * the Interaction whose Lifelines to reorder
* @param messageBuilder
- * to build a validation message
+ * to build a validation message
*/
private static void reorderLifelineCoveredBy(final Interaction interaction, final StringBuilder messageBuilder) {
int reorderCount = 0;
- for (final Lifeline lifeline : interaction.getLifelines()) {
+ for(final Lifeline lifeline : interaction.getLifelines()) {
final EList<InteractionFragment> coveredBy = lifeline.getCoveredBys();
- if (!coveredBy.isEmpty()) {
+ if(!coveredBy.isEmpty()) {
final List<InteractionFragment> fragments = filterFragments(interaction.getFragments(), lifeline);
int indexInFragments = 0;
- for (final InteractionFragment interactionFragment : fragments) {
+ for(final InteractionFragment interactionFragment : fragments) {
final int indexInLifeline = coveredBy.indexOf(interactionFragment);
- if (indexInFragments != indexInLifeline) {
+ if(indexInFragments != indexInLifeline) {
coveredBy.move(indexInFragments, indexInLifeline);
reorderCount++;
}
@@ -127,7 +127,7 @@ public final class ModelValidationUtils {
}
}
}
- if (reorderCount > 0) {
+ if(reorderCount > 0) {
appendMessage(messageBuilder, NLS.bind(Messages.ModelValidationUtils_CoveredByFragmentsWereReOrdered, Integer.toString(reorderCount)));
}
}
@@ -136,15 +136,15 @@ public final class ModelValidationUtils {
* Return the sublist of the given fragments covered by the given Lifeline.
*
* @param fragments
- * the fragments list to filter
+ * the fragments list to filter
* @param lifeline
- * the Lifeline which must be covered by the returned fragments
+ * the Lifeline which must be covered by the returned fragments
* @return the filtered list of fragments that cover the Lifeline
*/
private static List<InteractionFragment> filterFragments(final EList<InteractionFragment> fragments, final Lifeline lifeline) {
final List<InteractionFragment> result = new ArrayList<InteractionFragment>();
- for (final InteractionFragment interactionFragment : fragments) {
- if (interactionFragment.getCovereds().contains(lifeline)) {
+ for(final InteractionFragment interactionFragment : fragments) {
+ if(interactionFragment.getCovereds().contains(lifeline)) {
result.add(interactionFragment);
}
}
@@ -157,28 +157,26 @@ public final class ModelValidationUtils {
final ListIterator<InteractionFragment> listIterator = lifeline.getCoveredBys().listIterator();
boolean afterDestructionOccurrenceSpecification = false;
- while (listIterator.hasNext()) {
+ while(listIterator.hasNext()) {
final InteractionFragment fragment = listIterator.next();
- if (afterDestructionOccurrenceSpecification) {
- if (autoCorrection) {
+ if(afterDestructionOccurrenceSpecification) {
+ if(autoCorrection) {
listIterator.remove();
wrongFragmentsRemoved++;
} else {
wrongFragmentsFound++;
}
}
- if (fragment instanceof DestructionOccurrenceSpecification) {
+ if(fragment instanceof DestructionOccurrenceSpecification) {
afterDestructionOccurrenceSpecification = true;
}
}
- if (wrongFragmentsFound > 0) {
- appendMessage(messageBuilder,
- NLS.bind(Messages.ModelValidationUtils_FragmentsFoundAfterDestructionOccurrenceSpecification, Integer.toString(wrongFragmentsFound)));
+ if(wrongFragmentsFound > 0) {
+ appendMessage(messageBuilder, NLS.bind(Messages.ModelValidationUtils_FragmentsFoundAfterDestructionOccurrenceSpecification, Integer.toString(wrongFragmentsFound)));
}
- if (wrongFragmentsRemoved > 0) {
- appendMessage(messageBuilder,
- NLS.bind(Messages.ModelValidationUtils_FragmentsRemovedAfterDestructionOccurrenceSpecification, Integer.toString(wrongFragmentsRemoved)));
+ if(wrongFragmentsRemoved > 0) {
+ appendMessage(messageBuilder, NLS.bind(Messages.ModelValidationUtils_FragmentsRemovedAfterDestructionOccurrenceSpecification, Integer.toString(wrongFragmentsRemoved)));
}
return wrongFragmentsFound == 0;
@@ -191,9 +189,9 @@ public final class ModelValidationUtils {
final Map<OccurrenceSpecification, Integer> occurencesToBeAdded = new LinkedHashMap<OccurrenceSpecification, Integer>();
InteractionFragment previousElement = null;
int offset = 0;
- for (final InteractionFragment interactionFragment : coveredBys) {
- if (interactionFragment instanceof StateInvariant && previousElement instanceof StateInvariant) {
- if (autoCorrection) {
+ for(final InteractionFragment interactionFragment : coveredBys) {
+ if(interactionFragment instanceof StateInvariant && previousElement instanceof StateInvariant) {
+ if(autoCorrection) {
final OccurrenceSpecification occurrence = UMLFactory.eINSTANCE.createOccurrenceSpecification();
OccurrenceSpecificationUtils.setAutogeneratedName(occurrence, true);
occurencesToBeAdded.put(occurrence, Integer.valueOf(coveredBys.indexOf(interactionFragment) + offset++));
@@ -203,12 +201,12 @@ public final class ModelValidationUtils {
}
previousElement = interactionFragment;
}
- if (!occurencesToBeAdded.isEmpty()) {
- for (final Entry<OccurrenceSpecification, Integer> entry : occurencesToBeAdded.entrySet()) {
+ if(!occurencesToBeAdded.isEmpty()) {
+ for(final Entry<OccurrenceSpecification, Integer> entry : occurencesToBeAdded.entrySet()) {
final OccurrenceSpecification occurrence = entry.getKey();
final int indexInCoveredBys = entry.getValue().intValue();
// Element must be a StateInvariant
- final StateInvariant stateInvariant = (StateInvariant) lifeline.getCoveredBys().get(indexInCoveredBys);
+ final StateInvariant stateInvariant = (StateInvariant)lifeline.getCoveredBys().get(indexInCoveredBys);
// insert the OccurrenceSpecification before the StateInvariant in the Lifeline's coveredBys
lifeline.getCoveredBys().add(indexInCoveredBys, occurrence);
@@ -220,28 +218,27 @@ public final class ModelValidationUtils {
fragments.add(indexInFragments, occurrence);
String previousName = null;
- if (indexInCoveredBys > 0) {
+ if(indexInCoveredBys > 0) {
final InteractionFragment previousFragment = lifeline.getCoveredBys().get(indexInCoveredBys - 1);
- if (previousFragment instanceof StateInvariant) {
- final StateInvariant previousStateInvariant = (StateInvariant) previousFragment;
+ if(previousFragment instanceof StateInvariant) {
+ final StateInvariant previousStateInvariant = (StateInvariant)previousFragment;
previousName = previousStateInvariant.getName();
}
}
String followingName = stateInvariant.getName();
- if (previousName == null) {
+ if(previousName == null) {
previousName = "<unnamed>"; //$NON-NLS-1$
}
- if (followingName == null) {
+ if(followingName == null) {
followingName = "<unnamed>"; //$NON-NLS-1$
}
occurrence.setName(previousName + "_To_" + followingName); //$NON-NLS-1$
}
- appendMessage(messageBuilder,
- NLS.bind(Messages.ModelValidationUtils_MissingOccurrenceSpecificationAdded, Integer.valueOf(occurencesToBeAdded.size())));
+ appendMessage(messageBuilder, NLS.bind(Messages.ModelValidationUtils_MissingOccurrenceSpecificationAdded, Integer.valueOf(occurencesToBeAdded.size())));
}
- if (missingOccurrences > 0) {
+ if(missingOccurrences > 0) {
appendMessage(messageBuilder, NLS.bind(Messages.ModelValidationUtils_MissingOccurrenceSpecificationFound, Integer.valueOf(missingOccurrences)));
}
return missingOccurrences == 0;
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/OccurrenceSpecificationUtils.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/OccurrenceSpecificationUtils.java
index 8426d8f3835..1dfb9931013 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/OccurrenceSpecificationUtils.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/OccurrenceSpecificationUtils.java
@@ -61,13 +61,11 @@ public final class OccurrenceSpecificationUtils {
}
public static boolean isOccurrenceSpecificationEditPart(final int visualID) {
- return visualID == OccurrenceSpecificationEditPartCN.VISUAL_ID || visualID == MessageOccurrenceSpecificationEditPartCN.VISUAL_ID
- || visualID == DestructionOccurrenceSpecificationEditPartCN.VISUAL_ID;
+ return visualID == OccurrenceSpecificationEditPartCN.VISUAL_ID || visualID == MessageOccurrenceSpecificationEditPartCN.VISUAL_ID || visualID == DestructionOccurrenceSpecificationEditPartCN.VISUAL_ID;
}
public static boolean isOccurrenceSpecificationEditPart(final EditPart editPart) {
- return editPart instanceof OccurrenceSpecificationEditPartCN || editPart instanceof MessageOccurrenceSpecificationEditPartCN
- || editPart instanceof DestructionOccurrenceSpecificationEditPartCN;
+ return editPart instanceof OccurrenceSpecificationEditPartCN || editPart instanceof MessageOccurrenceSpecificationEditPartCN || editPart instanceof DestructionOccurrenceSpecificationEditPartCN;
}
public static boolean isOccurrenceSpecificationView(final View view) {
@@ -83,17 +81,17 @@ public final class OccurrenceSpecificationUtils {
* Marks with an EAnnotation whether the given OccurrenceSpecification has an auto-generated name.
*
* @param occurrenceSpecification
- * the OccurrenceSpecification for which to specify whether it has an auto-generated name
+ * the OccurrenceSpecification for which to specify whether it has an auto-generated name
* @param autogenerated
- * whether the name is auto-generated
+ * whether the name is auto-generated
*/
public static void setAutogeneratedName(final OccurrenceSpecification occurrenceSpecification, final boolean autogenerated) {
EAnnotation eAnnotation = getAutogeneratedAnnotation(occurrenceSpecification);
- if (autogenerated && eAnnotation == null) {
+ if(autogenerated && eAnnotation == null) {
eAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
eAnnotation.setSource(AUTOGENERATED_OCCURRENCE_SPECIFICATION_NAME);
occurrenceSpecification.getEAnnotations().add(eAnnotation);
- } else if (!autogenerated && eAnnotation != null) {
+ } else if(!autogenerated && eAnnotation != null) {
occurrenceSpecification.getEAnnotations().remove(eAnnotation);
}
}
@@ -102,7 +100,7 @@ public final class OccurrenceSpecificationUtils {
* Returns whether the given OccurrenceSpecification has an auto-generated name.
*
* @param occurrenceSpecification
- * the OccurrenceSpecification for which to determine whether it has an auto-generated name
+ * the OccurrenceSpecification for which to determine whether it has an auto-generated name
* @return whether the name of the given OccurrenceSpecification is auto-generated
*/
public static boolean isAutogeneratedName(final OccurrenceSpecification occurrenceSpecification) {
@@ -114,13 +112,13 @@ public final class OccurrenceSpecificationUtils {
* Get all elements to delete when deleting an OccurrenceSpecification.
*
* @param occurrenceSpecification
- * the OccurrenceSpecification being deleted
+ * the OccurrenceSpecification being deleted
* @return the elements (EObjects and Views) that should be deleted together with the OccurrenceSpecification
*/
public static Collection<EObject> getElementsToDelete(final OccurrenceSpecification occurrenceSpecification) {
final Set<EObject> elementsToDestroy = new HashSet<EObject>();
final Set<View> crossReferencingViews = CrossReferencerUtil.getCrossReferencingViews(occurrenceSpecification, TimingDiagramEditPart.MODEL_ID);
- for (final View view : crossReferencingViews) {
+ for(final View view : crossReferencingViews) {
elementsToDestroy.addAll(getElementsToRemove(view, false));
}
return elementsToDestroy;
@@ -131,15 +129,15 @@ public final class OccurrenceSpecificationUtils {
* View).
*
* @param occurrenceSpecification
- * the OccurrenceSpecification being hidden
+ * the OccurrenceSpecification being hidden
* @return the Views that should be hidden together with the given OccurrenceSpecification View
*/
public static Collection<View> getViewsToHide(final View occurrenceSpecificationView) {
final Set<View> viewsToHide = new HashSet<View>();
final Collection<EObject> elementsToRemove = getElementsToRemove(occurrenceSpecificationView, true);
- for (final EObject eObject : elementsToRemove) {
- if (eObject instanceof View) {
- viewsToHide.add((View) eObject);
+ for(final EObject eObject : elementsToRemove) {
+ if(eObject instanceof View) {
+ viewsToHide.add((View)eObject);
} else {
throw new IllegalStateException("Only views should be returned"); //$NON-NLS-1$
}
@@ -151,15 +149,15 @@ public final class OccurrenceSpecificationUtils {
* Get all elements to remove when removing an OccurrenceSpecification.
*
* @param occurrenceSpecificationView
- * the OccurrenceSpecification View being removed
+ * the OccurrenceSpecification View being removed
* @param hideOnly
- * if <code>true</code>, only return the Views, not the semantic elements
+ * if <code>true</code>, only return the Views, not the semantic elements
* @return the elements (Views and EObjects if <code>hideOnly</code> is <code>false</code>) that should be removed
* together with the OccurrenceSpecification
*/
public static Collection<EObject> getElementsToRemove(final View occurrenceSpecificationView, final boolean hideOnly) {
final Set<EObject> elementsToRemove = new HashSet<EObject>();
- if (OccurrenceSpecificationUtils.isOccurrenceSpecificationView(occurrenceSpecificationView)) {
+ if(OccurrenceSpecificationUtils.isOccurrenceSpecificationView(occurrenceSpecificationView)) {
// remove associated ticks
final List<Node> associatedTickViews = TickUtils.getAssociatedTickViews(occurrenceSpecificationView);
elementsToRemove.addAll(associatedTickViews);
@@ -167,8 +165,8 @@ public final class OccurrenceSpecificationUtils {
// only remove Views under the same Interaction
final View interactionView = ViewUtils.findSuperViewWithId(occurrenceSpecificationView, InteractionEditPartTN.VISUAL_ID);
final EObject eContainer = occurrenceSpecificationView.eContainer();
- if (eContainer instanceof Node) {
- final Node node = (Node) eContainer;
+ if(eContainer instanceof Node) {
+ final Node node = (Node)eContainer;
@SuppressWarnings("unchecked")
final EList<View> children = node.getChildren();
@@ -177,10 +175,10 @@ public final class OccurrenceSpecificationUtils {
boolean done = false;
// the Lifeline starts by an OccurrenceSpecification (created with a Create Message)
- if (index == 0) {
- if (index + 1 < childrenSize) {
+ if(index == 0) {
+ if(index + 1 < childrenSize) {
final View following = children.get(index + 1);
- if (following.getType().equals(Constants.verticalLineId)) {
+ if(following.getType().equals(Constants.verticalLineId)) {
elementsToRemove.add(following);
}
}
@@ -189,13 +187,13 @@ public final class OccurrenceSpecificationUtils {
}
// state change in a full lifeline
- if (!done && index + 2 < childrenSize) {
+ if(!done && index + 2 < childrenSize) {
final View following1 = children.get(index + 1);
final View following2 = children.get(index + 2);
- if (following1.getType().equals(Constants.verticalLineId) && following2.getType().equals(Constants.fullStateInvariantId)) {
+ if(following1.getType().equals(Constants.verticalLineId) && following2.getType().equals(Constants.fullStateInvariantId)) {
elementsToRemove.add(following1);
elementsToRemove.add(following2);
- if (!hideOnly) {
+ if(!hideOnly) {
elementsToRemove.add(following2.getElement());
}
elementsToRemove.addAll(StateInvariantUtils.getRelatedElementsToRemove(following2.getElement(), hideOnly, interactionView));
@@ -204,11 +202,11 @@ public final class OccurrenceSpecificationUtils {
}
// state change in a compact lifeline, or non-state-change OccurrenceSpecification in any Lifeline
- if (!done && index + 1 < childrenSize) {
+ if(!done && index + 1 < childrenSize) {
final View following = children.get(index + 1);
- if (following.getType().equals(Constants.fullStateInvariantId) || following.getType().equals(Constants.compactStateInvariantId)) {
+ if(following.getType().equals(Constants.fullStateInvariantId) || following.getType().equals(Constants.compactStateInvariantId)) {
elementsToRemove.add(following);
- if (!hideOnly) {
+ if(!hideOnly) {
elementsToRemove.add(following.getElement());
}
elementsToRemove.addAll(StateInvariantUtils.getRelatedElementsToRemove(following.getElement(), hideOnly, interactionView));
@@ -216,15 +214,14 @@ public final class OccurrenceSpecificationUtils {
}
}
- final OccurrenceSpecification occurrenceSpecification = (OccurrenceSpecification) occurrenceSpecificationView.getElement();
+ final OccurrenceSpecification occurrenceSpecification = (OccurrenceSpecification)occurrenceSpecificationView.getElement();
elementsToRemove.addAll(getRelatedElementsToRemove(occurrenceSpecification, hideOnly, interactionView));
}
return elementsToRemove;
}
- public static Collection<? extends EObject> getRelatedElementsToRemove(final EObject occurrenceSpecification, final boolean hideOnly,
- final View interactionView) {
+ public static Collection<? extends EObject> getRelatedElementsToRemove(final EObject occurrenceSpecification, final boolean hideOnly, final View interactionView) {
Assert.isLegal(occurrenceSpecification instanceof OccurrenceSpecification);
final Set<EObject> elementsToRemove = new HashSet<EObject>();
elementsToRemove.addAll(TimeElementUtils.getTimeElementsToRemove(occurrenceSpecification, hideOnly, interactionView));
@@ -238,42 +235,41 @@ public final class OccurrenceSpecificationUtils {
* DestructionOccurrenceSpecification (which signifies the end of a Lifeline). Doesn't delete time elements.
*
* @param occurrenceSpecification
- * the OccurrenceSpecification after which everything must be deleted
+ * the OccurrenceSpecification after which everything must be deleted
* @param occurrenceSpecificationView
- * the OccurrenceSpecification View after which other views must be deleted (if <code>null</code>, then
- * the views will be searched)
+ * the OccurrenceSpecification View after which other views must be deleted (if <code>null</code>, then
+ * the views will be searched)
*/
- private static void deleteEverythingAfterOrBefore(final OccurrenceSpecification occurrenceSpecification, final View occurrenceSpecificationView,
- final boolean before) {
+ private static void deleteEverythingAfterOrBefore(final OccurrenceSpecification occurrenceSpecification, final View occurrenceSpecificationView, final boolean before) {
// remove fragments from UML model
final EList<Lifeline> coveredLifelines = occurrenceSpecification.getCovereds();
- for (final Lifeline lifeline : coveredLifelines) {
+ for(final Lifeline lifeline : coveredLifelines) {
final EList<InteractionFragment> coveredBys = lifeline.getCoveredBys();
int index = coveredBys.indexOf(occurrenceSpecification);
- if (index != -1) {
+ if(index != -1) {
// if we are removing everything before an OccurrenceSpecification in the middle of a StateInvariant,
// then we need to move the StateInvariant after the OccurrenceSpecification
- if (before && index + 1 < coveredBys.size() && !(coveredBys.get(index + 1) instanceof StateInvariant)) {
- if (movePreviousStateInvariantAfter(coveredBys, occurrenceSpecification)) {
+ if(before && index + 1 < coveredBys.size() && !(coveredBys.get(index + 1) instanceof StateInvariant)) {
+ if(movePreviousStateInvariantAfter(coveredBys, occurrenceSpecification)) {
// the OccurrenceSpecification moved since we removed an element before it
index--;
}
}
final List<InteractionFragment> fragmentsToRemove = new ArrayList<InteractionFragment>();
- for (int i = before ? index - 1 : index + 1; before ? i >= 0 : i < coveredBys.size(); i = (before ? i - 1 : i + 1)) {
+ for(int i = before ? index - 1 : index + 1; before ? i >= 0 : i < coveredBys.size(); i = (before ? i - 1 : i + 1)) {
fragmentsToRemove.add(coveredBys.get(i));
}
- for (final InteractionFragment fragmentToRemove : fragmentsToRemove) {
+ for(final InteractionFragment fragmentToRemove : fragmentsToRemove) {
// remove the related elements
Collection<? extends EObject> relatedElementsToRemove = Collections.emptyList();
- if (fragmentToRemove instanceof OccurrenceSpecification) {
- final OccurrenceSpecification occurrence = (OccurrenceSpecification) fragmentToRemove;
+ if(fragmentToRemove instanceof OccurrenceSpecification) {
+ final OccurrenceSpecification occurrence = (OccurrenceSpecification)fragmentToRemove;
relatedElementsToRemove = OccurrenceSpecificationUtils.getRelatedElementsToRemove(occurrence, false, null);
- } else if (fragmentToRemove instanceof StateInvariant) {
- final StateInvariant stateInvariant = (StateInvariant) fragmentToRemove;
+ } else if(fragmentToRemove instanceof StateInvariant) {
+ final StateInvariant stateInvariant = (StateInvariant)fragmentToRemove;
relatedElementsToRemove = StateInvariantUtils.getRelatedElementsToRemove(stateInvariant, false, null);
}
- for (final EObject eObject : relatedElementsToRemove) {
+ for(final EObject eObject : relatedElementsToRemove) {
DestroyElementCommand.destroy(eObject);
}
// remove the fragment
@@ -283,36 +279,35 @@ public final class OccurrenceSpecificationUtils {
}
// remove Views from notation model
final Collection<View> views;
- if (occurrenceSpecificationView == null) {
+ if(occurrenceSpecificationView == null) {
views = CrossReferencerUtil.getCrossReferencingViews(occurrenceSpecification, TimingDiagramEditPart.MODEL_ID);
} else {
views = Collections.singletonList(occurrenceSpecificationView);
}
- for (final View view : views) {
- final View parentView = (View) view.eContainer();
+ for(final View view : views) {
+ final View parentView = (View)view.eContainer();
@SuppressWarnings("unchecked")
final EList<View> children = parentView.getChildren();
final int index = children.indexOf(view);
- if (index != -1) {
+ if(index != -1) {
final List<View> viewsToRemove = new ArrayList<View>();
- for (int i = before ? index - 1 : index + 1; before ? i >= 0 : i < children.size(); i = (before ? i - 1 : i + 1)) {
+ for(int i = before ? index - 1 : index + 1; before ? i >= 0 : i < children.size(); i = (before ? i - 1 : i + 1)) {
final View childView = children.get(i);
final int visualID = UMLVisualIDRegistry.getVisualID(childView);
- if (isOccurrenceSpecificationEditPart(visualID) || StateInvariantUtils.isStateInvariantEditPart(visualID)
- || visualID == FullStateInvariantVerticalLineEditPart.VISUAL_ID) {
+ if(isOccurrenceSpecificationEditPart(visualID) || StateInvariantUtils.isStateInvariantEditPart(visualID) || visualID == FullStateInvariantVerticalLineEditPart.VISUAL_ID) {
viewsToRemove.add(childView);
}
}
// remove the vertical line (a state change is not possible anymore
// since we deleted the preceding state invariant)
- if (before && index + 1 < children.size()) {
+ if(before && index + 1 < children.size()) {
final View childView = children.get(index + 1);
final int visualID = UMLVisualIDRegistry.getVisualID(childView);
- if (visualID == FullStateInvariantVerticalLineEditPart.VISUAL_ID) {
+ if(visualID == FullStateInvariantVerticalLineEditPart.VISUAL_ID) {
viewsToRemove.add(childView);
}
}
- for (final View viewToRemove : viewsToRemove) {
+ for(final View viewToRemove : viewsToRemove) {
ViewUtil.destroy(viewToRemove);
}
}
@@ -323,24 +318,24 @@ public final class OccurrenceSpecificationUtils {
final int umlIndex = fragments.indexOf(occurrenceSpecification);
// move the StateInvariant in the UML model
final int previousStateInvariantIndex = findPreviousStateInvariantIndex(umlIndex, fragments);
- if (previousStateInvariantIndex == -1) {
+ if(previousStateInvariantIndex == -1) {
Activator.log.error(new IllegalStateException("No StateInvariant after or before the OccurrenceSpecification")); //$NON-NLS-1$
return false;
}
- final StateInvariant stateInvariant = (StateInvariant) fragments.get(previousStateInvariantIndex);
+ final StateInvariant stateInvariant = (StateInvariant)fragments.get(previousStateInvariantIndex);
fragments.move(umlIndex, previousStateInvariantIndex);
// move the StateInvariant View in the notation model
final Collection<View> stateInvariantViews = CrossReferencerUtil.getCrossReferencingViews(stateInvariant, TimingDiagramEditPart.MODEL_ID);
- for (final View stateInvariantView : stateInvariantViews) {
- final View parentView = (View) stateInvariantView.eContainer();
+ for(final View stateInvariantView : stateInvariantViews) {
+ final View parentView = (View)stateInvariantView.eContainer();
@SuppressWarnings("unchecked")
final EList<View> children = parentView.getPersistedChildren();
// find the OccurrenceSpecification View index
int viewIndex = -1;
- for (int i = 0; i < children.size(); i++) {
+ for(int i = 0; i < children.size(); i++) {
final View view = children.get(i);
- if (view.getElement() == occurrenceSpecification) {
+ if(view.getElement() == occurrenceSpecification) {
viewIndex = i;
break;
}
@@ -351,9 +346,9 @@ public final class OccurrenceSpecificationUtils {
}
private static int findPreviousStateInvariantIndex(final int index, final EList<InteractionFragment> fragments) {
- for (int i = index - 1; i >= 0; i--) {
+ for(int i = index - 1; i >= 0; i--) {
final InteractionFragment fragment = fragments.get(i);
- if (fragment instanceof StateInvariant) {
+ if(fragment instanceof StateInvariant) {
return i;
}
}
@@ -365,24 +360,24 @@ public final class OccurrenceSpecificationUtils {
* DestructionOccurrenceSpecification (which signifies the end of a Lifeline). Doesn't delete time elements.
*
* @param occurrenceSpecification
- * the OccurrenceSpecification after which everything must be deleted
+ * the OccurrenceSpecification after which everything must be deleted
* @param occurrenceSpecificationView
- * the OccurrenceSpecification View after which other views must be deleted (if <code>null</code>, then
- * the views will be searched)
+ * the OccurrenceSpecification View after which other views must be deleted (if <code>null</code>, then
+ * the views will be searched)
*/
public static void deleteEverythingAfter(final OccurrenceSpecification occurrenceSpecification, final View occurrenceSpecificationView) {
deleteEverythingAfterOrBefore(occurrenceSpecification, occurrenceSpecificationView, false);
}
/**
- * Delete all {@link StateInvariant}s and {@link OccurrenceSpecification}s before the given
- * {@link OccurrenceSpecification} (which signifies the creation of a Lifeline). Doesn't delete time elements.
+ * Delete all {@link StateInvariant}s and {@link OccurrenceSpecification}s before the given {@link OccurrenceSpecification} (which signifies the
+ * creation of a Lifeline). Doesn't delete time elements.
*
* @param occurrenceSpecification
- * the OccurrenceSpecification before which everything must be deleted
+ * the OccurrenceSpecification before which everything must be deleted
* @param occurrenceSpecificationView
- * the OccurrenceSpecification View before which other views must be deleted (if <code>null</code>, then
- * the views will be searched)
+ * the OccurrenceSpecification View before which other views must be deleted (if <code>null</code>, then
+ * the views will be searched)
*/
public static void deleteEverythingBefore(final OccurrenceSpecification occurrenceSpecification, final View occurrenceSpecificationView) {
deleteEverythingAfterOrBefore(occurrenceSpecification, occurrenceSpecificationView, true);
@@ -392,25 +387,25 @@ public final class OccurrenceSpecificationUtils {
* Find at which index to insert an OccurrenceSpecification in a compartment, based on a location.
*
* @param pt
- * the location
+ * the location
* @param compartmentView
- * the compartment view in which the OccurrenceSpecification will be inserted
+ * the compartment view in which the OccurrenceSpecification will be inserted
* @param viewer
- * the viewer in which the EditParts corresponding to the Views are registered
+ * the viewer in which the EditParts corresponding to the Views are registered
* @return the index in the compartment where the OccurrenceSpecification should be inserted
*/
public static int findInsertionIndexFor(final Point pt, final View compartmentView, final EditPartViewer viewer) {
@SuppressWarnings("unchecked")
final EList<View> children = compartmentView.getChildren();
int index = 0;
- for (final View view : children) {
- if (view instanceof Node) {
- final Node node = (Node) view;
+ for(final View view : children) {
+ if(view instanceof Node) {
+ final Node node = (Node)view;
final Object editPart = viewer.getEditPartRegistry().get(node);
- if (editPart instanceof GraphicalEditPart) {
- final GraphicalEditPart graphicalEditPart = (GraphicalEditPart) editPart;
+ if(editPart instanceof GraphicalEditPart) {
+ final GraphicalEditPart graphicalEditPart = (GraphicalEditPart)editPart;
final Rectangle bounds = graphicalEditPart.getFigure().getBounds();
- if (pt.x < bounds.x()) {
+ if(pt.x < bounds.x()) {
break;
}
} else {
@@ -423,23 +418,23 @@ public final class OccurrenceSpecificationUtils {
}
/**
- * Wrap the given <code>baseCommand</code> (that hides an OccurrenceSpecification View) into a
- * {@link CompoundCommand}, and add a deletion of other Views associated to the OccurrenceSpecification.
+ * Wrap the given <code>baseCommand</code> (that hides an OccurrenceSpecification View) into a {@link CompoundCommand}, and add a deletion of
+ * other Views associated to the OccurrenceSpecification.
*/
public static CompoundCommand getHideOccurrenceSpecificationCommand(final EditPart occurrenceSpecificationEditPart, final Command baseCommand) {
- final View view = (View) occurrenceSpecificationEditPart.getModel();
- if (!OccurrenceSpecificationUtils.isOccurrenceSpecificationEditPart(UMLVisualIDRegistry.getVisualID(view))) {
+ final View view = (View)occurrenceSpecificationEditPart.getModel();
+ if(!OccurrenceSpecificationUtils.isOccurrenceSpecificationEditPart(UMLVisualIDRegistry.getVisualID(view))) {
return null;
}
final Collection<View> viewsToHide = OccurrenceSpecificationUtils.getViewsToHide(view);
final CompoundCommand compoundCommand = new CompoundCommand(Messages.OccurrenceSpecificationUtils_HideOccurrenceSpecification);
- if (baseCommand != null) {
+ if(baseCommand != null) {
compoundCommand.add(baseCommand);
}
- for (final View viewToHide : viewsToHide) {
+ for(final View viewToHide : viewsToHide) {
compoundCommand.add(new ICommandProxy(new DeleteCommand(viewToHide)));
}
- if (compoundCommand.isEmpty()) {
+ if(compoundCommand.isEmpty()) {
return null;
}
return compoundCommand;
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/RequestUtils.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/RequestUtils.java
index b9ceb6e6ca3..570b0717035 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/RequestUtils.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/RequestUtils.java
@@ -19,14 +19,15 @@ import org.eclipse.gef.requests.GroupRequest;
import org.eclipse.gmf.runtime.notation.View;
public final class RequestUtils {
+
private RequestUtils() {
// utility class
}
/** Whether the given request is a ChangeBoundsRequest concerning instances of the given EClass only. */
public static boolean isChangeBoundsRequestFor(final Request request, final EClass eClass) {
- if (request instanceof ChangeBoundsRequest) {
- final ChangeBoundsRequest changeBoundsRequest = (ChangeBoundsRequest) request;
+ if(request instanceof ChangeBoundsRequest) {
+ final ChangeBoundsRequest changeBoundsRequest = (ChangeBoundsRequest)request;
return isGroupRequestFor(changeBoundsRequest, eClass);
}
return false;
@@ -34,8 +35,8 @@ public final class RequestUtils {
/** Whether the given request is a ChangeBoundsRequest concerning instances of the given EditPart only. */
public static boolean isChangeBoundsRequestFor(final Request request, final Class<? extends EditPart> editPartClass) {
- if (request instanceof ChangeBoundsRequest) {
- final ChangeBoundsRequest changeBoundsRequest = (ChangeBoundsRequest) request;
+ if(request instanceof ChangeBoundsRequest) {
+ final ChangeBoundsRequest changeBoundsRequest = (ChangeBoundsRequest)request;
return isGroupRequestFor(changeBoundsRequest, editPartClass);
}
return false;
@@ -45,15 +46,15 @@ public final class RequestUtils {
public static boolean isGroupRequestFor(final GroupRequest groupRequest, final EClass eClass) {
@SuppressWarnings("unchecked")
final List<EditPart> editParts = groupRequest.getEditParts();
- if (editParts == null) {
+ if(editParts == null) {
return false;
}
- for (final EditPart editPart : editParts) {
+ for(final EditPart editPart : editParts) {
final Object model = editPart.getModel();
- if (model instanceof View) {
- final View view = (View) model;
+ if(model instanceof View) {
+ final View view = (View)model;
final EObject element = view.getElement();
- if (!eClass.isInstance(element)) {
+ if(!eClass.isInstance(element)) {
return false;
}
} else {
@@ -67,8 +68,8 @@ public final class RequestUtils {
public static boolean isGroupRequestFor(final GroupRequest groupRequest, final Class<? extends EditPart> editPartClass) {
@SuppressWarnings("unchecked")
final List<EditPart> editParts = groupRequest.getEditParts();
- for (final EditPart editPart : editParts) {
- if (!editPartClass.isInstance(editPart)) {
+ for(final EditPart editPart : editParts) {
+ if(!editPartClass.isInstance(editPart)) {
return false;
}
}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/StateDefinitionUtils.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/StateDefinitionUtils.java
index 46db314ed8b..1fc4e8a3ba1 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/StateDefinitionUtils.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/StateDefinitionUtils.java
@@ -43,13 +43,16 @@ public final class StateDefinitionUtils {
/** The key for the EAnnotation on a Lifeline in which the StateDefinition (id,name) detail map is contained */
private static final String LIFELINE_STATE_DEFINITIONS_KEY = "org.eclipse.papyrus.uml.diagram.timing.LifelineStateDefinitions"; //$NON-NLS-1$
+
/**
* The key for the EAnnotation on a StateDefinition View in which the id (STATE_DEFINITION_VIEW_ID_KEY) and name
* (STATE_DEFINITION_VIEW_NAME_KEY) are defined
*/
private static final String STATE_DEFINITION_VIEW_KEY = "org.eclipse.papyrus.uml.diagram.timing.StateDefinitionView"; //$NON-NLS-1$
+
/** The key for the name of a StateDefinition in the details map of a StateDefinition View's annotations */
private static final String STATE_DEFINITION_VIEW_ID_KEY = "org.eclipse.papyrus.uml.diagram.timing.StateDefinitionViewID"; //$NON-NLS-1$
+
/** The key for the id of a StateDefinition in the details map of a StateDefinition View's annotations */
private static final String STATE_DEFINITION_VIEW_NAME_KEY = "org.eclipse.papyrus.uml.diagram.timing.StateDefinitionViewName"; //$NON-NLS-1$
@@ -59,7 +62,7 @@ public final class StateDefinitionUtils {
public static boolean hasStateDefinitionEAnnotation(final Lifeline lifeline) {
final EAnnotation eAnnotation = lifeline.getEAnnotation(LIFELINE_STATE_DEFINITIONS_KEY);
- if (eAnnotation == null) {
+ if(eAnnotation == null) {
return false;
}
return !eAnnotation.getDetails().isEmpty();
@@ -68,7 +71,7 @@ public final class StateDefinitionUtils {
/** Get or create an EAnnotation in the given Lifeline, to hold the map of state definition IDs and names */
public static EAnnotation getOrCreateStateDefinitionsEAnnotation(final Lifeline lifeline) {
EAnnotation eAnnotation = lifeline.getEAnnotation(LIFELINE_STATE_DEFINITIONS_KEY);
- if (eAnnotation == null) {
+ if(eAnnotation == null) {
eAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
eAnnotation.setSource(LIFELINE_STATE_DEFINITIONS_KEY);
lifeline.getEAnnotations().add(eAnnotation);
@@ -77,8 +80,8 @@ public final class StateDefinitionUtils {
}
/**
- * Get the EAnnotation that contains a Details map (stateDefinitionId,stateDefinitionName) on the given Lifeline, or
- * <code>null</code> if none was created
+ * Get the EAnnotation that contains a Details map (stateDefinitionId,stateDefinitionName) on the given Lifeline, or <code>null</code> if none was
+ * created
*/
public static EAnnotation getStateDefinitionsEAnnotation(final Lifeline lifeline) {
return lifeline.getEAnnotation(LIFELINE_STATE_DEFINITIONS_KEY);
@@ -86,7 +89,7 @@ public final class StateDefinitionUtils {
public static String getStateDefinitionViewID(final View stateDefinitionView) {
final EAnnotation eAnnotation = stateDefinitionView.getEAnnotation(STATE_DEFINITION_VIEW_KEY);
- if (eAnnotation != null) {
+ if(eAnnotation != null) {
return eAnnotation.getDetails().get(STATE_DEFINITION_VIEW_ID_KEY);
}
return null;
@@ -94,7 +97,7 @@ public final class StateDefinitionUtils {
private static EAnnotation getOrCreateStateDefinitionViewAnnotation(final View stateDefinitionView) {
EAnnotation eAnnotation = stateDefinitionView.getEAnnotation(STATE_DEFINITION_VIEW_KEY);
- if (eAnnotation == null) {
+ if(eAnnotation == null) {
eAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
eAnnotation.setSource(STATE_DEFINITION_VIEW_KEY);
stateDefinitionView.getEAnnotations().add(eAnnotation);
@@ -115,7 +118,7 @@ public final class StateDefinitionUtils {
public static void setStateDefinitionName(final View stateDefinitionView, final String newName) {
checkStateDefinitionView(stateDefinitionView);
String stateDefinitionViewID = getStateDefinitionViewID(stateDefinitionView);
- if (stateDefinitionViewID == null) {
+ if(stateDefinitionViewID == null) {
// generate a unique ID that we will use to link the StateDefinition Figure to its name in the
// EAnnotation: we have a map (ID,name) in the Lifeline's EAnnotation and an entry (View,ID) in the
// StateDefinition Figure's EAnnotation
@@ -131,7 +134,7 @@ public final class StateDefinitionUtils {
public static void removeStateDefinitionEAnnotationFromLifeline(final String id, final Lifeline lifeline) {
final EAnnotation lifelineEAnnotation = getStateDefinitionsEAnnotation(lifeline);
- if (lifelineEAnnotation != null) {
+ if(lifelineEAnnotation != null) {
lifelineEAnnotation.getDetails().removeKey(id);
}
}
@@ -139,7 +142,7 @@ public final class StateDefinitionUtils {
public static String getStateDefinitionName(final View stateDefinitionView) {
checkStateDefinitionView(stateDefinitionView);
final String stateDefinitionViewID = getStateDefinitionViewID(stateDefinitionView);
- if (stateDefinitionViewID == null) {
+ if(stateDefinitionViewID == null) {
return null;
}
final Lifeline lifeline = StateDefinitionUtils.getParentLifeline(stateDefinitionView);
@@ -147,11 +150,11 @@ public final class StateDefinitionUtils {
}
public static String getStateDefinitionName(final String stateDefinitionViewID, final Lifeline lifeline) {
- if (stateDefinitionViewID == null || lifeline == null) {
+ if(stateDefinitionViewID == null || lifeline == null) {
return null;
}
final EAnnotation lifelineEAnnotation = getStateDefinitionsEAnnotation(lifeline);
- if (lifelineEAnnotation == null) {
+ if(lifelineEAnnotation == null) {
return null;
}
return lifelineEAnnotation.getDetails().get(stateDefinitionViewID);
@@ -160,19 +163,19 @@ public final class StateDefinitionUtils {
public static View getParentLifelineView(final View view) {
final String id = Integer.toString(FullLifelineEditPartCN.VISUAL_ID);
View parent = view;
- while (parent != null) {
- if (id.equals(parent.getType())) {
+ while(parent != null) {
+ if(id.equals(parent.getType())) {
return parent;
}
- parent = (View) parent.eContainer();
+ parent = (View)parent.eContainer();
}
throw new IllegalStateException("Parent Lifeline not found"); //$NON-NLS-1$
}
public static Lifeline getParentLifeline(final View view) {
final View parentLifelineView = getParentLifelineView(view);
- if (parentLifelineView != null) {
- return (Lifeline) parentLifelineView.getElement();
+ if(parentLifelineView != null) {
+ return (Lifeline)parentLifelineView.getElement();
}
return null;
}
@@ -183,7 +186,7 @@ public final class StateDefinitionUtils {
final View stateDefinitionsCompartment = ViewUtils.findSuperViewWithId(stateDefinitionView, FullLifelineStateDefinitionCompartmentEditPartCN.VISUAL_ID);
final List<View> allStateDefinitionViews = ViewUtils.findSubViewsWithId(stateDefinitionsCompartment, StateDefinitionEditPart.VISUAL_ID);
final Set<String> existingNames = new HashSet<String>();
- for (final View aStateDefinitionView : allStateDefinitionViews) {
+ for(final View aStateDefinitionView : allStateDefinitionViews) {
existingNames.add(getStateDefinitionName(aStateDefinitionView));
}
setStateDefinitionName(stateDefinitionView, findNewStateName(existingNames));
@@ -193,9 +196,9 @@ public final class StateDefinitionUtils {
String newName = ""; //$NON-NLS-1$
final String prefix = Messages.StateDefinitionUtils_State;
int suffix = 1;
- while (true) {
+ while(true) {
newName = prefix + suffix;
- if (!existingNames.contains(newName)) {
+ if(!existingNames.contains(newName)) {
break;
}
suffix++;
@@ -206,8 +209,8 @@ public final class StateDefinitionUtils {
public static View getStateDefinitionViewWithId(final String id, final View lifelineView) {
checkLifelineView(lifelineView);
final List<View> stateDefinitionViews = ViewUtils.findSubViewsWithId(lifelineView, StateDefinitionEditPart.VISUAL_ID);
- for (final View stateDefinitionView : stateDefinitionViews) {
- if (id.equals(getStateDefinitionViewID(stateDefinitionView))) {
+ for(final View stateDefinitionView : stateDefinitionViews) {
+ if(id.equals(getStateDefinitionViewID(stateDefinitionView))) {
return stateDefinitionView;
}
}
@@ -217,8 +220,8 @@ public final class StateDefinitionUtils {
public static View getStateDefinitionViewWithName(final String name, final View lifelineView) {
checkLifelineView(lifelineView);
final List<View> stateDefinitionViews = ViewUtils.findSubViewsWithId(lifelineView, StateDefinitionEditPart.VISUAL_ID);
- for (final View stateDefinitionView : stateDefinitionViews) {
- if (name.equals(getStateDefinitionName(stateDefinitionView))) {
+ for(final View stateDefinitionView : stateDefinitionViews) {
+ if(name.equals(getStateDefinitionName(stateDefinitionView))) {
return stateDefinitionView;
}
}
@@ -227,12 +230,12 @@ public final class StateDefinitionUtils {
public static List<String> getStateDefinitionIds(final Lifeline lifeline) {
final EAnnotation eAnnotation = getStateDefinitionsEAnnotation(lifeline);
- if (eAnnotation != null) {
+ if(eAnnotation != null) {
final EMap<String, String> details = eAnnotation.getDetails();
final List<String> result = new ArrayList<String>();
// note: using the iterator preserves the order
final Iterator<Entry<String, String>> iterator = details.iterator();
- while (iterator.hasNext()) {
+ while(iterator.hasNext()) {
final Entry<String, String> entry = iterator.next();
result.add(entry.getKey());
}
@@ -242,25 +245,22 @@ public final class StateDefinitionUtils {
}
private static void checkStateDefinitionView(final View stateDefinitionView) {
- if (!Integer.toString(StateDefinitionEditPart.VISUAL_ID).equals(stateDefinitionView.getType())) {
- throw new IllegalArgumentException(
- "The parameter must be a StateDefinition View (id = " + StateDefinitionEditPart.VISUAL_ID + "). The id was " + stateDefinitionView.getType()); //$NON-NLS-1$ //$NON-NLS-2$
+ if(!Integer.toString(StateDefinitionEditPart.VISUAL_ID).equals(stateDefinitionView.getType())) {
+ throw new IllegalArgumentException("The parameter must be a StateDefinition View (id = " + StateDefinitionEditPart.VISUAL_ID + "). The id was " + stateDefinitionView.getType()); //$NON-NLS-1$ //$NON-NLS-2$
}
}
private static void checkLifelineView(final View lifelineView) {
- if (!Integer.toString(FullLifelineEditPartCN.VISUAL_ID).equals(lifelineView.getType())) {
- throw new IllegalArgumentException(
- "The parameter must be a Lifeline View (id = " + FullLifelineEditPartCN.VISUAL_ID + "). The id was " + lifelineView.getType()); //$NON-NLS-1$ //$NON-NLS-2$
+ if(!Integer.toString(FullLifelineEditPartCN.VISUAL_ID).equals(lifelineView.getType())) {
+ throw new IllegalArgumentException("The parameter must be a Lifeline View (id = " + FullLifelineEditPartCN.VISUAL_ID + "). The id was " + lifelineView.getType()); //$NON-NLS-1$ //$NON-NLS-2$
}
}
/** Find the StateDefinition closest to the given y-coordinate and return it. */
public static StateDefinitionEditPart findStateDefinitionClosestToOrdinate(final FullLifelineEditPartCN lifelineEditPart, final int ordinate) {
@SuppressWarnings("unchecked")
- final List<GraphicalEditPart> editParts = (List<GraphicalEditPart>) EditPartUtils.findChildEditPartsWithId(lifelineEditPart,
- StateDefinitionEditPart.VISUAL_ID);
- return (StateDefinitionEditPart) EditPartUtils.findEditPartClosestToOrdinate(ordinate, editParts);
+ final List<GraphicalEditPart> editParts = (List<GraphicalEditPart>)EditPartUtils.findChildEditPartsWithId(lifelineEditPart, StateDefinitionEditPart.VISUAL_ID);
+ return (StateDefinitionEditPart)EditPartUtils.findEditPartClosestToOrdinate(ordinate, editParts);
}
/**
@@ -270,15 +270,15 @@ public final class StateDefinitionUtils {
* switched easily at any time.
*
* @param lifeline
- * the lifeline to update
+ * the lifeline to update
*/
public static void updateStateDefinitionNamesForCompactLifeline(final Lifeline lifeline) {
final EList<InteractionFragment> coveredBys = lifeline.getCoveredBys();
final Map<String, String> nameIdMap = new LinkedHashMap<String, String>();
// first, get all the unique state invariant names and generate the associated ids
- for (final InteractionFragment interactionFragment : coveredBys) {
- if (interactionFragment instanceof StateInvariant) {
- final StateInvariant stateInvariant = (StateInvariant) interactionFragment;
+ for(final InteractionFragment interactionFragment : coveredBys) {
+ if(interactionFragment instanceof StateInvariant) {
+ final StateInvariant stateInvariant = (StateInvariant)interactionFragment;
final String name = StateInvariantUtils.getInnerStateInvariantName(stateInvariant);
nameIdMap.put(name, EcoreUtil.generateUUID());
}
@@ -286,15 +286,15 @@ public final class StateDefinitionUtils {
// then, (re-)create the StateDefinitions
final EAnnotation stateDefinitionsEAnnotation = getOrCreateStateDefinitionsEAnnotation(lifeline);
stateDefinitionsEAnnotation.getDetails().clear();
- for (final Entry<String, String> entry : nameIdMap.entrySet()) {
+ for(final Entry<String, String> entry : nameIdMap.entrySet()) {
final String name = entry.getKey();
final String id = entry.getValue();
stateDefinitionsEAnnotation.getDetails().put(id, name);
}
// then, set the IDs on the state invariants
- for (final InteractionFragment interactionFragment : coveredBys) {
- if (interactionFragment instanceof StateInvariant) {
- final StateInvariant stateInvariant = (StateInvariant) interactionFragment;
+ for(final InteractionFragment interactionFragment : coveredBys) {
+ if(interactionFragment instanceof StateInvariant) {
+ final StateInvariant stateInvariant = (StateInvariant)interactionFragment;
final String name = StateInvariantUtils.getInnerStateInvariantName(stateInvariant);
final String id = nameIdMap.get(name);
StateInvariantUtils.setStateInvariantId(stateInvariant, id);
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/StateInvariantUtils.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/StateInvariantUtils.java
index f2d9cc26314..3022d87e5ee 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/StateInvariantUtils.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/StateInvariantUtils.java
@@ -52,6 +52,7 @@ public final class StateInvariantUtils {
/** The key for the EAnnotation on a {@link StateInvariant} */
private static final String STATE_INVARIANT_KEY = "org.eclipse.papyrus.uml.diagram.timing.StateInvariant"; //$NON-NLS-1$
+
/** The key for the corresponding StateDefinition, defined in the details map in the EAnnotation on a StateInvariant */
private static final String STATE_INVARIANT_STATE_DEFINITION_ID_KEY = "org.eclipse.papyrus.uml.diagram.timing.StateInvariantStateDefinitionId"; //$NON-NLS-1$
@@ -59,23 +60,21 @@ public final class StateInvariantUtils {
* Create a StateInvariant and its View.
*
* @param stateDefinitionId
- * the id of the state definition that the state invariant will be set to
+ * the id of the state definition that the state invariant will be set to
* @param lifelineEditPart
- * the Lifeline in which the StateInvariant must be added
+ * the Lifeline in which the StateInvariant must be added
* @param indexInFragments
- * index to insert the state invariant in the Interaction's fragments list (-1 to insert at the end)
+ * index to insert the state invariant in the Interaction's fragments list (-1 to insert at the end)
* @param indexInCoveredBys
- * index to insert the state invariant in the Lifeline's coveredBys list (-1 to insert at the end)
+ * index to insert the state invariant in the Lifeline's coveredBys list (-1 to insert at the end)
* @param indexInCompartment
- * index to insert the state invariant in the Compartment's children list (-1 to insert at the end)
+ * index to insert the state invariant in the Compartment's children list (-1 to insert at the end)
* @return the Node that represents the StateInvariant in the GMF model
*/
- public static Node createStateInvariant(final String stateDefinitionId, final FullLifelineEditPartCN lifelineEditPart, final int indexInFragments,
- final int indexInCoveredBys, final int indexInCompartment) {
- final View timelineCompartmentView = (View) EditPartUtils.findFirstChildEditPartWithId(lifelineEditPart,
- FullLifelineTimelineCompartmentEditPartCN.VISUAL_ID).getModel();
- final View lifelineView = (View) lifelineEditPart.getModel();
- final Lifeline lifeline = (Lifeline) lifelineView.getElement();
+ public static Node createStateInvariant(final String stateDefinitionId, final FullLifelineEditPartCN lifelineEditPart, final int indexInFragments, final int indexInCoveredBys, final int indexInCompartment) {
+ final View timelineCompartmentView = (View)EditPartUtils.findFirstChildEditPartWithId(lifelineEditPart, FullLifelineTimelineCompartmentEditPartCN.VISUAL_ID).getModel();
+ final View lifelineView = (View)lifelineEditPart.getModel();
+ final Lifeline lifeline = (Lifeline)lifelineView.getElement();
// create the StateInvariant
final StateInvariant newStateInvariant = UMLFactory.eINSTANCE.createStateInvariant();
@@ -86,12 +85,12 @@ public final class StateInvariantUtils {
final String stateDefinitionName = StateDefinitionUtils.getStateDefinitionName(stateDefinitionView);
newConstraint.setSpecification(newOpaqueExpression);
- if (indexInFragments == -1) {
+ if(indexInFragments == -1) {
lifeline.getInteraction().getFragments().add(newStateInvariant);
} else {
lifeline.getInteraction().getFragments().add(indexInFragments, newStateInvariant);
}
- if (indexInCoveredBys == -1) {
+ if(indexInCoveredBys == -1) {
lifeline.getCoveredBys().add(newStateInvariant);
} else {
lifeline.getCoveredBys().add(indexInCoveredBys, newStateInvariant);
@@ -103,15 +102,13 @@ public final class StateInvariantUtils {
// create the View for the new state invariant
final UMLViewProvider umlViewProvider = new UMLViewProvider();
- final Node stateInvariantNode = umlViewProvider.createStateInvariant_11(newStateInvariant, timelineCompartmentView, indexInCompartment, true,
- PreferencesHint.USE_DEFAULTS);
+ final Node stateInvariantNode = umlViewProvider.createStateInvariant_11(newStateInvariant, timelineCompartmentView, indexInCompartment, true, PreferencesHint.USE_DEFAULTS);
return stateInvariantNode;
}
- public static Node createCompactStateInvariant(final View lifelineCompartmentView, final int indexInFragments, final int indexInCoveredBys,
- final int indexInCompartment) {
+ public static Node createCompactStateInvariant(final View lifelineCompartmentView, final int indexInFragments, final int indexInCoveredBys, final int indexInCompartment) {
- final Lifeline lifeline = (Lifeline) lifelineCompartmentView.getElement();
+ final Lifeline lifeline = (Lifeline)lifelineCompartmentView.getElement();
// create the StateInvariant
final StateInvariant newStateInvariant = UMLFactory.eINSTANCE.createStateInvariant();
@@ -121,12 +118,12 @@ public final class StateInvariantUtils {
newConstraint.setSpecification(newOpaqueExpression);
- if (indexInFragments == -1) {
+ if(indexInFragments == -1) {
lifeline.getInteraction().getFragments().add(newStateInvariant);
} else {
lifeline.getInteraction().getFragments().add(indexInFragments, newStateInvariant);
}
- if (indexInCoveredBys == -1) {
+ if(indexInCoveredBys == -1) {
lifeline.getCoveredBys().add(newStateInvariant);
} else {
lifeline.getCoveredBys().add(indexInCoveredBys, newStateInvariant);
@@ -134,8 +131,7 @@ public final class StateInvariantUtils {
// create the View for the new state invariant
final UMLViewProvider umlViewProvider = new UMLViewProvider();
- final Node stateInvariantNode = umlViewProvider.createStateInvariant_28(newStateInvariant, lifelineCompartmentView, indexInCompartment, true,
- PreferencesHint.USE_DEFAULTS);
+ final Node stateInvariantNode = umlViewProvider.createStateInvariant_28(newStateInvariant, lifelineCompartmentView, indexInCompartment, true, PreferencesHint.USE_DEFAULTS);
return stateInvariantNode;
}
@@ -144,10 +140,10 @@ public final class StateInvariantUtils {
* StateInvariant and the name of the Constraint.
*
* @param stateInvariant
- * the StateInvariant whose name to update
+ * the StateInvariant whose name to update
* @param newName
- * the new name for the StateInvariant (which is the name of the corresponding StateDefinition in a full
- * Lifeline)
+ * the new name for the StateInvariant (which is the name of the corresponding StateDefinition in a full
+ * Lifeline)
*/
public static void setInnerStateInvariantName(final StateInvariant stateInvariant, final String newName) {
final Constraint constraint = stateInvariant.getInvariant();
@@ -157,7 +153,7 @@ public final class StateInvariantUtils {
final ValueSpecification specification = constraint.getSpecification();
Assert.isNotNull(specification, "The Constraint must have a ValueSpecification"); //$NON-NLS-1$
Assert.isLegal(specification instanceof OpaqueExpression, "The ValueSpecification must be an OpaqueExpression"); //$NON-NLS-1$
- final OpaqueExpression opaqueExpression = (OpaqueExpression) specification;
+ final OpaqueExpression opaqueExpression = (OpaqueExpression)specification;
// (re-)set the body
opaqueExpression.getBodies().clear();
opaqueExpression.getBodies().add(newName);
@@ -174,24 +170,23 @@ public final class StateInvariantUtils {
* </ul>
* In addition to this, in a full Lifeline, the name appears in a third place:
* <ul>
- * <li>the name of the corresponding StateDefinition (defined in the EAnnotation on the Lifeline) which has an id
- * matching the id stored in the StateInvariant's EAnnotation: this is the canonical name when in a full Lifeline
- * (see {@link StateDefinitionUtils})
+ * <li>the name of the corresponding StateDefinition (defined in the EAnnotation on the Lifeline) which has an id matching the id stored in the
+ * StateInvariant's EAnnotation: this is the canonical name when in a full Lifeline (see {@link StateDefinitionUtils})
* </ul>
*
* */
public static String getInnerStateInvariantName(final StateInvariant stateInvariant) {
final Constraint constraint = stateInvariant.getInvariant();
- if (constraint == null) {
+ if(constraint == null) {
return null;
}
final ValueSpecification specification = constraint.getSpecification();
- if (specification == null || !(specification instanceof OpaqueExpression)) {
+ if(specification == null || !(specification instanceof OpaqueExpression)) {
return null;
}
- final OpaqueExpression opaqueExpression = (OpaqueExpression) specification;
+ final OpaqueExpression opaqueExpression = (OpaqueExpression)specification;
final EList<String> bodies = opaqueExpression.getBodies();
- if (bodies == null || bodies.size() < 1) {
+ if(bodies == null || bodies.size() < 1) {
return null;
}
return bodies.get(0);
@@ -204,7 +199,7 @@ public final class StateInvariantUtils {
public static String getStateInvariantId(final StateInvariant stateInvariant) {
final EAnnotation eAnnotation = stateInvariant.getEAnnotation(STATE_INVARIANT_KEY);
- if (eAnnotation != null) {
+ if(eAnnotation != null) {
return eAnnotation.getDetails().get(STATE_INVARIANT_STATE_DEFINITION_ID_KEY);
}
return null;
@@ -212,7 +207,7 @@ public final class StateInvariantUtils {
private static EAnnotation getOrCreateStateInvariantEAnnotation(final StateInvariant stateInvariant) {
EAnnotation eAnnotation = stateInvariant.getEAnnotation(STATE_INVARIANT_KEY);
- if (eAnnotation == null) {
+ if(eAnnotation == null) {
eAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
eAnnotation.setSource(STATE_INVARIANT_KEY);
stateInvariant.getEAnnotations().add(eAnnotation);
@@ -224,11 +219,11 @@ public final class StateInvariantUtils {
public static List<StateInvariant> findStateInvariantsWithId(final String id, final Interaction interaction) {
final List<StateInvariant> stateInvariants = new ArrayList<StateInvariant>();
final EList<InteractionFragment> fragments = interaction.getFragments();
- for (final InteractionFragment interactionFragment : fragments) {
- if (interactionFragment instanceof StateInvariant) {
- final StateInvariant stateInvariant = (StateInvariant) interactionFragment;
+ for(final InteractionFragment interactionFragment : fragments) {
+ if(interactionFragment instanceof StateInvariant) {
+ final StateInvariant stateInvariant = (StateInvariant)interactionFragment;
final String stateInvariantId = getStateInvariantId(stateInvariant);
- if (id.equals(stateInvariantId)) {
+ if(id.equals(stateInvariantId)) {
stateInvariants.add(stateInvariant);
}
}
@@ -240,15 +235,15 @@ public final class StateInvariantUtils {
* Get all elements to delete when deleting a StateInvariant.
*
* @param stateInvariant
- * the StateInvariant being deleted
+ * the StateInvariant being deleted
* @return the elements (EObjects and Views) that should be deleted together with the StateInvariant
* @throws OperationForbiddenException
- * if the StateInvariant should not be deleted
+ * if the StateInvariant should not be deleted
*/
public static Collection<EObject> getElementsToDelete(final StateInvariant stateInvariant) throws OperationForbiddenException {
final Set<EObject> elementsToDestroy = new HashSet<EObject>();
final Set<View> crossReferencingViews = CrossReferencerUtil.getCrossReferencingViews(stateInvariant, TimingDiagramEditPart.MODEL_ID);
- for (final View view : crossReferencingViews) {
+ for(final View view : crossReferencingViews) {
elementsToDestroy.addAll(getElementsToRemove(view, false));
}
return elementsToDestroy;
@@ -258,18 +253,18 @@ public final class StateInvariantUtils {
* Get all Views to remove when hiding a StateInvariant (i.e., deleting a StateInvariant's View).
*
* @param stateInvariant
- * the StateInvariant being hidden
+ * the StateInvariant being hidden
* @return the Views that should be hidden together with the given StateInvariant View
* @throws OperationForbiddenException
- * if the StateInvariant should not be hidden
+ * if the StateInvariant should not be hidden
*/
public static Collection<View> getViewsToHide(final View stateInvariantView) throws OperationForbiddenException {
final Set<View> viewsToHide = new HashSet<View>();
final Collection<EObject> elementsToRemove = getElementsToRemove(stateInvariantView, true);
- for (final EObject eObject : elementsToRemove) {
- if (eObject instanceof View) {
- viewsToHide.add((View) eObject);
+ for(final EObject eObject : elementsToRemove) {
+ if(eObject instanceof View) {
+ viewsToHide.add((View)eObject);
} else {
throw new IllegalStateException("Only views should be returned"); //$NON-NLS-1$
}
@@ -281,44 +276,44 @@ public final class StateInvariantUtils {
* Get all elements to remove when removing a StateInvariant.
*
* @param view
- * the StateInvariant View being removed
+ * the StateInvariant View being removed
* @param hideOnly
- * if <code>true</code>, only return the Views, not the semantic elements
+ * if <code>true</code>, only return the Views, not the semantic elements
* @return the elements (Views and EObjects if <code>hideOnly</code> is <code>false</code>) that should be removed
* together with the StateInvariant
* @throws OperationForbiddenException
- * if the StateInvariant should not be removed
+ * if the StateInvariant should not be removed
*/
public static Collection<EObject> getElementsToRemove(final View view, final boolean hideOnly) throws OperationForbiddenException {
final Set<EObject> elementsToRemove = new HashSet<EObject>();
final boolean fullStateInvariant = view.getType().equals(Constants.fullStateInvariantId);
final boolean compactStateInvariant = view.getType().equals(Constants.compactStateInvariantId);
- if (fullStateInvariant || compactStateInvariant) {
+ if(fullStateInvariant || compactStateInvariant) {
// only remove Views under the same Interaction
final View interactionView = ViewUtils.findSuperViewWithId(view, InteractionEditPartTN.VISUAL_ID);
- final StateInvariant stateInvariant = (StateInvariant) view.getElement();
+ final StateInvariant stateInvariant = (StateInvariant)view.getElement();
elementsToRemove.addAll(getRelatedElementsToRemove(stateInvariant, hideOnly, interactionView));
final EObject eContainer = view.eContainer();
- if (eContainer instanceof Node) {
- final Node node = (Node) eContainer;
+ if(eContainer instanceof Node) {
+ final Node node = (Node)eContainer;
@SuppressWarnings("unchecked")
final EList<View> children = node.getChildren();
int nStateInvariants = 0;
- for (final View childView : children) {
- if (childView.getType().equals(Constants.fullStateInvariantId) || childView.getType().equals(Constants.compactStateInvariantId)) {
+ for(final View childView : children) {
+ if(childView.getType().equals(Constants.fullStateInvariantId) || childView.getType().equals(Constants.compactStateInvariantId)) {
nStateInvariants++;
}
}
- if (nStateInvariants <= 1) {
+ if(nStateInvariants <= 1) {
// don't allow deleting the only StateInvariant (since this renders the diagram unusable)
throw new OperationForbiddenException();
}
- if (fullStateInvariant) {
+ if(fullStateInvariant) {
elementsToRemove.addAll(getElementsToRemoveForFullStateInvariant(view, children, hideOnly, interactionView));
- } else if (compactStateInvariant) {
+ } else if(compactStateInvariant) {
elementsToRemove.addAll(getElementsToRemoveForCompactStateInvariant(view, children, hideOnly, interactionView));
}
}
@@ -334,40 +329,39 @@ public final class StateInvariantUtils {
return elementsToRemove;
}
- private static Collection<EObject> getElementsToRemoveForFullStateInvariant(final View stateInvariantView, final EList<View> children,
- final boolean hideOnly, final View interactionView) {
+ private static Collection<EObject> getElementsToRemoveForFullStateInvariant(final View stateInvariantView, final EList<View> children, final boolean hideOnly, final View interactionView) {
final Set<EObject> elementsToRemove = new HashSet<EObject>();
final int childrenSize = children.size();
final int index = children.indexOf(stateInvariantView);
- if (index == 0) {
+ if(index == 0) {
// first StateInvariant: remove the OccurrenceSpecification and VerticalLine AFTER it
- if (index + 1 < childrenSize) {
+ if(index + 1 < childrenSize) {
final View following = children.get(index + 1);
- if (OccurrenceSpecificationUtils.isOccurrenceSpecificationView(following)) {
+ if(OccurrenceSpecificationUtils.isOccurrenceSpecificationView(following)) {
addElementToRemove(following, hideOnly, interactionView, elementsToRemove);
}
}
- if (index + 2 < childrenSize) {
+ if(index + 2 < childrenSize) {
final View following = children.get(index + 2);
- if (following.getType().equals(Constants.verticalLineId)) {
+ if(following.getType().equals(Constants.verticalLineId)) {
elementsToRemove.add(following);
}
}
} else {
// other StateInvariant: remove the VerticalLine and OccurrenceSpecification BEFORE it
- if (index >= 1) {
+ if(index >= 1) {
final View preceding = children.get(index - 1);
- if (preceding.getType().equals(Constants.verticalLineId)) {
+ if(preceding.getType().equals(Constants.verticalLineId)) {
elementsToRemove.add(preceding);
}
// in the case of a creation Message
- if (OccurrenceSpecificationUtils.isOccurrenceSpecificationView(preceding)) {
+ if(OccurrenceSpecificationUtils.isOccurrenceSpecificationView(preceding)) {
addElementToRemove(preceding, hideOnly, interactionView, elementsToRemove);
}
}
- if (index >= 2) {
+ if(index >= 2) {
final View preceding = children.get(index - 2);
- if (OccurrenceSpecificationUtils.isOccurrenceSpecificationView(preceding)) {
+ if(OccurrenceSpecificationUtils.isOccurrenceSpecificationView(preceding)) {
addElementToRemove(preceding, hideOnly, interactionView, elementsToRemove);
}
}
@@ -375,16 +369,15 @@ public final class StateInvariantUtils {
return elementsToRemove;
}
- private static Collection<EObject> getElementsToRemoveForCompactStateInvariant(final View stateInvariantView, final EList<View> children,
- final boolean hideOnly, final View interactionView) {
+ private static Collection<EObject> getElementsToRemoveForCompactStateInvariant(final View stateInvariantView, final EList<View> children, final boolean hideOnly, final View interactionView) {
final Set<EObject> elementsToRemove = new HashSet<EObject>();
final int index = children.indexOf(stateInvariantView);
- if (index == 0) {
+ if(index == 0) {
// first StateInvariant: remove the OccurrenceSpecification AFTER it
// (and all the OccurrenceSpecifications on top of it)
- for (int i = index + 1; i < children.size(); i++) {
+ for(int i = index + 1; i < children.size(); i++) {
final View view = children.get(i);
- if (OccurrenceSpecificationUtils.isOccurrenceSpecificationView(view)) {
+ if(OccurrenceSpecificationUtils.isOccurrenceSpecificationView(view)) {
addElementToRemove(view, hideOnly, interactionView, elementsToRemove);
} else {
break;
@@ -392,22 +385,21 @@ public final class StateInvariantUtils {
}
} else {
// other StateInvariant: remove the OccurrenceSpecification BEFORE it
- if (index >= 1) {
+ if(index >= 1) {
final View preceding = children.get(index - 1);
- if (OccurrenceSpecificationUtils.isOccurrenceSpecificationView(preceding)) {
+ if(OccurrenceSpecificationUtils.isOccurrenceSpecificationView(preceding)) {
addElementToRemove(preceding, hideOnly, interactionView, elementsToRemove);
}
}
// and all the OccurrenceSpecifications on top of it (until a state change occurrence)
- for (int i = index + 1; i < children.size(); i++) {
+ for(int i = index + 1; i < children.size(); i++) {
View following = null;
- if (i + 1 < children.size()) {
+ if(i + 1 < children.size()) {
following = children.get(i + 1);
}
final View view = children.get(i);
// if this is not a state change occurrence then delete it
- if (OccurrenceSpecificationUtils.isOccurrenceSpecificationView(view)
- && (following == null || !StateInvariantUtils.isStateInvariantView(following))) {
+ if(OccurrenceSpecificationUtils.isOccurrenceSpecificationView(view) && (following == null || !StateInvariantUtils.isStateInvariantView(following))) {
addElementToRemove(view, hideOnly, interactionView, elementsToRemove);
} else {
break;
@@ -421,12 +413,12 @@ public final class StateInvariantUtils {
private static void addElementToRemove(final View viewToRemove, final boolean hideOnly, final View interactionView, final Set<EObject> elementsToRemove) {
final EObject element = viewToRemove.getElement();
elementsToRemove.add(viewToRemove);
- if (!hideOnly) {
+ if(!hideOnly) {
elementsToRemove.add(element);
}
- if (element instanceof StateInvariant) {
+ if(element instanceof StateInvariant) {
elementsToRemove.addAll(StateInvariantUtils.getRelatedElementsToRemove(element, hideOnly, interactionView));
- } else if (element instanceof OccurrenceSpecification) {
+ } else if(element instanceof OccurrenceSpecification) {
elementsToRemove.addAll(OccurrenceSpecificationUtils.getRelatedElementsToRemove(element, hideOnly, interactionView));
} else {
throw new UnsupportedOperationException();
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/TickUtils.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/TickUtils.java
index 5303446dc36..1d96419a7cb 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/TickUtils.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/TickUtils.java
@@ -30,6 +30,7 @@ import org.eclipse.uml2.uml.OccurrenceSpecification;
public final class TickUtils {
private static final String OCCURRENCE_TO_TICK_ANNOTATION = "occurrenceToTick"; //$NON-NLS-1$
+
private static final String TICK_TO_OCCURRENCE_ANNOTATION = "tickToOccurrence"; //$NON-NLS-1$
private TickUtils() {
@@ -42,7 +43,7 @@ public final class TickUtils {
checkOccurrenceSpecificationView(occurrenceNode);
// associate tick to occurrence
final EAnnotation tickEAnnotation = TickUtils.getOrCreateTickEAnnotation(tickNode);
- if (overwrite) {
+ if(overwrite) {
clearTickAssociation(tickNode, tickEAnnotation);
}
Assert.isLegal(tickEAnnotation.getReferences().isEmpty(), "A tick can only be associated to one occurrence"); //$NON-NLS-1$
@@ -55,9 +56,9 @@ public final class TickUtils {
/** Remove associations for this tick to any occurrences, and from associated occurrences to this tick. */
private static void clearTickAssociation(final Node tickNode, final EAnnotation tickEAnnotation) {
final EList<EObject> references = tickEAnnotation.getReferences();
- for (final EObject eObject : references) {
- final EAnnotation occurrenceAnnotation = ((EModelElement) eObject).getEAnnotation(OCCURRENCE_TO_TICK_ANNOTATION);
- if (occurrenceAnnotation != null) {
+ for(final EObject eObject : references) {
+ final EAnnotation occurrenceAnnotation = ((EModelElement)eObject).getEAnnotation(OCCURRENCE_TO_TICK_ANNOTATION);
+ if(occurrenceAnnotation != null) {
occurrenceAnnotation.getReferences().remove(tickNode);
}
}
@@ -67,17 +68,17 @@ public final class TickUtils {
public static Node getAssociatedOccurrenceView(final View tickView) {
checkTickView(tickView);
final EAnnotation eAnnotation = tickView.getEAnnotation(TICK_TO_OCCURRENCE_ANNOTATION);
- if (eAnnotation != null) {
+ if(eAnnotation != null) {
final EList<EObject> references = eAnnotation.getReferences();
- if (references.isEmpty()) {
+ if(references.isEmpty()) {
throw new IllegalStateException("A tick must be associated to one occurrence"); //$NON-NLS-1$
}
- if (references.size() > 1) {
+ if(references.size() > 1) {
throw new IllegalStateException("A tick can be associated to only one occurrence"); //$NON-NLS-1$
}
final EObject eObject = references.get(0);
- if (eObject instanceof Node) {
- final Node node = (Node) eObject;
+ if(eObject instanceof Node) {
+ final Node node = (Node)eObject;
checkOccurrenceSpecificationView(node);
return node;
}
@@ -90,11 +91,11 @@ public final class TickUtils {
final List<Node> result = new ArrayList<Node>();
checkOccurrenceSpecificationView(occurrenceView);
final EAnnotation eAnnotation = occurrenceView.getEAnnotation(OCCURRENCE_TO_TICK_ANNOTATION);
- if (eAnnotation != null) {
+ if(eAnnotation != null) {
final EList<EObject> references = eAnnotation.getReferences();
- for (final EObject eObject : references) {
- if (eObject instanceof Node) {
- final Node node = (Node) eObject;
+ for(final EObject eObject : references) {
+ if(eObject instanceof Node) {
+ final Node node = (Node)eObject;
checkTickView(node);
result.add(node);
} else {
@@ -106,12 +107,12 @@ public final class TickUtils {
}
public static IGraphicalEditPart findOccurrenceSpecificationEditPartFromTickEditPart(final TickEditPart tickEditPart, final EditPartViewer viewer) {
- if (tickEditPart != null) {
- final Node tickNode = (Node) tickEditPart.getModel();
+ if(tickEditPart != null) {
+ final Node tickNode = (Node)tickEditPart.getModel();
final Node occurrenceView = TickUtils.getAssociatedOccurrenceView(tickNode);
- if (occurrenceView != null) {
- final IGraphicalEditPart occurrenceSpecificationEditPart = (IGraphicalEditPart) viewer.getEditPartRegistry().get(occurrenceView);
- if (occurrenceSpecificationEditPart != null) {
+ if(occurrenceView != null) {
+ final IGraphicalEditPart occurrenceSpecificationEditPart = (IGraphicalEditPart)viewer.getEditPartRegistry().get(occurrenceView);
+ if(occurrenceSpecificationEditPart != null) {
return occurrenceSpecificationEditPart;
}
}
@@ -122,12 +123,12 @@ public final class TickUtils {
public static boolean containsTickFor(final View parentView, final OccurrenceSpecification occurrenceSpecification) {
@SuppressWarnings("unchecked")
final EList<View> children = parentView.getChildren();
- for (final View child : children) {
+ for(final View child : children) {
checkTickView(child);
final Node occurrenceView = TickUtils.getAssociatedOccurrenceView(child);
- if (occurrenceView != null) {
+ if(occurrenceView != null) {
final EObject element = occurrenceView.getElement();
- if (element == occurrenceSpecification) {
+ if(element == occurrenceSpecification) {
return true;
}
}
@@ -138,7 +139,7 @@ public final class TickUtils {
private static EAnnotation getOrCreateTickEAnnotation(final View tickView) {
checkTickView(tickView);
EAnnotation eAnnotation = tickView.getEAnnotation(TICK_TO_OCCURRENCE_ANNOTATION);
- if (eAnnotation == null) {
+ if(eAnnotation == null) {
eAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
eAnnotation.setSource(TICK_TO_OCCURRENCE_ANNOTATION);
tickView.getEAnnotations().add(eAnnotation);
@@ -149,7 +150,7 @@ public final class TickUtils {
private static EAnnotation getOrCreateOccurrenceEAnnotation(final View occurrenceView) {
checkOccurrenceSpecificationView(occurrenceView);
EAnnotation eAnnotation = occurrenceView.getEAnnotation(OCCURRENCE_TO_TICK_ANNOTATION);
- if (eAnnotation == null) {
+ if(eAnnotation == null) {
eAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
eAnnotation.setSource(OCCURRENCE_TO_TICK_ANNOTATION);
occurrenceView.getEAnnotations().add(eAnnotation);
@@ -158,15 +159,13 @@ public final class TickUtils {
}
private static void checkTickView(final View tickView) {
- if (!Integer.toString(TickEditPart.VISUAL_ID).equals(tickView.getType())) {
+ if(!Integer.toString(TickEditPart.VISUAL_ID).equals(tickView.getType())) {
throw new IllegalArgumentException("The parameter must be a tick View (id = " + TickEditPart.VISUAL_ID + "). The id was " + tickView.getType()); //$NON-NLS-1$ //$NON-NLS-2$
}
}
private static void checkOccurrenceSpecificationView(final View occurrenceSpecificationView) {
- if (!Integer.toString(OccurrenceSpecificationEditPartCN.VISUAL_ID).equals(occurrenceSpecificationView.getType())
- && !Integer.toString(MessageOccurrenceSpecificationEditPartCN.VISUAL_ID).equals(occurrenceSpecificationView.getType())
- && !Integer.toString(DestructionOccurrenceSpecificationEditPartCN.VISUAL_ID).equals(occurrenceSpecificationView.getType())) {
+ if(!Integer.toString(OccurrenceSpecificationEditPartCN.VISUAL_ID).equals(occurrenceSpecificationView.getType()) && !Integer.toString(MessageOccurrenceSpecificationEditPartCN.VISUAL_ID).equals(occurrenceSpecificationView.getType()) && !Integer.toString(DestructionOccurrenceSpecificationEditPartCN.VISUAL_ID).equals(occurrenceSpecificationView.getType())) {
throw new IllegalArgumentException("The parameter must be an Occurrencespecification View. The id was " + occurrenceSpecificationView.getType()); //$NON-NLS-1$
}
}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/TimeElementUtils.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/TimeElementUtils.java
index a1d32534496..ccb77ddc9bb 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/TimeElementUtils.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/TimeElementUtils.java
@@ -20,44 +20,40 @@ import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimeConstraintEditPart;
import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimeObservationEditPart;
import org.eclipse.uml2.uml.DurationConstraint;
import org.eclipse.uml2.uml.DurationObservation;
-import org.eclipse.uml2.uml.OccurrenceSpecification;
-import org.eclipse.uml2.uml.StateInvariant;
import org.eclipse.uml2.uml.TimeConstraint;
import org.eclipse.uml2.uml.TimeObservation;
import org.eclipse.uml2.uml.UMLPackage;
public final class TimeElementUtils {
+
private TimeElementUtils() {
// utility class
}
public static boolean isTimeElementEditPart(final int visualID) {
- return visualID == TimeObservationEditPart.VISUAL_ID || visualID == TimeConstraintEditPart.VISUAL_ID
- || visualID == DurationObservationEditPartCN.VISUAL_ID || visualID == DurationConstraintEditPartCN.VISUAL_ID;
+ return visualID == TimeObservationEditPart.VISUAL_ID || visualID == TimeConstraintEditPart.VISUAL_ID || visualID == DurationObservationEditPartCN.VISUAL_ID || visualID == DurationConstraintEditPartCN.VISUAL_ID;
}
public static boolean isTimeElementEditPart(final EditPart editPart) {
- return editPart instanceof TimeObservationEditPart || editPart instanceof TimeConstraintEditPart || editPart instanceof DurationObservationEditPartCN
- || editPart instanceof DurationConstraintEditPartCN;
+ return editPart instanceof TimeObservationEditPart || editPart instanceof TimeConstraintEditPart || editPart instanceof DurationObservationEditPartCN || editPart instanceof DurationConstraintEditPartCN;
}
/**
- * Find time elements ({@link TimeObservation}s, {@link DurationObservation}s, {@link TimeConstraint}s and
- * {@link DurationConstraint}s) linked to the given element.
+ * Find time elements ({@link TimeObservation}s, {@link DurationObservation}s, {@link TimeConstraint}s and {@link DurationConstraint}s) linked to
+ * the given element.
*
* @param element
- * the {@link OccurrenceSpecification} or {@link StateInvariant} for which related time elements must be
- * found
+ * the {@link OccurrenceSpecification} or {@link StateInvariant} for which related time elements must be
+ * found
* @param hideOnly
- * whether to only return Views
+ * whether to only return Views
* @param expectedParentView
- * if not <code>null</code>, then only return Views under this parent View
+ * if not <code>null</code>, then only return Views under this parent View
* @return the list of linked time elements to remove
*/
public static Set<EObject> getTimeElementsToRemove(final EObject element, final boolean hideOnly, final View expectedParentView) {
- final EReference[] references = new EReference[] { UMLPackage.eINSTANCE.getDurationObservation_Event(),
- UMLPackage.eINSTANCE.getTimeObservation_Event(), UMLPackage.eINSTANCE.getConstraint_ConstrainedElement() };
- final Class<?>[] expectedClasses = new Class<?>[] { TimeObservation.class, DurationObservation.class, TimeConstraint.class, DurationConstraint.class };
+ final EReference[] references = new EReference[]{ UMLPackage.eINSTANCE.getDurationObservation_Event(), UMLPackage.eINSTANCE.getTimeObservation_Event(), UMLPackage.eINSTANCE.getConstraint_ConstrainedElement() };
+ final Class<?>[] expectedClasses = new Class<?>[]{ TimeObservation.class, DurationObservation.class, TimeConstraint.class, DurationConstraint.class };
return Utils.getReferencingElementsToRemove(element, references, hideOnly, expectedParentView, expectedClasses);
}
}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/TimeRulerUtils.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/TimeRulerUtils.java
index 1df375b1c0c..6612755c2ec 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/TimeRulerUtils.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/TimeRulerUtils.java
@@ -31,6 +31,7 @@ import org.eclipse.papyrus.uml.diagram.timing.part.UMLDiagramEditorPlugin;
import org.eclipse.papyrus.uml.diagram.timing.providers.UMLViewProvider;
public final class TimeRulerUtils {
+
private TimeRulerUtils() {
// utility class
}
@@ -44,27 +45,27 @@ public final class TimeRulerUtils {
*/
/**
* @param createViewCommand
- * the command that creates a Lifeline or Interaction View
+ * the command that creates a Lifeline or Interaction View
* @param editingDomain
- * an editing domain
+ * an editing domain
* @param visible
- * whether the time ruler should be visible initially
+ * whether the time ruler should be visible initially
* @return the time ruler creation command
*/
public static ICommand getCreateFreeTimeRulerCommand(final Command createViewCommand, final TransactionalEditingDomain editingDomain, final boolean visible) {
- final CommandResult superCommandResult = ((ICommandProxy) createViewCommand).getICommand().getCommandResult();
+ final CommandResult superCommandResult = ((ICommandProxy)createViewCommand).getICommand().getCommandResult();
// final Interaction interaction = (Interaction) superCommandResult.getElement();
- if (editingDomain == null) {
+ if(editingDomain == null) {
throw new IllegalStateException("no editing domain"); //$NON-NLS-1$
}
- final AbstractTransactionalCommand createFreeTimeRulerCommand = new AbstractTransactionalCommand(editingDomain,
- Messages.CustomTimeRulerCreationEditPolicy_CreateFreeTimeRuler, null) {
+ final AbstractTransactionalCommand createFreeTimeRulerCommand = new AbstractTransactionalCommand(editingDomain, Messages.CustomTimeRulerCreationEditPolicy_CreateFreeTimeRuler, null) {
+
@Override
protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
// the result from the super command that creates the view
- final ViewDescriptor viewDescriptor = (ViewDescriptor) superCommandResult.getReturnValue();
- final View view = (View) viewDescriptor.getAdapter(View.class);
+ final ViewDescriptor viewDescriptor = (ViewDescriptor)superCommandResult.getReturnValue();
+ final View view = (View)viewDescriptor.getAdapter(View.class);
final Node freeTimeRulerNode = createFreeTimeRuler(view);
final View timeRulerCompartmentView = ViewUtils.findTimeRulerCompartmentView(view);
timeRulerCompartmentView.setVisible(visible);
@@ -86,23 +87,19 @@ public final class TimeRulerUtils {
* Interaction's time ruler.
*/
public static IGraphicalEditPart findClosestTimeRuler(final IGraphicalEditPart editPart) {
- IGraphicalEditPart lifelineEditPart = (IGraphicalEditPart) EditPartUtils.findParentEditPartWithId(editPart, CompactLifelineEditPartCN.VISUAL_ID);
- if (lifelineEditPart == null) {
- lifelineEditPart = (IGraphicalEditPart) EditPartUtils.findParentEditPartWithId(editPart, FullLifelineEditPartCN.VISUAL_ID);
+ IGraphicalEditPart lifelineEditPart = (IGraphicalEditPart)EditPartUtils.findParentEditPartWithId(editPart, CompactLifelineEditPartCN.VISUAL_ID);
+ if(lifelineEditPart == null) {
+ lifelineEditPart = (IGraphicalEditPart)EditPartUtils.findParentEditPartWithId(editPart, FullLifelineEditPartCN.VISUAL_ID);
}
- if (lifelineEditPart != null) {
- IGraphicalEditPart tickContainerEditPart = (IGraphicalEditPart) EditPartUtils.findFirstChildEditPartWithId(lifelineEditPart,
- FreeTimeRulerCompartmentEditPart.VISUAL_ID);
- if (tickContainerEditPart == null) {
+ if(lifelineEditPart != null) {
+ IGraphicalEditPart tickContainerEditPart = (IGraphicalEditPart)EditPartUtils.findFirstChildEditPartWithId(lifelineEditPart, FreeTimeRulerCompartmentEditPart.VISUAL_ID);
+ if(tickContainerEditPart == null) {
// then tickContainer is in the Interaction
- final IGraphicalEditPart interactionEditPart = (IGraphicalEditPart) EditPartUtils.findParentEditPartWithId(lifelineEditPart,
- InteractionEditPartTN.VISUAL_ID);
- if (interactionEditPart != null) {
- final IGraphicalEditPart interactionTimeRulerCompartmentEditPart = (IGraphicalEditPart) EditPartUtils.findFirstChildEditPartWithId(
- interactionEditPart, TimeRulerCompartmentEditPartCN.VISUAL_ID);
- if (interactionTimeRulerCompartmentEditPart != null) {
- tickContainerEditPart = (IGraphicalEditPart) EditPartUtils.findFirstChildEditPartWithId(interactionTimeRulerCompartmentEditPart,
- FreeTimeRulerCompartmentEditPart.VISUAL_ID);
+ final IGraphicalEditPart interactionEditPart = (IGraphicalEditPart)EditPartUtils.findParentEditPartWithId(lifelineEditPart, InteractionEditPartTN.VISUAL_ID);
+ if(interactionEditPart != null) {
+ final IGraphicalEditPart interactionTimeRulerCompartmentEditPart = (IGraphicalEditPart)EditPartUtils.findFirstChildEditPartWithId(interactionEditPart, TimeRulerCompartmentEditPartCN.VISUAL_ID);
+ if(interactionTimeRulerCompartmentEditPart != null) {
+ tickContainerEditPart = (IGraphicalEditPart)EditPartUtils.findFirstChildEditPartWithId(interactionTimeRulerCompartmentEditPart, FreeTimeRulerCompartmentEditPart.VISUAL_ID);
}
}
}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/Utils.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/Utils.java
index 662fe71b801..28444dd7fa2 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/Utils.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/Utils.java
@@ -35,12 +35,13 @@ import org.eclipse.papyrus.uml.diagram.timing.edit.parts.TimingDiagramEditPart;
import org.eclipse.swt.widgets.Display;
public final class Utils {
+
private Utils() {
// utility class
}
public static boolean safeEquals(final Object a, final Object b) {
- if (a == null) {
+ if(a == null) {
return b == null;
}
return a.equals(b);
@@ -51,30 +52,29 @@ public final class Utils {
* elements are returned)
*
* @param element
- * the element for which related elements must be found
+ * the element for which related elements must be found
* @param references
- * the references through which the referencing elements must be found
+ * the references through which the referencing elements must be found
* @param viewsOnly
- * whether to only return Views (otherwise both Views and semantic elements are returned).
+ * whether to only return Views (otherwise both Views and semantic elements are returned).
* @param expectedParentView
- * if not <code>null</code>, then only return Views under this parent View
+ * if not <code>null</code>, then only return Views under this parent View
* @param expectedClasses
- * the classes of referencing elements to remove
+ * the classes of referencing elements to remove
* @return the list of linked elements to remove
*/
- public static Set<EObject> getReferencingElementsToRemove(final EObject element, final EReference[] references, final boolean viewsOnly,
- final View expectedParentView, final Class<?>[] expectedClasses) {
+ public static Set<EObject> getReferencingElementsToRemove(final EObject element, final EReference[] references, final boolean viewsOnly, final View expectedParentView, final Class<?>[] expectedClasses) {
final Set<EObject> referencingElements = new HashSet<EObject>();
final Collection<?> referencers = EMFCoreUtil.getReferencers(element, references);
- for (final Object object : referencers) {
- if (object instanceof EObject && isExpectedClass(object, expectedClasses)) {
- final EObject eObject = (EObject) object;
- if (!viewsOnly) {
+ for(final Object object : referencers) {
+ if(object instanceof EObject && isExpectedClass(object, expectedClasses)) {
+ final EObject eObject = (EObject)object;
+ if(!viewsOnly) {
referencingElements.add(eObject);
}
final Set<View> crossReferencingViews = CrossReferencerUtil.getCrossReferencingViews(eObject, TimingDiagramEditPart.MODEL_ID);
- for (final View view : crossReferencingViews) {
- if (expectedParentView == null || ViewUtils.isContained(view, expectedParentView)) {
+ for(final View view : crossReferencingViews) {
+ if(expectedParentView == null || ViewUtils.isContained(view, expectedParentView)) {
referencingElements.add(view);
}
}
@@ -84,8 +84,8 @@ public final class Utils {
}
private static boolean isExpectedClass(final Object object, final Class<?>[] expectedClasses) {
- for (final Class<?> expectedClass : expectedClasses) {
- if (expectedClass.isInstance(object)) {
+ for(final Class<?> expectedClass : expectedClasses) {
+ if(expectedClass.isInstance(object)) {
return true;
}
}
@@ -97,16 +97,18 @@ public final class Utils {
* command is scheduled to be executed later, in order to be run outside any currently running transaction.
*
* @param command
- * the command to execute
+ * the command to execute
* @param domain
- * the editing domain
+ * the editing domain
*/
public static void executeLaterUnprotected(final Command command, final TransactionalEditingDomain domain) {
Display.getCurrent().asyncExec(new Runnable() {
+
public void run() {
try {
final Map<String, Boolean> options = Collections.singletonMap(Transaction.OPTION_UNPROTECTED, Boolean.TRUE);
final AbstractEMFOperation operation = new AbstractEMFOperation(domain, StringStatics.BLANK, options) {
+
@Override
protected IStatus doExecute(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
command.execute();
@@ -125,19 +127,19 @@ public final class Utils {
* Find model elements linked to the given element
*
* @param element
- * the element for which related elements must be found
+ * the element for which related elements must be found
* @param references
- * the references through which the referencing elements must be found
+ * the references through which the referencing elements must be found
* @param expectedClasses
- * the classes of referencing elements to look for
+ * the classes of referencing elements to look for
* @return the list of linked elements
*/
public static Set<EObject> findReferencingElements(final EObject element, final EReference[] references, final Class<?>[] expectedClasses) {
final Set<EObject> referencingElements = new HashSet<EObject>();
final Collection<?> referencers = EMFCoreUtil.getReferencers(element, references);
- for (final Object object : referencers) {
- if (object instanceof EObject && isExpectedClass(object, expectedClasses)) {
- final EObject eObject = (EObject) object;
+ for(final Object object : referencers) {
+ if(object instanceof EObject && isExpectedClass(object, expectedClasses)) {
+ final EObject eObject = (EObject)object;
referencingElements.add(eObject);
}
}
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/ViewUtils.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/ViewUtils.java
index a65ec8aa787..2c876920d14 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/ViewUtils.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/utils/ViewUtils.java
@@ -48,9 +48,10 @@ import org.eclipse.papyrus.uml.diagram.timing.part.UMLVisualIDRegistry;
import org.eclipse.swt.widgets.Display;
public class ViewUtils {
+
public static View findFullLifelineCompartmentView(final View lifelineView) {
final List<View> timelineCompartmentViews = findSubViewsWithId(lifelineView, FullLifelineTimelineCompartmentEditPartCN.VISUAL_ID);
- if (timelineCompartmentViews.size() < 1) {
+ if(timelineCompartmentViews.size() < 1) {
throw new IllegalStateException("No timeline compartment found in the lifeline View"); //$NON-NLS-1$
}
return timelineCompartmentViews.get(0);
@@ -58,7 +59,7 @@ public class ViewUtils {
public static View findCompactTimelineCompartmentView(final View lifelineView) {
final List<View> timelineCompartmentViews = findSubViewsWithId(lifelineView, CompactLifelineCompartmentEditPartCN.VISUAL_ID);
- if (timelineCompartmentViews.size() < 1) {
+ if(timelineCompartmentViews.size() < 1) {
throw new IllegalStateException("No timeline compartment found in the lifeline View"); //$NON-NLS-1$
}
return timelineCompartmentViews.get(0);
@@ -66,11 +67,11 @@ public class ViewUtils {
public static View findChildTimelineCompartmentView(final View view) {
List<View> timelineCompartmentViews = findSubViewsWithId(view, FullLifelineTimelineCompartmentEditPartCN.VISUAL_ID);
- if (!timelineCompartmentViews.isEmpty()) {
+ if(!timelineCompartmentViews.isEmpty()) {
return timelineCompartmentViews.get(0);
}
timelineCompartmentViews = findSubViewsWithId(view, CompactLifelineCompartmentEditPartCN.VISUAL_ID);
- if (!timelineCompartmentViews.isEmpty()) {
+ if(!timelineCompartmentViews.isEmpty()) {
return timelineCompartmentViews.get(0);
}
throw new IllegalStateException("No timeline compartment found in the given View"); //$NON-NLS-1$
@@ -78,15 +79,15 @@ public class ViewUtils {
public static View findTimeRulerCompartmentView(final View view) {
List<View> timeRulerCompartmentViews = findSubViewsWithId(view, TimeRulerCompartmentEditPartCN.VISUAL_ID);
- if (!timeRulerCompartmentViews.isEmpty()) {
+ if(!timeRulerCompartmentViews.isEmpty()) {
return timeRulerCompartmentViews.get(0);
}
timeRulerCompartmentViews = findSubViewsWithId(view, FullLifelineTimeRulerCompartmentEditPartCN.VISUAL_ID);
- if (!timeRulerCompartmentViews.isEmpty()) {
+ if(!timeRulerCompartmentViews.isEmpty()) {
return timeRulerCompartmentViews.get(0);
}
timeRulerCompartmentViews = findSubViewsWithId(view, CompactLifelineTimeRulerCompartmentEditPartCN.VISUAL_ID);
- if (!timeRulerCompartmentViews.isEmpty()) {
+ if(!timeRulerCompartmentViews.isEmpty()) {
return timeRulerCompartmentViews.get(0);
}
throw new IllegalStateException("No timeruler compartment found in the View"); //$NON-NLS-1$
@@ -94,7 +95,7 @@ public class ViewUtils {
public static View findInteractionCompartmentView(final View interactionView) {
final List<View> timelineCompartmentViews = findSubViewsWithId(interactionView, InteractionCompartmentEditPartTN.VISUAL_ID);
- if (timelineCompartmentViews.isEmpty()) {
+ if(timelineCompartmentViews.isEmpty()) {
throw new IllegalStateException("No interaction compartment found in the interaction View"); //$NON-NLS-1$
}
return timelineCompartmentViews.get(0);
@@ -102,7 +103,7 @@ public class ViewUtils {
public static View findStateDefinitionCompartmentView(final View lifelineView) {
final List<View> timelineCompartmentViews = findSubViewsWithId(lifelineView, FullLifelineStateDefinitionCompartmentEditPartCN.VISUAL_ID);
- if (timelineCompartmentViews.isEmpty()) {
+ if(timelineCompartmentViews.isEmpty()) {
throw new IllegalStateException("No state definition compartment found in the lifeline View"); //$NON-NLS-1$
}
return timelineCompartmentViews.get(0);
@@ -110,7 +111,7 @@ public class ViewUtils {
public static View findFirstChildViewWithId(final View view, final int visualId) {
final List<View> result = findSubViewsWithId(view, visualId);
- if (result.isEmpty()) {
+ if(result.isEmpty()) {
return null;
}
return result.get(0);
@@ -126,8 +127,8 @@ public class ViewUtils {
// the javadoc says it's a list of Views
@SuppressWarnings("unchecked")
final EList<View> children = view.getChildren();
- for (final View child : children) {
- if (UMLVisualIDRegistry.getVisualID(child) == visualId) {
+ for(final View child : children) {
+ if(UMLVisualIDRegistry.getVisualID(child) == visualId) {
result.add(child);
}
internalFindSubViewsWithId(child, visualId, result);
@@ -137,10 +138,10 @@ public class ViewUtils {
public static View findSuperViewWithId(final View view, final int visualId) {
EObject parent = view;
- while (parent != null) {
- if (parent instanceof View) {
- final View parentView = (View) parent;
- if (UMLVisualIDRegistry.getVisualID(parentView) == visualId) {
+ while(parent != null) {
+ if(parent instanceof View) {
+ final View parentView = (View)parent;
+ if(UMLVisualIDRegistry.getVisualID(parentView) == visualId) {
return parentView;
}
}
@@ -150,13 +151,13 @@ public class ViewUtils {
}
public static String getContainingDiagramType(final View view) {
- if (view instanceof Diagram) {
- final Diagram diagram = (Diagram) view;
+ if(view instanceof Diagram) {
+ final Diagram diagram = (Diagram)view;
return diagram.getType();
}
final EObject eContainer = view.eContainer();
- if (eContainer instanceof View) {
- final View parentView = (View) eContainer;
+ if(eContainer instanceof View) {
+ final View parentView = (View)eContainer;
return getContainingDiagramType(parentView);
}
return null;
@@ -165,20 +166,21 @@ public class ViewUtils {
public static ICommand getMoveViewCommand(final View parentView, final View viewToMove, final int targetIndex) {
final TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(parentView);
return new AbstractTransactionalCommand(editingDomain, Messages.ViewUtils_MoveView, null, null) {
+
@Override
protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
int newIndex = targetIndex;
final EList<?> children = parentView.getChildren();
final int size = children.size();
final int index = children.indexOf(viewToMove);
- if (index < targetIndex) {
+ if(index < targetIndex) {
// account for the removed child
newIndex--;
}
- if (newIndex < 0) {
+ if(newIndex < 0) {
newIndex = 0;
}
- if (newIndex > size - 1) {
+ if(newIndex > size - 1) {
newIndex = size - 1;
}
ViewUtil.repositionChildAt(parentView, viewToMove, newIndex);
@@ -189,13 +191,13 @@ public class ViewUtils {
public static boolean isContained(final View child, final View parent) {
View view = child;
- while (view != null) {
- if (view == parent) {
+ while(view != null) {
+ if(view == parent) {
return true;
}
final EObject eContainer = view.eContainer();
- if (eContainer instanceof View) {
- view = (View) eContainer;
+ if(eContainer instanceof View) {
+ view = (View)eContainer;
} else {
break;
}
@@ -205,8 +207,8 @@ public class ViewUtils {
public static boolean isViewFor(final View view, final EClass... eClasses) {
final EObject element = view.getElement();
- for (final EClass eClass : eClasses) {
- if (eClass.isInstance(element)) {
+ for(final EClass eClass : eClasses) {
+ if(eClass.isInstance(element)) {
return true;
}
}
@@ -215,13 +217,13 @@ public class ViewUtils {
/** Returns whether the given View contains a child View for the given {@link EObject} */
public static boolean containsViewFor(final View parentView, final EObject eObject) {
- if (parentView.getElement() == eObject) {
+ if(parentView.getElement() == eObject) {
return true;
}
@SuppressWarnings("unchecked")
final EList<View> children = parentView.getChildren();
- for (final View child : children) {
- if (containsViewFor(child, eObject)) {
+ for(final View child : children) {
+ if(containsViewFor(child, eObject)) {
return true;
}
}
@@ -235,10 +237,10 @@ public class ViewUtils {
public static boolean containsConnectorFor(final View referenceView, final EObject eObject) {
final View parentDiagramView1 = ViewUtils.findSuperViewWithId(referenceView, TimingDiagramEditPart.VISUAL_ID);
final Set<View> existingViews = CrossReferencerUtil.getCrossReferencingViews(eObject, TimingDiagramEditPart.MODEL_ID);
- for (final View existingView : existingViews) {
- if (existingView instanceof Connector) {
+ for(final View existingView : existingViews) {
+ if(existingView instanceof Connector) {
final View parentDiagramView2 = ViewUtils.findSuperViewWithId(existingView, TimingDiagramEditPart.VISUAL_ID);
- if (parentDiagramView1 == parentDiagramView2) {
+ if(parentDiagramView1 == parentDiagramView2) {
return true;
}
}
@@ -247,19 +249,20 @@ public class ViewUtils {
}
public static void selectInViewer(final View view, final EditPartViewer viewer) {
- final EditPart editPart = (EditPart) viewer.getEditPartRegistry().get(view);
- if (editPart != null) {
+ final EditPart editPart = (EditPart)viewer.getEditPartRegistry().get(view);
+ if(editPart != null) {
viewer.setSelection(new StructuredSelection(editPart));
}
}
public static void performEditRequest(final View view, final EditPartViewer viewer) {
- final EditPart editPart = (EditPart) viewer.getEditPartRegistry().get(view);
- if (editPart != null) {
+ final EditPart editPart = (EditPart)viewer.getEditPartRegistry().get(view);
+ if(editPart != null) {
// viewer.setSelection(new StructuredSelection(editPart));
Display.getCurrent().asyncExec(new Runnable() {
+
public void run() {
- if (editPart.isActive()) {
+ if(editPart.isActive()) {
editPart.performRequest(new Request(RequestConstants.REQ_DIRECT_EDIT));
EditPartUtils.revealEditPart(editPart);
}

Back to the top