|
Lines 21-40
Link Here
|
| 21 |
import org.eclipse.gef.EditPart; |
21 |
import org.eclipse.gef.EditPart; |
| 22 |
import org.eclipse.gef.commands.Command; |
22 |
import org.eclipse.gef.commands.Command; |
| 23 |
import org.eclipse.gef.commands.CompoundCommand; |
23 |
import org.eclipse.gef.commands.CompoundCommand; |
|
|
24 |
import org.eclipse.gef.commands.UnexecutableCommand; |
| 25 |
import org.eclipse.gmf.runtime.common.core.command.CompositeCommand; |
| 26 |
import org.eclipse.gmf.runtime.common.core.command.ICommand; |
| 24 |
import org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand; |
27 |
import org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand; |
| 25 |
import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy; |
28 |
import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy; |
| 26 |
import org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionNodeEditPart; |
29 |
import org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionNodeEditPart; |
| 27 |
import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart; |
30 |
import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart; |
| 28 |
import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; |
31 |
import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; |
| 29 |
import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand; |
32 |
import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand; |
|
|
33 |
import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand; |
| 34 |
import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest; |
| 30 |
import org.eclipse.gmf.runtime.notation.View; |
35 |
import org.eclipse.gmf.runtime.notation.View; |
|
|
36 |
import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils; |
| 37 |
import org.eclipse.papyrus.infra.services.edit.service.IElementEditService; |
| 31 |
import org.eclipse.papyrus.uml.diagram.common.util.DiagramEditPartsUtil; |
38 |
import org.eclipse.papyrus.uml.diagram.common.util.DiagramEditPartsUtil; |
| 32 |
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.LifelineEditPart; |
39 |
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.LifelineEditPart; |
| 33 |
import org.eclipse.uml2.uml.DestructionOccurrenceSpecification; |
40 |
import org.eclipse.uml2.uml.DestructionOccurrenceSpecification; |
| 34 |
import org.eclipse.uml2.uml.Element; |
41 |
import org.eclipse.uml2.uml.Element; |
|
|
42 |
import org.eclipse.uml2.uml.Event; |
| 35 |
import org.eclipse.uml2.uml.ExecutionSpecification; |
43 |
import org.eclipse.uml2.uml.ExecutionSpecification; |
| 36 |
import org.eclipse.uml2.uml.Message; |
44 |
import org.eclipse.uml2.uml.Message; |
| 37 |
import org.eclipse.uml2.uml.MessageEnd; |
45 |
import org.eclipse.uml2.uml.MessageEnd; |
|
|
46 |
import org.eclipse.uml2.uml.MessageOccurrenceSpecification; |
| 38 |
import org.eclipse.uml2.uml.OccurrenceSpecification; |
47 |
import org.eclipse.uml2.uml.OccurrenceSpecification; |
| 39 |
|
48 |
|
| 40 |
/** |
49 |
/** |
|
Lines 201-204
Link Here
|
| 201 |
} |
210 |
} |
| 202 |
} |
211 |
} |
| 203 |
} |
212 |
} |
|
|
213 |
|
| 214 |
public static Command completeDeleteMessageCommand(DestroyElementRequest req) { |
| 215 |
EObject selectedEObject = req.getElementToDestroy(); |
| 216 |
IElementEditService provider = ElementEditServiceUtils |
| 217 |
.getCommandProvider(selectedEObject); |
| 218 |
if (provider != null) { |
| 219 |
// Retrieve delete command from the Element Edit service |
| 220 |
ICommand deleteCommand = provider.getEditCommand(req); |
| 221 |
if (deleteCommand != null) { |
| 222 |
CompositeCommand command = new CompositeCommand( |
| 223 |
deleteCommand.getLabel()); |
| 224 |
command.add(deleteCommand); |
| 225 |
Message message = (Message) selectedEObject; |
| 226 |
MessageEnd receiveEvent = message.getReceiveEvent(); |
| 227 |
if (receiveEvent != null) { |
| 228 |
DestroyElementRequest myReq = new DestroyElementRequest( |
| 229 |
req.getEditingDomain(), receiveEvent, false); |
| 230 |
command.add(new DestroyElementCommand(myReq)); |
| 231 |
} |
| 232 |
MessageEnd sendEvent = message.getSendEvent(); |
| 233 |
if (sendEvent != null) { |
| 234 |
DestroyElementRequest myReq = new DestroyElementRequest( |
| 235 |
req.getEditingDomain(), sendEvent, false); |
| 236 |
command.add(new DestroyElementCommand(myReq)); |
| 237 |
} |
| 238 |
return new ICommandProxy(command); |
| 239 |
} |
| 240 |
} |
| 241 |
return UnexecutableCommand.INSTANCE; |
| 242 |
} |
| 204 |
} |
243 |
} |