Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorashatalin2008-07-11 16:13:24 +0000
committerashatalin2008-07-11 16:13:24 +0000
commitf7b6431010cc61cb7635eb926ccb149c93e41d15 (patch)
tree025a36f6004120518db6167924c578e84761ae90 /plugins
parent5fb1408ca755ad6ebec27465592ec7e50aa2b696 (diff)
downloadorg.eclipse.gmf-tooling-f7b6431010cc61cb7635eb926ccb149c93e41d15.tar.gz
org.eclipse.gmf-tooling-f7b6431010cc61cb7635eb926ccb149c93e41d15.tar.xz
org.eclipse.gmf-tooling-f7b6431010cc61cb7635eb926ccb149c93e41d15.zip
[234562] - Adding child elements into a shortcut causes stack overflow
Diffstat (limited to 'plugins')
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editpolicies/BaseItemSemanticEditPolicy.xpt76
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editpolicies/CompartmentItemSemanticEditPolicy.xpt12
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editpolicies/DiagramItemSemanticEditPolicy.xpt5
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editpolicies/LinkItemSemanticEditPolicy.xpt4
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editpolicies/NodeItemSemanticEditPolicy.xpt3
5 files changed, 69 insertions, 31 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 ff0e2e39f..b10efc675 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
@@ -26,8 +26,9 @@ package «getDiagram().editPoliciesPackageName»;
«EXPAND xpt::Common::generatedClassComment»
public class «baseItemSemanticEditPolicyClassName» extends org.eclipse.gmf.runtime.diagram.ui.editpolicies.SemanticEditPolicy {
- «EXPAND xpt::Common::generatedMemberComment("Extended request data key to hold editpart visual id.\n")»
- public static final String VISUAL_ID_KEY = "visual_id"; «EXPAND xpt::Common::nonNLS»
+ «EXPAND attributes-»
+
+ «EXPAND constructor-»
«EXPAND xpt::Common::generatedMemberComment(
"Extended request data key to hold editpart visual id.\n" +
@@ -90,6 +91,21 @@ public class «baseItemSemanticEditPolicyClassName» extends org.eclipse.gmf.runti
}
«ENDDEFINE»
+«DEFINE attributes FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment("Extended request data key to hold editpart visual id.\n")»
+ public static final String VISUAL_ID_KEY = "visual_id"; «EXPAND xpt::Common::nonNLS»
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private final org.eclipse.gmf.runtime.emf.type.core.IElementType myElementType;
+«ENDDEFINE»
+
+«DEFINE constructor FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected «baseItemSemanticEditPolicyClassName»(org.eclipse.gmf.runtime.emf.type.core.IElementType elementType) {
+ myElementType = elementType;
+ }
+«ENDDEFINE»
+
«DEFINE addDestroyShortcutsCommand FOR gmfgen::GenDiagram-»
«EXPAND xpt::Common::generatedMemberComment»
protected void addDestroyShortcutsCommand(org.eclipse.gef.commands.CompoundCommand command) {
@@ -144,33 +160,19 @@ protected void addDestroyShortcutsCommand(org.eclipse.gef.commands.CompoundComma
«EXPAND xpt::Common::generatedMemberComment»
protected org.eclipse.gef.commands.Command getSemanticCommand(org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest request) {
org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest completedRequest = completeRequest(request);
- Object editHelperContext = completedRequest.getEditHelperContext();
- if (editHelperContext instanceof org.eclipse.gmf.runtime.notation.View || (editHelperContext instanceof org.eclipse.gmf.runtime.emf.type.core.IEditHelperContext && ((org.eclipse.gmf.runtime.emf.type.core.IEditHelperContext) editHelperContext).getEObject() instanceof org.eclipse.gmf.runtime.notation.View)) {
- // no semantic commands are provided for pure design elements
- return null;
- }
- if (editHelperContext == null) {
- editHelperContext = org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.resolveSemanticElement((org.eclipse.gmf.runtime.notation.View) getHost().getModel());
- }
- org.eclipse.gmf.runtime.emf.type.core.IElementType elementType = org.eclipse.gmf.runtime.emf.type.core.ElementTypeRegistry.getInstance().getElementType(editHelperContext);
- if (elementType == org.eclipse.gmf.runtime.emf.type.core.ElementTypeRegistry.getInstance().getType("org.eclipse.gmf.runtime.emf.type.core.default")) { «EXPAND xpt::Common::nonNLS»
- «REM»< % = importManager.getImportedName(genDiagram.getEditorGen().getPlugin().getActivatorQualifiedClassName()) % >.getInstance().logInfo("Failed to get element type for " + editHelperContext); / / $NON-NLS-1$«ENDREM»«-»
- elementType = null;
- }
org.eclipse.gef.commands.Command semanticCommand = getSemanticCommandSwitch(completedRequest);
- if (elementType != null) {
- if (semanticCommand != null) {
- org.eclipse.gmf.runtime.common.core.command.ICommand command = semanticCommand instanceof org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy ? ((org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy) semanticCommand).getICommand() : new org.eclipse.gmf.runtime.diagram.ui.commands.CommandProxy(semanticCommand);
- completedRequest.setParameter(«getBaseEditHelperQualifiedClassName()».EDIT_POLICY_COMMAND, command);
- }
- org.eclipse.gmf.runtime.common.core.command.ICommand command = elementType.getEditCommand(completedRequest);
- if (command != null) {
- if (!(command instanceof org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand)) {
- org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain = ((org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart) getHost()).getEditingDomain();
- command = new org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand(editingDomain, command.getLabel()).compose(command);
- }
- semanticCommand = new org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy(command);
+ if (semanticCommand != null) {
+ org.eclipse.gmf.runtime.common.core.command.ICommand command = semanticCommand instanceof org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy ? ((org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy) semanticCommand).getICommand() : new org.eclipse.gmf.runtime.diagram.ui.commands.CommandProxy(semanticCommand);
+ completedRequest.setParameter(«getBaseEditHelperQualifiedClassName()».EDIT_POLICY_COMMAND, command);
+ }
+ org.eclipse.gmf.runtime.common.core.command.ICommand command = myElementType.getEditCommand(completedRequest);
+ completedRequest.setParameter(«getBaseEditHelperQualifiedClassName()».EDIT_POLICY_COMMAND, null);
+ if (command != null) {
+ if (!(command instanceof org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand)) {
+ org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain = ((org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart) getHost()).getEditingDomain();
+ command = new org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand(editingDomain, command.getLabel()).compose(command);
}
+ semanticCommand = new org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy(command);
}
boolean shouldProceed = true;
if (completedRequest instanceof org.eclipse.gmf.runtime.emf.type.core.requests.DestroyRequest) {
@@ -491,4 +493,22 @@ if (target != null && («EXPAND featureBoundsConditionClause("target", getTargetT
«DEFINE incorrectLinkModelFacet FOR gmfgen::LinkModelFacet»«ERROR "Unrecognized link model facet: " + this»«ENDDEFINE»
-«DEFINE additions FOR gmfgen::GenDiagram»«ENDDEFINE» \ No newline at end of file
+«DEFINE additions FOR gmfgen::GenDiagram»«ENDDEFINE»
+
+«DEFINE defaultConstructor FOR gmfgen::GenCommonBase-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public «itemSemanticEditPolicyClassName»() {
+ «EXPAND defaultConstructorBody-»
+ }
+«ENDDEFINE»
+
+«REM»
+ This method should be called only with diagram, node or link used as a parameter
+ (then elementType != null)
+«ENDREM»
+«DEFINE defaultConstructorBody FOR gmfgen::GenCommonBase-»
+ «IF elementType == null-»
+ «ERROR "No element type in the passed node. Only diagram, node or link are supported in this template: " + this-»
+ «ENDIF-»
+ super(«getDiagram().getElementTypesQualifiedClassName()».«getUniqueIdentifier()»);
+«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editpolicies/CompartmentItemSemanticEditPolicy.xpt b/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editpolicies/CompartmentItemSemanticEditPolicy.xpt
index 22e6661c2..cd9b3c294 100644
--- a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editpolicies/CompartmentItemSemanticEditPolicy.xpt
+++ b/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editpolicies/CompartmentItemSemanticEditPolicy.xpt
@@ -18,11 +18,21 @@ package «getDiagram().editPoliciesPackageName»;
«EXPAND xpt::Common::generatedClassComment»
public class «itemSemanticEditPolicyClassName» extends «getDiagram().getBaseItemSemanticEditPolicyQualifiedClassName()» {
- «EXPAND xpt::diagram::editpolicies::childContainerCreateCommand::childContainerCreateCommand FOR childNodes-»
+ «EXPAND constructor-»
+
+ «EXPAND xpt::diagram::editpolicies::childContainerCreateCommand::childContainerCreateCommand FOR childNodes-»
+
«EXPAND additions-»
}
«ENDDEFINE»
+«DEFINE constructor FOR gmfgen::GenCompartment-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public «itemSemanticEditPolicyClassName»() {
+ «EXPAND xpt::diagram::editpolicies::BaseItemSemanticEditPolicy::defaultConstructorBody FOR node-»
+ }
+«ENDDEFINE»
+
«DEFINE additions FOR gmfgen::GenCompartment-»
«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editpolicies/DiagramItemSemanticEditPolicy.xpt b/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editpolicies/DiagramItemSemanticEditPolicy.xpt
index d65991e57..ca466d9a0 100644
--- a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editpolicies/DiagramItemSemanticEditPolicy.xpt
+++ b/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editpolicies/DiagramItemSemanticEditPolicy.xpt
@@ -18,12 +18,15 @@ package «editPoliciesPackageName»;
«EXPAND xpt::Common::generatedClassComment»
public class «itemSemanticEditPolicyClassName» extends «getBaseItemSemanticEditPolicyQualifiedClassName()» {
+
+ «EXPAND xpt::diagram::editpolicies::BaseItemSemanticEditPolicy::defaultConstructor-»
+
«EXPAND xpt::diagram::editpolicies::childContainerCreateCommand::childContainerCreateCommand FOR topLevelNodes-»
«EXPAND getDuplicateCommand-»
«EXPAND DuplicateAnythingCommand-»
-
+
«EXPAND additions-»
}
«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editpolicies/LinkItemSemanticEditPolicy.xpt b/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editpolicies/LinkItemSemanticEditPolicy.xpt
index a300ef2ef..382f0683b 100644
--- a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editpolicies/LinkItemSemanticEditPolicy.xpt
+++ b/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editpolicies/LinkItemSemanticEditPolicy.xpt
@@ -20,8 +20,10 @@ package «getDiagram().editPoliciesPackageName»;
«EXPAND xpt::Common::generatedClassComment»
public class «itemSemanticEditPolicyClassName» extends «diagram.getBaseItemSemanticEditPolicyQualifiedClassName()» {
- «EXPAND classBody(getDiagram()) FOR modelFacet-»
+ «EXPAND xpt::diagram::editpolicies::BaseItemSemanticEditPolicy::defaultConstructor-»
+ «EXPAND classBody(getDiagram()) FOR modelFacet-»
+
«EXPAND additions-»
}
«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editpolicies/NodeItemSemanticEditPolicy.xpt b/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editpolicies/NodeItemSemanticEditPolicy.xpt
index 25fc30ed0..0947a033c 100644
--- a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editpolicies/NodeItemSemanticEditPolicy.xpt
+++ b/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editpolicies/NodeItemSemanticEditPolicy.xpt
@@ -27,6 +27,9 @@ package «getDiagram().editPoliciesPackageName»;
«EXPAND xpt::Common::generatedClassComment»
public class «itemSemanticEditPolicyClassName» extends «getDiagram().getBaseItemSemanticEditPolicyQualifiedClassName()» {
+
+ «EXPAND xpt::diagram::editpolicies::BaseItemSemanticEditPolicy::defaultConstructor-»
+
«EXPAND xpt::diagram::editpolicies::childContainerCreateCommand::childContainerCreateCommand FOR childNodes-»
«EXPAND getDestroyElementCommand-»

Back to the top