index > Visual Studio Team System - Domain-Specific Language Tools > Rules in DSL Tools V1

Rules in DSL Tools V1


Hello

I tried to implement a mechanism to do some action when I add an element on the diagram. In an older thread, I read about Rules. I created a Rule which inherits from AddRule and added some code in the overwritten ElementAdded(...) method.
To register this rule, I created a partial class named "GeneratedMetaModelTypes" and added the corresponding type. But it doesn't work, I also couldnt find any other partial class GeneratedMetaModelTypes...
Is this not supported anymore in Version 1? Are there other possibilities to intercept the adding of an element?

Thanks for your reply!

Best regards
Christian



Christian Schweizer - Junior Software Engineer - ELCA Informatics AG
Christian Schweizer

Here is a sample from my model.

I have two Rules

[RuleOn(typeof(Connector), FireTime = TimeToFire.TopLevelCommit)]
public sealed class MyAddRule : AddRule
{
public override void ElementAdded(ElementAddedEventArgs e)
{
if (e == null) throw new ArgumentNullException("e");
}
}


[RuleOn(typeof(ElementShape), FireTime = TimeToFire.TopLevelCommit)]
public sealed class ElementShapeAddRule : AddRule
{
public override void ElementAdded(ElementAddedEventArgs e)
{
if (e == null) throw new ArgumentNullException("e");
}
}

And here is a way how to add them to a model

public partial class SwitchboardDomainModel
{
protected override Type[] GetCustomDomainModelTypes()
{
return new System.Type[] { typeof(MyAddRule), typeof(ElementShapeAddRule) };
}
}

Ivana


Ivana Vozkova
Hi Ivana

Thank you very much for the sample!

Best regards
Christian



Christian Schweizer - Junior Software Engineer - ELCA Informatics AG
Christian Schweizer
reply 3

You can use google to search for other answers

 

More Articles

How to update PropertyGrid after changing type
Installing June 2006 VS SDK CTP side-by-side with April 2006 VS S...
Changing image displayed by image shape programmatically
Possible to get samples with new DSL included text-templates?
Error : Value cannot be null ,Parameter name:Key
Installing DSL Tools Nov CTP Release
Drag&Drop of elements from DSL explorer?
RelationShip ZeroOne-ZeroMany as property
Concept's Properties
Welcome to the Domain-Specific Language (DSL) Tools Forum
Welcome to Bokebb   New Update   Joins the collection  
 

New Articles

RelationShip ZeroOne-ZeroMany as property
Split (T4) code in more than 1 text temp…
Duplicate AddRule classes in ViewFixupRu…
How to know if OnShapeInserted was initi…
new connectors
New version of DMD -> DD is available…
DSL Toolkit - March version
2 problems with V1 release
Changing elements from properties
Package Load Failure with /NoVsip
Installation Problems? "operation i…
copy the text from ViewFixupRules.dslddi…
Model Query Capabilities
Category feedback
Error : Value cannot be null ,Parameter …

Hot Articles

Cannot create a new simple language with…
designer definition toolbox item - compa…
Is there documentation for the T4 engine…
Defining custom multiplicities
Show or Hide icon decorator at runtime
How to Export diagram as image
Can Visual Studio DSL Designers be hosted?
geometryShape no "Diamond" Sha…
How do I change the color of a connector…
accessing relations (and its value prope…
changing defaults in inherited propeties
Domain model designer toolbox items disa…
Workaround: Recovering invalid model fil…
How to add Text template and make availa…
November DSL Toolkit Release: where are …

Recommend Articles

Right mouse click on model results in a …
Referencing Domain Classes from Domain P…
How to determine if a model passes valid…
Package Load Failure
Welcome to the Domain-Specific Language …
How do I get a new ModelElement's corres…
Any Practical Limits on Model Size?
Changing Role Players in the Properties …
Bug in Edit Attributes editor
How do I use the DSL that I have created…
Error with DSL Project Setup
DSL Tools Sept CTP and WinFX Sept CTP?
How to move shapes within diagram progra…
Reminder Web Chat this Tuesday
TypeConverter's method GetStandardValues…