|
|
|
date: Tue, 22 Jul 2008 07:15:01 -0700,
group: microsoft.public.vstudio.extensibility
back
RE: DSL with fixed ports per element
To answer my own questions for anyone else coming across this:
To have toolbox components come with a pre-defined list of ports, override
CreateElementToolPrototype in <YourDSL>ToolboxHelper to create new
ElementGroup Prototypes. The "Domain-Specific Development with Visual Studio
DSL Tools" has a good explanation in their book & Circuits example - buy it!
Then you need to block deletion of the ports - which don't need any
special naming, BTW. This could be done by rule or OnDeleting, but throwing
an exception is a bad "user experience" and blocking the delete option at the
GUI is seen as better. Easiest way to do this is using the JaDal library at
http://www.codeplex.com/JaDAL.
Tristan.
"Tristan MSDN Keen" wrote:
> I'm looking to model data processing - with data sources, sinks, processors
> (both a sink & source) and a few more complex components (e.g. a quality
> filter which has a normal output and a "rejects" output). Not the most
> original of problems, probably been invented 10 times already somewhere...
>
> Anyway, I was looking at the options on how to do this under the VS 2008 DSL
> system, and tending towards the components/ports template as a starting point
> - having those complex components means more than one connector to/from the
> shape and so I need to logically distinguish them with a source/target port.
> I am having trouble working out how best to fix the number and type of ports
> for each element. I think I could do a rule to fire upon adding elements to
> the model that quickly also adds the necessary ports, and ban all other
> additions/deletions, but it sounds kludgy.
>
> I'd also like to fix the port's name to be derived from it's parent element
> - i.e. if that was a "SourceWidget1" then I'd like it's OutPort to be a
> "SourceWidget1_Output" (given I think it still needs to be unique and so
> can't be just "Output"). To maintain this during renaming, is it best again
> to create a rule to monitor changes to Names and fixup?
date: Tue, 5 Aug 2008 01:28:11 -0700
author: Tristan MSDN Keen am
|
|