tags:

views:

193

answers:

1

In my DSL project I have a shape with a number of decorators that are linked to properties on my domain class. But even though ieach decorator has a DisplayName property (set to a meaningfull value) it does not appear in the generated DSL project. (I have not forgtten to use regenerate the t4 files.)

Do I have to create another decorator for each property that only has the display name as a value that I wish to display or is there some other way that I can't figure out right now?

Thanks in advance

+1  A: 

I assume by a display name for the decorator you mean you want the element in the generated DSL to appear as "Example = a_value" where a_value is the actual value and Example is the property name.

What I've done with this in the past is to create second property "ExampleDisplay" that's not browsable and is what the decorator actually points to. I then set the Kind property of the ExampleDisplay to "Calculated". You then need to provide the method that the toolkit tries to call to display the decorator which you can do a partial class.

partial class ExampleElement
{
    string GetExampleDisplayValue()
    {
        return "Example : " + this.Example;
    }
}

This is not ideal as you don't get a good way of setting the property on the DSL diagram you have to use the properties window. (There's sometime lags from the property window unless you hook into the update of the underlying property too). Getting the slick editing in the GUI that actual DSL toolkit does maybe possible but I haven't found out how.

It maybe worth ask VSX forums if you haven't already done so.

Ian G
Good answer, it's not perfect but I hadn't though of that! Thanks.
AlexDuggleby