blob: 300890fbfb6ebdd2c39c93e8889056e4c232c19e (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
|
/*
* Copyright (c) 2012 CEA LIST.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.papyrus.uml.diagram.timing.edit.policies;
import org.eclipse.gef.commands.Command;
import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
import org.eclipse.papyrus.uml.diagram.timing.edit.commands.DestructionOccurrenceSpecificationCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.timing.edit.commands.DurationConstraintCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.timing.edit.commands.DurationObservationCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.timing.edit.commands.FullStateInvariantCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.timing.edit.commands.GeneralOrderingCreateCommand;
import org.eclipse.papyrus.uml.diagram.timing.edit.commands.MessageOccurrenceSpecificationCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.timing.edit.commands.OccurrenceSpecificationCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.timing.edit.commands.TimeConstraintCreateCommand;
import org.eclipse.papyrus.uml.diagram.timing.edit.commands.TimeObservationCreateCommand;
import org.eclipse.papyrus.uml.diagram.timing.providers.UMLElementTypes;
/**
* @generated
*/
@SuppressWarnings("all")
// disable warnings on generated code
public class FullLifelineTimelineCompartmentItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditPolicy {
/**
* @generated
*/
public FullLifelineTimelineCompartmentItemSemanticEditPolicyCN() {
super(UMLElementTypes.Lifeline_19);
}
/**
* @generated
*/
@Override
protected Command getCreateCommand(final CreateElementRequest req) {
final IElementType requestElementType = req.getElementType();
if (requestElementType == null) {
return super.getCreateCommand(req);
}
IElementType baseElementType = requestElementType;
boolean isExtendedType = false;
if (requestElementType instanceof IExtendedHintedElementType) {
baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
if (baseElementType != null) {
isExtendedType = true;
} else {
// no reference element type ID. using the closest super element type to give more opportunities, but
// can lead to bugs.
baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
isExtendedType = true;
}
}
if (UMLElementTypes.StateInvariant_11 == baseElementType) {
if (isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType) requestElementType);
}
return getGEFWrapper(new FullStateInvariantCreateCommandCN(req));
}
if (UMLElementTypes.OccurrenceSpecification_12 == baseElementType) {
if (isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType) requestElementType);
}
return getGEFWrapper(new OccurrenceSpecificationCreateCommandCN(req));
}
if (UMLElementTypes.MessageOccurrenceSpecification_13 == baseElementType) {
if (isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType) requestElementType);
}
return getGEFWrapper(new MessageOccurrenceSpecificationCreateCommandCN(req));
}
if (UMLElementTypes.DestructionOccurrenceSpecification_27 == baseElementType) {
if (isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType) requestElementType);
}
return getGEFWrapper(new DestructionOccurrenceSpecificationCreateCommandCN(req));
}
if (UMLElementTypes.DurationConstraint_18 == baseElementType) {
if (isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType) requestElementType);
}
return getGEFWrapper(new DurationConstraintCreateCommandCN(req));
}
if (UMLElementTypes.DurationObservation_17 == baseElementType) {
if (isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType) requestElementType);
}
return getGEFWrapper(new DurationObservationCreateCommandCN(req));
}
if (UMLElementTypes.TimeConstraint_15 == baseElementType) {
if (isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType) requestElementType);
}
return getGEFWrapper(new TimeConstraintCreateCommand(req));
}
if (UMLElementTypes.TimeObservation_16 == baseElementType) {
if (isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType) requestElementType);
}
return getGEFWrapper(new TimeObservationCreateCommand(req));
}
if (UMLElementTypes.GeneralOrdering_67 == baseElementType) {
if (isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType) requestElementType);
}
return getGEFWrapper(new GeneralOrderingCreateCommand(req));
}
return super.getCreateCommand(req);
}
}
|