Author Topic: Plugin of Script?  (Read 1432 times)

ngong

  • EA User
  • **
  • Posts: 77
  • Karma: +0/-0
    • View Profile
Plugin of Script?
« on: October 18, 2017, 05:12:21 am »
In order to speed up my everyday work I need to automate (put on a shortcut key)
- right-click on an element / Advanced /  Use Circle Notation (preferably for the set of selected elements)

As I do not have any experience in writing a plugin or a script I tried to find out, what would be the best.
However, I found several tutorials that would bind me a day or so, but I could not find out whether it is possible what I am trying to achieve.
Is it possible?
If so what the closest example to choose?

Rolf
Rolf

qwerty

  • EA Guru
  • *****
  • Posts: 9202
  • Karma: +140/-131
  • I'm no guru at all
    • View Profile
Re: Plugin of Script?
« Reply #1 on: October 18, 2017, 07:49:19 am »
Look at Geerts automation. He has something in that direction which IIRC is call EAMatic (myself I'm just using my own stuff ;-)

q.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 8027
  • Karma: +183/-21
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Plugin of Script?
« Reply #2 on: October 18, 2017, 04:32:03 pm »
If you are only looking for an context menu then scripting alone will suffice.
You simply have to put your script in an group of the appropriate type, and your script will show up as a context menu item where you need it.

If on the other hand you want to automatically do something as a reaction to one of the events in EA (such as after creating a new element, opening a diagram, etc...) then you need an add-in.

EA-Matic is an add-in that will forward all of the event to the scripting environment, automatically executing scripts at the events you choose.

Geert

Simon M

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 6273
  • Karma: +52/-5
    • View Profile
Re: Plugin of Script?
« Reply #3 on: October 19, 2017, 08:38:12 am »
In order to speed up my everyday work I need to automate (put on a shortcut key)
- right-click on an element / Advanced /  Use Circle Notation (preferably for the set of selected elements)
Unfortunately, neither add-ins or scripting can specify keyboard shortcuts, and I'm reasonably confident that command isn't available in the keyboard shortcut configuration dialog. Worse, neither scripting or an add-in will reduce the number of clicks clicks. (Right click / Scripts /  Your script) OR (Right click / Add-ins / Your add-in / Command) OR (Extensions Ribbon | Your add-in / Command)

Maybe what you need is a Template Package.

eg. If you always do this for Interfaces, create a template package, drop an interface onto the diagram and set it to use Circle Notation. From that point on, all interfaces you create will automatically have circle notation applied.
Simon

support@sparxsystems.com

ngong

  • EA User
  • **
  • Posts: 77
  • Karma: +0/-0
    • View Profile
Re: Plugin of Script?
« Reply #4 on: October 19, 2017, 09:42:25 pm »
Ok, thank you for your help qwerty, Geert, and Simon.

What I understood is:
I need an add-in or a script applying EA-Matic that puts all interfaces found in a Component diagram and not already process to circle notation, e.g. in case the diagram changes. Alternatively I may also learn about templates. Then I could create a template for Component diagram that shows interfaces by default as circles.
I got to forget the idea of using a shortcut key.

I am pretty sure not to have understood everything - please correct.

Kind Regards

Rolf
p.s. if I would not be able to reduce the number of clicks, any automation would be worthless.
« Last Edit: October 19, 2017, 09:46:09 pm by ngong »
Rolf

qwerty

  • EA Guru
  • *****
  • Posts: 9202
  • Karma: +140/-131
  • I'm no guru at all
    • View Profile
Re: Plugin of Script?
« Reply #5 on: October 19, 2017, 10:20:58 pm »
You'd need to explain your workflow in more detail. Is it all interfaces you want in circle notation? Then go for Simon's way. Is it a number of interfaces you want to select and then do the magic on them once, use a simple script that takes them and does the magic for you.

q.

ngong

  • EA User
  • **
  • Posts: 77
  • Karma: +0/-0
    • View Profile
Re: Plugin of Script?
« Reply #6 on: October 20, 2017, 09:34:08 am »
Thank you for the question qwerty, let me explain:

My real problem is that I am doing re-engineering instead of SW architecture (guess that is the way 90% of all SW architectures for real commercial programs are created). The prototype works somewhat and the company (SW quality) likes to know what they got and have to maintain. External auditors also are more strict in this. Re-engineering leads to a lot of .h-files to import as UML interfaces for having tractability to the code.

Showing these interfaces on class diagrams for detailed view is no problem.
Showing these interfaces (and sub- and super-sets of them) in component diagrams is required in order to have a base for interactions (e.g. sequence diagrams), the basis of traceability to SW requirements, module requirements and integration tests.
On component diagrams I do not need the details of the interface - just the name. Usage of circle notation is the way we decided to do - as opposed to forks and lollipops. My task is to place the massive amount of interfaces - together with their sub- and super-sets - on component diagrams. As it is a big software I have lots of hierarchically ordered component diagrams - all with inner and external interfaces. Turning each of these interface to circle notation takes a fair amount of my time - too many clicks.

As I understood scripts do not help much to save clicks.

Therefore I have to learn about templates (not sure though if that helps) or have to apply EA-Matic to get an "Component Diagram Change" event for triggering (if that exists) to check all interfaces of that diagram for circle notation.
« Last Edit: October 20, 2017, 09:57:53 am by ngong »
Rolf

qwerty

  • EA Guru
  • *****
  • Posts: 9202
  • Karma: +140/-131
  • I'm no guru at all
    • View Profile
Re: Plugin of Script?
« Reply #7 on: October 20, 2017, 10:00:08 am »
If it's more like "turn them into circles completely on this diagram" a script will help since it's doing the job in a bunch with (almost) one click. Even for "all except a few I marked" will be supported by a script. Or "do it just for the few I marked". That could be done with two scripts (for the selection) using a third one (to do the conversion).

When I did such a RE job last time I used lot's of ports with interfaces. I had a script to align ports in a meaningful way. That saved a lot of time.

q.
« Last Edit: October 20, 2017, 10:01:43 am by qwerty »

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 6033
  • Karma: +73/-83
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Plugin of Script?
« Reply #8 on: October 20, 2017, 11:06:29 am »
Hey Rolf,

We had a similar requirement at one stage.  One some diagrams we wanted this metatype to render as Rectangular Notation, on other diagrams as non-Rectangular notation. But on a certain kind of diagram we wanted them to appear in a third form.  So we stereotyped the diagram and amended the shapescript to detect that and render accordingly.  Worked REALLY well

If you can hack the shapescript, that might be one way out of your problem.  It ALSO has the benefit that it is, effectively, a declarative solution.

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

ngong

  • EA User
  • **
  • Posts: 77
  • Karma: +0/-0
    • View Profile
Re: Plugin of Script?
« Reply #9 on: October 21, 2017, 06:21:02 am »
qwerty, Paolo - thank you for your helpful contribution: a script for processing all interfaces on the current diagram would do - at least in the first place.

Paolo - I looked around Shapescript examples. I understood that they are used to do other notations than provided by UML and they are bound to a certain stereotype. That is not what I want. I like to switch some Rectangle/Circle property somewhere, not to draw anything.

From Geerts scripts tutorial I found a Diagram script close to what I try to achieve. It is fairly easy to loop over all interfaces found on a diagram.
But how to determine whether the shape is rectangle or circle? And how to switch it? I could not find a certain property or function of the located EA.element. I also wonder whether this should be a property of that interface EA.element. It should show up as a circle on the one current diagram only! For my understanding it could be a property of the relation between the Interface EA.element and the Diagram it is located on. Hmm ... how to find that in the Automation Object Model?

I feel I am close but would like to ask for some help here.

Kind Regards


Rolf
« Last Edit: October 21, 2017, 06:33:32 am by ngong »
Rolf

qwerty

  • EA Guru
  • *****
  • Posts: 9202
  • Karma: +140/-131
  • I'm no guru at all
    • View Profile
Re: Plugin of Script?
« Reply #10 on: October 21, 2017, 07:59:46 am »
It's fairly easy to find that. The DiagramObject has its Style property where you find "Lollipop=1;" or you don't.

Anyhow, I found the use of Ports much more convenient where you add Provided/RequiredInterfaces that can be classified (since EA is so consistent Ctrl-L does not work and you need to open the properties dialog to use the ellipsis button here).

q.

Helmut Ortmann

  • EA User
  • **
  • Posts: 909
  • Karma: +38/-1
    • View Profile
Re: Plugin of Script?
« Reply #11 on: October 25, 2017, 03:15:30 pm »
Hi,

If you want to change something about notation/appearance in diagrams (Diagram, Elements, Connectors), check the free hoTools https://github.com/Helmut-Ortmann/EnterpriseArchitect_hoTools/wiki/DiagramGeneralStyles. It allows you to modify arbitrary appearance information. If something is missing and it's easy to implement, drop me a note, and I think about adding this feature to hoTools - free of charge.

You can define your appearance by jason templates and apply it to selected Diagrams, Elements, Packages and even the whole model. In effect after definition your types you can use them with just one click.

I developed it because applying styles bothered me and I want to find an easy to use solution. The less clicks, the better!

Kind regards,

Helmut
Coaching, Training, Workshop (Addins: hoTools, Search&Replace, LineStyle)