Author Topic: Have I misunderstood? MDG Diagrams and Toolboxes  (Read 9328 times)

ZuluTen

  • EA User
  • **
  • Posts: 56
  • Karma: +0/-0
    • View Profile
Have I misunderstood? MDG Diagrams and Toolboxes
« on: June 24, 2014, 09:15:22 pm »
I have now got my MDG working properly in all but one respect:

It was my understanding that having defined Diagrams which relate to Toolboxes, which contain Stereotypes, whenever I create a new Diagram the appropriate Toolbox would be automatically opened ready to drag and drop new context specific elements onto the Diagram.

Unfortunately what happens is this:
Add Diagram correctly opens a selection window which contains my MDG name in the “Select From” window, and my ‘special’ Diagrams in the right hand “Diagram Types” window.
Selection of a Diagram Type causes the correct empty diagram to be created.
However, the Toolbox contains only the standard toolsets, and to see my ‘special’ Toolboxes I have to select More Tools.

It seems to me that there is a failure of the Diagram to Associate with the Toolbox.

Hardly a show-stopper I’ll admit, but not quite as impressive as having context specific toolboxes.

I have reviewed the properties of each of the Diagram Metaclasses shown on the diagram within the <<Diagram Profile>> to confirm that they have the correct reference to a Toolbox – they do. I’ve also tried to fully qualify the name of the Toolbox, and used it with and without “string” as its type.

I’ve checked Settings>MDG Technologies to ensure that My_MDG is ticked and set to Active.

Interestingly, when one uses the EA built in MDG template to generate the MDG, it comes complete with a few template elements to get one started, but these show the same behaviour as my newly created profiles so I’m wondering whether I’ve got a setting wrong somewhere?

Or, am I expecting too much with context specific toolboxes mapped to diagrams?

Any tips/pointers/corrections would be much appreciated.

Uffe

  • EA Practitioner
  • ***
  • Posts: 1859
  • Karma: +133/-14
  • Flutes: 1; Clarinets: 1; Saxes: 5 and counting
    • View Profile
Re: Have I misunderstood? MDG Diagrams and Toolbox
« Reply #1 on: June 24, 2014, 10:29:18 pm »
No, you're not expecting too much. It's supposed to work (and frequently does) so there's something going wrong in your specific case.

In a diagram profile, you must create one metaclass and one stereotype for each custom diagram.

Each diagram metaclass must be named Diagram_<type>, where <type> is one of EA's predefined types, so Diagram_Logical for a class-type diagram.
This controls the icon for the diagram itself, displayed in the New Diagram dialog and the project browser.

Each diagram stereotype is named freely. This name is shown in the New Diagram dialog, along with the stereotype's Notes, which describe the diagram type. This is all the stereotype does.

Back up to the metaclass. You can add (string) attributes alias and diagramID, whose  Initial Value control how the diagram type is displayed in the diagram title bar and diagram frame label, respectively. You want to set at least alias to the same as the name of the stereotype, unless you have some very specific requirements. diagramID can be an abbreviation, or the full name if you prefer.

Again in the metaclass, the (string) attribute toolbox controls which toolbox is opened by default (again in its Initial Value). You simply enter the unqualified name of the toolbox here, at least as long as you are working with a single diagram profile with the same name as the MDG Technology. If not, I'm not sure if it works the same way.

A frequent source of errors is when you accidentally overwrite one profile file with another, especially since Sparx recommends that you use the same name for the diagram and UML profiles. So if you overwrite the toolbox file with the UML profile file, EA won't complain but it won't be able to make sense of the toolbox and it won't work.

If you check the contents of the various files, you'll see that they all contain stereotype definitions, which differ in their <AppliesTo> properties.
UML profile stereotypes apply to Class, Component, etc etc.
Toolbox profile stereotypes all apply to ToolboxPage.
Diagram profile stereotypes apply to Diagram_Logical etc.
In the MDG Technology file, you should find the exact same contents but grouped under <UMLProfiles>, <UIToolboxes> and <DiagramProfile> (no "s").

Another problem might be if you're super-clicking through the MDG Technology creation wizard without realizing you've placed the corrected version of one of the files in a different directory - or have simply forgotten to include it.

I am intrigued by the fact that you get the same behavior with EA's built-in stuff. Not sure what's going on there. But I'm a bit of an old greybeard when it comes to MDG Technologies and tend not to use the profile helpers much.

I should also mention that I always save my profiles from the project browser, never the diagrams. In the past these approaches would lead to different results, but I'm not sure if they still do.

Anyway, hope there's something you can take away from all that.

Cheers,


/Uffe
My theories are always correct, just apply them to the right reality.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Have I misunderstood? MDG Diagrams and Toolbox
« Reply #2 on: June 24, 2014, 10:37:24 pm »
Well, I often encountered that. The reason in most cases was a wrongly saved profile. That really sucks! EA just lets you stand in the rain with no umbrella. If you get wet you have to change clothes. What I do is to clean all files. Re-save everything carefully. Re-create the MDG. If it still does not work: have a cup of tea/coffee and repeat the whole thing. What I did in addition was to write a script that saves the files automatically and does some sanity checks. This whole procedure of saving profiles and generating a MDG is simply annoying.

q.

ZuluTen

  • EA User
  • **
  • Posts: 56
  • Karma: +0/-0
    • View Profile
Re: Have I misunderstood? MDG Diagrams and Toolbox
« Reply #3 on: June 25, 2014, 01:22:51 am »
Thank you for all of those useful comments.

I was wondering about profiles, but had already carefully created directory folders for
ProfileXML, DiagramsXML, ToolboxXML, MTS Combiner Files, MDG Output Files

That way I was confident that they’d stay separate, and I always up-number the xml files whenever I generate them. That way I can always see the highest number when selecting them for the MTS file.

That said: Having read what you’d written, to be safe I deleted the contents of all folders and started again… and guess what?
Just the same!

I also repeated the exercise by exporting the MDG to an EA machine, and also by recreating a simple MDG from scratch, using EA’s profile helper. Same result.

I’ve checked line by line against the posts above  (including stopping for tea) and read through the resultant XML files but can see no glaring omissions.

I think the key point is that the diagram profile must be ok because I can generate new diagrams of each of its stereotypes.

Equally the toolbox contains the right element stereotypes – which behave correctly when dragged and dropped to the diagrams.

What I appear to be missing is the correlation between them…
      …either that, or I’ve disabled it. Might there be a setting or option which I've got wrong?

Uffe

  • EA Practitioner
  • ***
  • Posts: 1859
  • Karma: +133/-14
  • Flutes: 1; Clarinets: 1; Saxes: 5 and counting
    • View Profile
Re: Have I misunderstood? MDG Diagrams and Toolbox
« Reply #4 on: June 25, 2014, 01:44:44 am »
I'm not aware of any setting that would block a particular toolbox. Using "More tools... - Set Toolbox Visibility" you can select toolboxes to be permanently visible, but not the other way around.

I don't suppose you could post a broken MDG Technology?
My theories are always correct, just apply them to the right reality.

ZuluTen

  • EA User
  • **
  • Posts: 56
  • Karma: +0/-0
    • View Profile
Re: Have I misunderstood? MDG Diagrams and Toolbox
« Reply #5 on: June 25, 2014, 02:17:39 am »
Thanks for the offer, here it is:

Code: [Select]

<?xml version="1.0" encoding="UTF-8"?>
<MDG.Technology version="1.0"><Documentation id="My_MDG" name="Test" version="1" notes="Notes should be here" /><UMLProfiles><UMLProfile profiletype="uml2"><Documentation id="2B6C6AC5-9" name="My_MDG_Test" version="1.0" notes="My_MDG_Test" /><Content><Stereotypes><Stereotype name="My_Test_Class" notes="" cx="90" cy="70" bgcolor="-1" fontcolor="-1" bordercolor="-1" borderwidth="-1" hideicon="0"><AppliesTo><Apply type="Class"><Property name="isActive" value="" /></Apply></AppliesTo></Stereotype><Stereotype name="My_Test_Object" notes="" cx="90" cy="70" bgcolor="-1" fontcolor="-1" bordercolor="-1" borderwidth="-1" hideicon="0"><Image xmlns:dt="urn:schemas-microsoft-com:datatypes" type="EAShapeScript 1.0" dt:dt="bin.base64">UEsDBBQAAAAIAGZc2ER/hS4mWgAAAIIAAAAHABEAc3RyLmRhdFVUDQAHl2KpU5diqVOXYqlT
PY1LCoAwDETfVsE7uKzgRleCpyl+sKBWrOhCvLuDBQm8JMNkEpiwbAzkLJocKzcZKUHawShl
VnV40bPLZ6ioaSjF2ONe0H6XvVyWS0lWCY5TSeH/Y35fwiO+UEsBAhcLFAAAAAgAZlzYRH+F
LiZaAAAAggAAAAcACQAAAAAAAAAAAACAAAAAAHN0ci5kYXRVVAUAB5diqVNQSwUGAAAAAAEA
AQA+AAAAkAAAAAAA</Image><AppliesTo><Apply type="Object" /></AppliesTo><TaggedValues><Tag name="Owned_By" type="" description="" unit="" values="" default="" /></TaggedValues></Stereotype><Stereotype name="animal" metatype="Animal" notes="" cx="90" cy="70" bgcolor="-1" fontcolor="-1" bordercolor="-1" borderwidth="-1" hideicon="0"><Image xmlns:dt="urn:schemas-microsoft-com:datatypes" type="EAShapeScript 1.0" dt:dt="bin.base64">UEsDBBQAAAAIAGiCSz63++MALwEAACgEAAAHABEAc3RyLmRhdFVUDQAHiGFVTYhhVU2IYVVN
lVJNa8JAFJxrC/4HjwqKRusX3irVo0IRzwGlBk0UE9pD6X/vvJfEZjdZtSy8XXZnZud9xNjD
xxk71BHyFCDCN2p4xhM6XHW88faCOLvb4cgVkBHz3EAPA7TQZuxyf9HYZ2xi6mAMFZMzRso3
Ge/EJZiTI8wZTownepDf+uS34GGie49rXGKuGKN/8WyP4kc85vmIR8nUzRhmdUgZI40mw53V
Ql/WqnSpRDRLOuUcTZVXvd3q2aVU7PKSrwE+tP8+0dL3I9mh/pNk2C1RPr4UkxD7ydf4OkGi
XqW9ISIg7qBu8kkK6Uj4CfcGO+Pp/BQrJvWNroh2NmtS4T+MrSJ1l8lyq6S9NTG2ingZPOBF
ZtnO2dQac+Ju5+U9kNekwrOtcj+v1MutvHIvxbx+NP4CUEsBAhcLFAAAAAgAaIJLPrf74wAv
AQAAKAQAAAcACQAAAAAAAAAAAACAAAAAAHN0ci5kYXRVVAUAB4hhVU1QSwUGAAAAAAEAAQA+
AAAAZQEAAAAA</Image><AppliesTo><Apply type="Class"><Property name="isActive" value="" /></Apply></AppliesTo></Stereotype></Stereotypes><TaggedValueTypes /></Content></UMLProfile></UMLProfiles><DiagramProfile><UMLProfile profiletype="uml2"><Documentation id="CAEAF48E-0" name="My_MDG_Test" version="1.0" notes="My_MDG_Test" /><Content><Stereotypes><Stereotype name="My_Test_Diag_Class" notes="" cx="90" cy="70" bgcolor="-1" fontcolor="-1" bordercolor="-1" borderwidth="-1" hideicon="0"><AppliesTo><Apply type="Diagram_Logical"><Property name="toolbox" value="New_Classes" /></Apply></AppliesTo></Stereotype><Stereotype name="My_Test_Diag_Obj" notes="" cx="90" cy="70" bgcolor="-1" fontcolor="-1" bordercolor="-1" borderwidth="-1" hideicon="0"><AppliesTo><Apply type="Diagram_Object"><Property name="toolbox" value="New_Objects" /></Apply></AppliesTo></Stereotype><Stereotype name="ecoSystem" notes="" cx="90" cy="70" bgcolor="-1" fontcolor="-1" bordercolor="-1" borderwidth="-1" hideicon="0"><AppliesTo><Apply type="Diagram_Logical"><Property name="alias" value="ecoSystem" /><Property name="diagramID" value="eco" /><Property name="toolbox" value="My_MDG_Test" /></Apply></AppliesTo></Stereotype></Stereotypes><TaggedValueTypes /></Content></UMLProfile></DiagramProfile><UIToolboxes><UMLProfile profiletype="uml2"><Documentation id="B16E0154-C" name="My_MDG_Test" version="1.0" notes="My_MDG_Test" /><Content><Stereotypes><Stereotype name="My_MDG_TestElements" alias="ecoSystem" notes="The things that can be added to a diagram." cx="90" cy="70" bgcolor="-1" fontcolor="-1" bordercolor="-1" borderwidth="-1" hideicon="0"><AppliesTo><Apply type="ToolboxPage" /></AppliesTo><TaggedValues><Tag name="My_MDG_Test::animal(UML::Class)" type="" description="" unit="" values="" default="Animal" /></TaggedValues></Stereotype><Stereotype name="New_Classes" notes="" cx="90" cy="70" bgcolor="-1" fontcolor="-1" bordercolor="-1" borderwidth="-1" hideicon="0"><AppliesTo><Apply type="ToolboxPage" /></AppliesTo><TaggedValues><Tag name="My_MDG_Test::My_Test_Class(UML::Class)" type="" description="" unit="" values="" default="Add a Class Element" /></TaggedValues></Stereotype><Stereotype name="New_Objects" notes="" cx="90" cy="70" bgcolor="-1" fontcolor="-1" bordercolor="-1" borderwidth="-1" hideicon="0"><AppliesTo><Apply type="ToolboxPage" /></AppliesTo><TaggedValues><Tag name="My_MDG_Test::My_Test_Object(UML::Object)" type="" description="" unit="" values="" default="Add a New Object" /></TaggedValues></Stereotype></Stereotypes><TaggedValueTypes /></Content></UMLProfile></UIToolboxes></MDG.Technology>

« Last Edit: June 25, 2014, 03:24:57 am by ZuluTen »

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Have I misunderstood? MDG Diagrams and Toolbox
« Reply #6 on: June 25, 2014, 02:55:12 am »
That wont work. Please post the pure code. Not something enhanced by your editor.

q.

ZuluTen

  • EA User
  • **
  • Posts: 56
  • Karma: +0/-0
    • View Profile
Re: Have I misunderstood? MDG Diagrams and Toolbox
« Reply #7 on: June 25, 2014, 03:25:58 am »
Is that ^^ better?

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Have I misunderstood? MDG Diagrams and Toolbox
« Reply #8 on: June 25, 2014, 06:23:51 am »
That MDG works. I for myself can only confirm that the first 2 diagrams have no toolbox but the third has. Now, what was the original problem  :)

q.

KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2919
  • Karma: +54/-3
    • View Profile
Re: Have I misunderstood? MDG Diagrams and Toolbox
« Reply #9 on: June 25, 2014, 09:29:08 am »
You have given "toolbox" the name of the stereotype ("New_Objects", "New_Classes"). It needs to have the name of the toolbox profile ("My_MDG_Test").
The Sparx Team
[email protected]

ZuluTen

  • EA User
  • **
  • Posts: 56
  • Karma: +0/-0
    • View Profile
Re: Have I misunderstood? MDG Diagrams and Toolbox
« Reply #10 on: June 26, 2014, 09:25:53 pm »
Quote
That MDG works. I for myself can only confirm that the first 2 diagrams have no toolbox but the third has. Now, what was the original problem  :)

q.

Sorry for slow response, and thanks for looking at it.
Maybe I've not described what I was expecting:

Firstly, having selected the tick box for the appropriate MDG in Settings>MDG Technologies I was surprised to have to use More Tools at the top of the Toolbox Window before I could see my (new) Toolboxes. I had expected them to appear immediately.

Secondly, using my MDG (with 20+ toolboxes within it) and with the Toolbox and Project Browser windows open, when I used "Add Diagram" in the Project Browser, I was expecting the Toolbox Window to automatically change its layout (a bit like manually using the slider on the right hand side) to show the particular toolbox relevant to the particular diagram.

Am I expecting too much? Or am I using the GUI wrongly I wonder?


ZuluTen

  • EA User
  • **
  • Posts: 56
  • Karma: +0/-0
    • View Profile
Re: Have I misunderstood? MDG Diagrams and Toolbox
« Reply #11 on: June 26, 2014, 09:31:14 pm »
Quote
You have given "toolbox" the name of the stereotype ("New_Objects", "New_Classes"). It needs to have the name of the toolbox profile ("My_MDG_Test").

Thanks for your input, but you've confused me:
On my Toolbox profile diagram (I think) I've got <<metaclass>>ToolboxPage extended to three stereotypes:
New_classes
New_Objects
My_MDG_TestElements

Each of those three stereotypes 'contains' one element from the <<Profile>>

Have I misunderstood, or are you saying that the name of each of the three toolbox extension stereotypes should commence with "My_MDG_Test"? e.g. My_MDG_Test_New_Classes
« Last Edit: June 26, 2014, 09:34:03 pm by ZuluTen »

Uffe

  • EA Practitioner
  • ***
  • Posts: 1859
  • Karma: +133/-14
  • Flutes: 1; Clarinets: 1; Saxes: 5 and counting
    • View Profile
Re: Have I misunderstood? MDG Diagrams and Toolbox
« Reply #12 on: June 26, 2014, 09:50:22 pm »
No, he's talking about the toolbox attribute of the diagram «metaclass». This is what tells EA which toolbox to open for that type of diagram.

In the sample you sent, the attribute is set correctly for the "ecoSystem" diagram, but incorrectly for the other two.

The attribute must be set to the name of the «profile» (My_MDG_Test), not the name of the «stereotype» (My_MDG_TestElements, New_Classes and New_Objects). In other words the package, not the class.

Each «stereotype» represents a "toolbox page", ie the section with the bold header and the little plus/minus button to the left -- Common is a toolbox page. The «profile» (or package) represents the whole toolbox.

The diagram needs to refer to the entire toolbox, not an individual page. If you set this correctly, you will get the behavior you want: EA will open the correct toolbox each time you open a custom diagram, just like it does with the built-in ones.

/Uffe
« Last Edit: June 26, 2014, 09:53:08 pm by Uffe »
My theories are always correct, just apply them to the right reality.

ZuluTen

  • EA User
  • **
  • Posts: 56
  • Karma: +0/-0
    • View Profile
Re: Have I misunderstood? MDG Diagrams and Toolbox
« Reply #13 on: June 27, 2014, 12:59:34 am »
Quote
No, he's talking about the toolbox attribute of the diagram «metaclass». This is what tells EA which toolbox to open for that type of diagram.

In the sample you sent, the attribute is set correctly for the "ecoSystem" diagram, but incorrectly for the other two.

The attribute must be set to the name of the «profile» (My_MDG_Test), not the name of the «stereotype» (My_MDG_TestElements, New_Classes and New_Objects). In other words the package, not the class.

Each «stereotype» represents a "toolbox page", ie the section with the bold header and the little plus/minus button to the left -- Common is a toolbox page. The «profile» (or package) represents the whole toolbox.

The diagram needs to refer to the entire toolbox, not an individual page. If you set this correctly, you will get the behavior you want: EA will open the correct toolbox each time you open a custom diagram, just like it does with the built-in ones.

/Uffe

Thank you. That's exactly it: I was confusing Toolboxes and Toolbox Pages when setting the Toolbox attribute of a diagram Metaclass.

I now need to sort out the structure of the Toolboxes, but that's just an admin task.

Thanks again.