blob: f412f123a9f1e11a4f48301d36da15a636e12c49 (
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
|
/*****************************************************************************
* Copyright (c) 2013 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.interactionoverview.edit.policy;
import org.eclipse.gef.commands.Command;
import org.eclipse.gef.commands.UnexecutableCommand;
import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.SemanticEditPolicy;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
import org.eclipse.papyrus.uml.diagram.activity.providers.UMLElementTypes;
import org.eclipse.papyrus.uml.diagram.interactionoverview.provider.ElementTypes;
// Start of user code custom imports
// End of user code
public class DiagramSemanticEditPolicy extends SemanticEditPolicy {
protected Command getCreateCommand(final CreateElementRequest req) {
final IElementEditService commandService = ElementEditServiceUtils.getCommandProvider(UMLElementTypes.Package_ActivityDiagram);
if (commandService == null) {
return UnexecutableCommand.INSTANCE;
}
// Start of user code custom creation commands
// End of user code
if (ElementTypes.ACTIVITY == req.getElementType()) {
final CreateElementRequest createRequest = new CreateElementRequest(req.getContainer(), UMLElementTypes.Activity_Shape);
return new ICommandProxy(commandService.getEditCommand(createRequest));
}
return UnexecutableCommand.INSTANCE;
}
}
|