Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorashatalin2008-07-16 13:19:49 -0400
committerashatalin2008-07-16 13:19:49 -0400
commit26008a0609430fc985898684cd1b0484733b82a1 (patch)
tree94b4c0c8dbd70d579969263167484a86ccce5dd3
parentf61df1f20284e8306e692a031ac735db97af19a0 (diff)
downloadorg.eclipse.gmf-tooling-26008a0609430fc985898684cd1b0484733b82a1.tar.gz
org.eclipse.gmf-tooling-26008a0609430fc985898684cd1b0484733b82a1.tar.xz
org.eclipse.gmf-tooling-26008a0609430fc985898684cd1b0484733b82a1.zip
[234562] - Adding child elements into a shortcut causes stack overflow
- getContextElementType() method added to easily switch ElementType used to get addtional EditHelperAdvices.
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editpolicies/BaseItemSemanticEditPolicy.xpt15
1 files changed, 11 insertions, 4 deletions
diff --git a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editpolicies/BaseItemSemanticEditPolicy.xpt b/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editpolicies/BaseItemSemanticEditPolicy.xpt
index 932da5948..d9726d8fb 100644
--- a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editpolicies/BaseItemSemanticEditPolicy.xpt
+++ b/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editpolicies/BaseItemSemanticEditPolicy.xpt
@@ -128,6 +128,8 @@ protected void addDestroyShortcutsCommand(org.eclipse.gef.commands.CompoundComma
«EXPAND getEditHelperCommand-»
+ «EXPAND getContextElementType-»
+
«EXPAND getSemanticCommandSwitch-»
«EXPAND getConfigureCommand-»
@@ -165,10 +167,7 @@ protected void addDestroyShortcutsCommand(org.eclipse.gef.commands.CompoundComma
org.eclipse.gmf.runtime.common.core.command.ICommand command = editPolicyCommand instanceof org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy ? ((org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy) editPolicyCommand).getICommand() : new org.eclipse.gmf.runtime.diagram.ui.commands.CommandProxy(editPolicyCommand);
request.setParameter(«EXPAND xpt::diagram::edithelpers::BaseEditHelper::editPolicyCommandConstant», command);
}
- org.eclipse.gmf.runtime.emf.type.core.IElementType requestContextElementType = «getElementTypesQualifiedClassName()».getElementType(getVisualID(request));
- if (requestContextElementType == null) {
- requestContextElementType = myElementType;
- }
+ org.eclipse.gmf.runtime.emf.type.core.IElementType requestContextElementType = getContextElementType(request);
request.setParameter(«EXPAND xpt::diagram::edithelpers::BaseEditHelper::contextElementTypeConstant», requestContextElementType);
org.eclipse.gmf.runtime.common.core.command.ICommand command = requestContextElementType.getEditCommand(request);
request.setParameter(«EXPAND xpt::diagram::edithelpers::BaseEditHelper::editPolicyCommandConstant», null);
@@ -184,6 +183,14 @@ protected void addDestroyShortcutsCommand(org.eclipse.gef.commands.CompoundComma
}
«ENDDEFINE»
+«DEFINE getContextElementType FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ private org.eclipse.gmf.runtime.emf.type.core.IElementType getContextElementType(org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest request) {
+ org.eclipse.gmf.runtime.emf.type.core.IElementType requestContextElementType = «getElementTypesQualifiedClassName()».getElementType(getVisualID(request));
+ return requestContextElementType != null ? requestContextElementType : myElementType;
+ }
+«ENDDEFINE»
+
«DEFINE getSemanticCommand FOR gmfgen::GenDiagram-»
«EXPAND xpt::Common::generatedMemberComment»
protected org.eclipse.gef.commands.Command getSemanticCommand(org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest request) {

Back to the top