But wait till you see it in Eclipse...
I follow the Microsoft DSL Tools forum - questions there are sometimes about Domain-Specific Modeling in general, not just related to problems with Microsoft's DSL Tools. Yesterday's new question was however firmly in the area of tool issues. It asked how to add a model element programmatically, so it appears at a specified position. Nobody has replied yet. I'm sure someone will, but it's just possible the example code provided is taking people a little while to read. It's a tad long: the version on the left here is scaled down by a factor of 8.
The problem the poster was having was that adding new objects ended up with them all on top of each other at the top left. In MetaEdit+, that problem wouldn't occur: they get laid out into the next available piece of blank space. In the next version of our API, you can also call our parameterisable auto-layout. Or then simply provide a position:
api.addNewObjectRep(diagram, newObj, 1, new MEPoint(50,50));
The 1 there specifies that the new representation is first in the Z-order, i.e. on top of any previous objects (like Order | Bring to Front). The rest is probably self-evident, and not particularly verbose. Like Microsoft, we haven't released that version of the API yet (although of course there is a difference in that theirs will be their first version, whereas ours will be version 4.5). Having less verbosity is thus particularly good news: the longer the code you have to write, the more you'll have to throw away or correct if the vendor decides to change the API before release.
I'm sure the Microsoft code contains a similar call to the above - there's surely no real difference there. What worries me is the amount of code you have to create - or wade through when debugging - before you can get down to the actual bit you want.
Still, as the title says, from my experience with GEF I bet the situation in some other frameworks claiming to support DSM is even worse. All power to the developers on all these tools as they try to make something that's quick and easy to use, but also powerful and extensible.
Comments
Positioning shapes
[Pedro Silva] February 24, 2006 22:02:25 +0200 (EET)
Check out my blog post about how you can get this working on DSL Tools.
Ask and it shall be answered!
[Steven Kelly] February 24, 2006 22:23:12 +0200 (EET)
Thanks Pedro! It's great how you guys find the time to help people program with your framework.
No Problem
[Pedro Silva] February 25, 2006 00:26:00 +0200 (EET)
I still have time to sleep, so I guess we can answer some questions... :) Seriously though, part of it is our own fault because we don't have enough documentation and some things are harder to code than they should be, so we do need to provide the answers. The other part is we need developers successfully building DSLs with our tools.