Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/BaseItemSemanticEditPolicy.xtend')
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/BaseItemSemanticEditPolicy.xtend18
1 files changed, 14 insertions, 4 deletions
diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/BaseItemSemanticEditPolicy.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/BaseItemSemanticEditPolicy.xtend
index e907969828a..1556194cfb0 100644
--- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/BaseItemSemanticEditPolicy.xtend
+++ b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/BaseItemSemanticEditPolicy.xtend
@@ -192,10 +192,20 @@ protected org.eclipse.gef.commands.Command getCreateRelationshipCommand(org.ecli
override getCreateCommand(GenDiagram it) '''
«generatedMemberComment()»
- protected org.eclipse.gef.commands.Command getCreateCommand(org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest req) {
- // no more usage of the extended types here.
- return null;
- }
+ protected org.eclipse.gef.commands.Command getCreateCommand(org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest req) {
+ org.eclipse.gmf.runtime.emf.type.core.IElementType requestElementType = req.getElementType();
+ if (requestElementType instanceof org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType) {
+ // try to get a semantic create command from the extended type
+ org.eclipse.papyrus.infra.services.edit.service.IElementEditService commandProvider = org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils.getCommandProvider(req.getContainer());
+ if (commandProvider != null) {
+ org.eclipse.gmf.runtime.common.core.command.ICommand command = commandProvider.getEditCommand(req);
+ if (command != null && command.canExecute()) {
+ return new org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy(command);
+ }
+ }
+ }
+ return null;
+ }
'''
def getCreateExtendedTypeCommand(GenDiagram it) '''

Back to the top