index > Visual Studio Team System - Domain-Specific Language Tools > Auto Add Child Elements

Auto Add Child Elements


Hi,

In my DSL I have an entity called "Component" which has two childs "Implementation" and "Contract".
I created a domain class and a shape for each of these logical entities and a tool for adding a Component. I now want to have 'Contract' and 'Implementation' added automatically each time I drag&drop a 'Component'.
I tried to create them by overwritting the Component constructor, unfortunatly this causes side effectes and the childs are created several times.
Furthermore it would be cool to have them positioned right beyond the parent (component).
Can anybody give me a hint on this?

thx alot
cheerio
Silvan

SilvanG

Hi SilvanG,

If you're only creating your Components from the toolbox then you can override MergeConfigure on Component and create the child there.

If someone might be hand-editing your xml files, then you might want to look into overriding the postload event handler on your DocData to fix up any Components which don't have the right children.

If instead you want different toolbox entries having different combinations of children then you can instead set up different ElementGroupPrototypes with different subgraphs by overriding your ToolboxHelper class' CreateToolboxItems method.




Gareth Jones - Developer - DSL Tools & Software Factories Platform [MSFT]
GarethJ - MSFT
reply 2

You can use google to search for other answers

 

More Articles

General Questions
Workaround: Recovering invalid model files after changing the DD ...
How to update PropertyGrid after changing type
November 2005 CTP available
Controlling and detecting what elements are droppable on the diag...
Including code files in a DSL instance
Deployment - template doesn't appear under project types
newbie question,thank you for your attention
DSL Tools November CTP now available
Retrieving embedded elements
Welcome to Bokebb   New Update   Joins the collection  
 

New Articles

Interacting with Server Explorer
How to make a Domain Relationship visibl…
constrain the number of a specific shape
Enterprise Library
Problems with DSL Tools Version 1
Unable to Start Debugging !!!
how can i get a Service into T4 textempl…
Package Load Failure
Embedding shapes in v1
Beginner question about the use of DSL T…
November DSL Toolkit Release: where are …
reuse of model elements
Relationship from CompartmentItem and po…
How to set custom properties at runtime?
Workaround: Recovering invalid model fil…

Hot Articles

Modal EditStyle and enumerations
How to set the connector decorator posit…
Use of the TextTransform tool
Resources: Domain Specific Language (DSL…
Show more than one Property in a Compart…
Embedding Relationships and Inheritence
How to get a reference to a model within…
Domain model designer toolbox items disa…
CompartmentShapes Walkthrough causes Ove…
Beginners Question on code generation
Reordering items in compartments?
Properties Mapping/Text Templates
Migrating to May CTP: Text Template Prob…
UIPAB
Providing UITypeEditor in DSL

Recommend Articles

Unable to Replace Old Files by New ones
How it the class mentioned in directivep…
How do I get a new ModelElement's corres…
Custom action on dropping items onto the…
Migrating to May CTP: MissingManifestRes…
Can't run project (DSL November)
Custom Modeler Code
Why is creating concrete syntax so hard?
Not getting items in the toolbox in the …
How to set custom properties at runtime?
How to access the Session in subdomain?
Right mouse click on model results in a …
How adequate-rich or suffitient-complete…
Getting validation results
Localization