Author Topic: Feature req: Copy class Notes field to an instance  (Read 7598 times)

Smartrek

  • EA Novice
  • *
  • Posts: 8
  • Karma: +0/-0
    • View Profile
Feature req: Copy class Notes field to an instance
« on: August 26, 2010, 07:28:17 pm »
It would be convenient to have the option to copy the class Notes field to the instance when making an instance of a class.

Tanks
Marc
« Last Edit: August 26, 2010, 07:30:23 pm by smartrek »

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13387
  • Karma: +566/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Feature req: Copy class Notes field to an inst
« Reply #1 on: August 26, 2010, 08:53:28 pm »
Sorry Marc, but I don't agree.
The class and the instance are two different things, which should have their own notes.
If someone is interested in the documentation of the class then they should look there. Having multiple copies of the same note is redundant, and will only lead to confusion because those copies are bound to go out of synch.

Geert

Frank Horn

  • EA User
  • **
  • Posts: 535
  • Karma: +1/-0
    • View Profile
Re: Feature req: Copy class Notes field to an inst
« Reply #2 on: August 26, 2010, 09:05:10 pm »
Maybe a new optional compartment for instance rendering to show the classifier's notes?

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13387
  • Karma: +566/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Feature req: Copy class Notes field to an inst
« Reply #3 on: August 26, 2010, 09:54:09 pm »
That would be a better idea

Geert

beginner

  • Guest
Re: Feature req: Copy class Notes field to an inst
« Reply #4 on: August 27, 2010, 02:24:32 am »
How lovely it would be if there were a really programmable rendering machine.

b.

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8607
  • Karma: +257/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Feature req: Copy class Notes field to an inst
« Reply #5 on: August 27, 2010, 10:19:30 am »
Quote
How lovely it would be if there were a really programmable rendering machine.

b.
Seconded!
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

sargasso

  • EA Practitioner
  • ***
  • Posts: 1406
  • Karma: +1/-2
  • 10 COMFROM 30; 20 HALT; 30 ONSUB(50,90,10)
    • View Profile
Re: Feature req: Copy class Notes field to an inst
« Reply #6 on: August 31, 2010, 10:30:29 pm »
Absolutely! +++++ as many votes as I can get in.  The number of times I have had to alt-squish-ctl-shift-tab-stop-pick-up-mouse-find-wanted-item-stop-thinking-start-copying-whatwasIdoinganyway!!! is uncountable!

Between you and I though, I think it might be a useability feature, so  :'(

b  
"It is not so expressed, but what of that?
'Twere good you do so much for charity."

Oh I forgot, we aren't doing him are we.

Aaron B

  • EA Administrator
  • EA User
  • *****
  • Posts: 941
  • Karma: +18/-0
    • View Profile
Re: Feature req: Copy class Notes field to an inst
« Reply #7 on: September 01, 2010, 10:46:07 am »
EA already provides the ability to define your own custom compartments via an Add-In.  See:
http://www.sparxsystems.com/enterprise_architect_user_guide/automation_and_scripts/compartments_2.html

Just as a quick proof-of-concept I was able to implement these broadcast events to create my own custom compartment showing the notes of the element classifier (if one was set).  If anybody wants the C# code from my brief experiment, let me know.

beginner

  • Guest
Re: Feature req: Copy class Notes field to an inst
« Reply #8 on: September 01, 2010, 04:35:02 pm »
Aaron, please see the latest news from Sparx. You could publish it on the Community site.

b.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13387
  • Karma: +566/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Feature req: Copy class Notes field to an inst
« Reply #9 on: September 01, 2010, 04:36:38 pm »
Quote
Aaron, please see the latest news from Sparx. You could publish it on the Community site.

b.

Mmm.. you beat me to it ;D

Geert

Aaron B

  • EA Administrator
  • EA User
  • *****
  • Posts: 941
  • Karma: +18/-0
    • View Profile
Re: Feature req: Copy class Notes field to an inst
« Reply #10 on: September 02, 2010, 09:51:45 am »
I'll forward it on to the guys here who actually write the articles on the Community Site and see if they can organize something.  Until then, here is the code I used.  The CS_AddinFramework project can be used as the basis and then just paste this code into it.

Added a clause that requires a ShowClassifierNotes=True tagged value on the object to show the Classifier Notes - just so that you have some basic level of control over where it is displayed and it doesn't accidientally ruin existing diagrams.

I'm sure this code could do with a lot of improvement, but at least it should help provide a starting point if you want to work with custom compartments.

Code: [Select]
public object EA_QueryAvailableCompartments(EA.Repository repository)
{
    //Just define one additional Compartment named "Classifier Notes"
    return "Classifier Notes";
}

public object EA_GetCompartmentData(EA.Repository repository, string sCompartment, string sGUID, EA.ObjectType oType) {
    StringWriter data = new StringWriter();
    string compartmentName = sCompartment;

    //Handle the custom "Classifier Notes" compartment
    if (sCompartment.CompareTo("Classifier Notes") == 0)
    {
        //Get the current element
        EA.Element e = repository.GetElementByGuid(sGUID);

        //Does the current element have a classifier?
        if (e.ClassifierID != 0)
        {
            //Only show compartment where element has tagged value ShowClassifierNotes=True
            //This simply prevents any existing diagrams from being accidentally broken by the
            //addition of this new compartment.
            EA.TaggedValue tag = (EA.TaggedValue)e.TaggedValues.GetByName("ShowClassifierNotes");
            if (tag != null)
            {
                if (tag.Value.CompareTo("True") == 0)
                {
                    //Get a reference to the classifier element
                    EA.Element classifier = repository.GetElementByID(e.ClassifierID);

                    //Does the classifier actually have any notes?
                    if (classifier.Notes.Length > 0)
                    {
                        //Get the notes from the classifier in basic Text format
                        data.Write("Data&_eq_^" + repository.GetFormatFromField("TXT", classifier.Notes) + "&_sc_^");
                        //Use the classifier GUID as a reference for this compartment
                        data.Write("GUID&_eq_^" + classifier.ElementGUID + "&_sc_^,");
                        //Optional: Put the classifier element's name in the compartment name (E.g. "Class1 Notes")
                        compartmentName = classifier.Name + " Notes";
                    }
                }
            }
        }
    }

    //If data has been defined for this Compartment, return it to EA to be rendered.
    if (data.ToString().Length > 0)
    {
        StringWriter s = new StringWriter();
        s.Write("Name=" + compartmentName + ";");
        s.Write("OwnerGUID=" + sGUID + ";");
        s.Write("Options=SkipIfOnDiagram&_eq_^1&_sc_^");
        s.Write("CompartmentData=" + data.ToString() + ";");
        return s.ToString();
    }

    return null;
}

Aaron B

  • EA Administrator
  • EA User
  • *****
  • Posts: 941
  • Karma: +18/-0
    • View Profile
Re: Feature req: Copy class Notes field to an inst
« Reply #11 on: September 07, 2010, 12:01:21 pm »
For anybody interested, this example of how to define a custom compartment via an add-in has now been posted on the EA Community web site.
http://community.sparxsystems.com/resources/scripts/showing-classifier-notes-custom-compartment