Book a Demo

Author Topic: Custom Action Pins (Solved)  (Read 4600 times)

Hermelin

  • EA User
  • **
  • Posts: 23
  • Karma: +0/-0
    • View Profile
Custom Action Pins (Solved)
« on: December 02, 2013, 07:06:25 pm »
Hi,

A new week with new questions!  :)

In a custom MDG I would like to define custom action input/output pins. Anyone know how to do that?

I have created a stereotypes that extends UML InputPin and OutputPin and I have a custom Flow that extends ObjectFlow. Now, how do I tell EA to create my custom pins instead of the standard when creating a new flow relationship?

Thank you for your help!
« Last Edit: December 09, 2013, 09:01:32 pm by hermelin »

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Custom Action Pins
« Reply #1 on: December 03, 2013, 08:46:28 am »
Dont ask me for details (too long ago) but the Quick Linker should be able to do that for you. It's quite awkward to handle, though.

q.

KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2919
  • Karma: +55/-3
    • View Profile
Re: Custom Action Pins
« Reply #2 on: December 03, 2013, 09:57:37 am »
I think that's actually beyond the ability of custom quicklinker definitions. On dragging a quicklink between two activities, you can get it to create a pin at the target end, but not at the source end. Instead, you would probably need to look at an add-in that implements an EA_OnPostNewConnector broadcast handler.
« Last Edit: December 03, 2013, 10:08:35 am by KP »
The Sparx Team
[email protected]

Hermelin

  • EA User
  • **
  • Posts: 23
  • Karma: +0/-0
    • View Profile
Re: Custom Action Pins
« Reply #3 on: December 04, 2013, 02:49:54 am »
Thanks for the tip. I will look into the addin-way then.

p.s The quicklinker do create pins at both ends... d.s.

Hermelin

  • EA User
  • **
  • Posts: 23
  • Karma: +0/-0
    • View Profile
Re: Custom Action Pins
« Reply #4 on: December 05, 2013, 09:17:00 pm »
I have tried to capture this with an addin, but I stumpled on how to get access to the newly created connection.

Too my addin I have added the:
public virtual bool EA_OnPostNewConnector(EA.Repository Repository, EA.EventProperties Info){}

The Info object should contain what I need: "Info Contains the following EventProperty objects for the new connector:      ConnectorID: A long value corresponding to Connector.ConnectorID"

But I can't figure out how to read that value from the info object.  I can't find any such value in debug mode either.

Even more, the EventProperty Class should according to Sparx contain a "Value" attribute, but this do not seems to be the case. In any case I can't access it.

Any advice?

// H.

Reference:
http://www.sparxsystems.com/enterprise_architect_user_guide/10/automation_and_scripting/eventproperty.html
http://www.sparxsystems.com/enterprise_architect_user_guide/10/automation_and_scripting/broadcastpostnewconnector.html

KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2919
  • Karma: +55/-3
    • View Profile
Re: Custom Action Pins
« Reply #5 on: December 06, 2013, 08:47:40 am »
Here's some C#:

Code: [Select]
       public bool EA_OnPostNewConnector(EA.Repository Repository, EA.EventProperties Info)
        {
            EA.EventProperty ep;

            for (int i = 0; i < Info.Count; i++)
            {
                ep = Info.Get(i);
                MessageBox.Show(ep.Name + "=" + ep.Value);
            }

            return true;
        }

For me, this put up a message box with "ConnectorID=32131".
The Sparx Team
[email protected]

Hermelin

  • EA User
  • **
  • Posts: 23
  • Karma: +0/-0
    • View Profile
Re: Custom Action Pins
« Reply #6 on: December 09, 2013, 08:13:17 pm »
Thank you very much KP!

My confusment steams from that the Value attribute isn't showing up in intellisense and that that Value contains an object rather than a Long, which I expected.

With int.Parse(ep.Value.ToString()) I finally got the ID.

// H