问题
I create a model using EA Scripting. The model consists of interfaces and each interface has operations. I also add these interfaces in a composition diagram , how can I not show the operations in diagram in EA.
Is it possible by some settings in EA or I need to do it programatically
Thanks
回答1:
Doing it for single elements manually is simple:
- From the context menu in the diagram choose
Features/...Visibility
- In
Operation Visibility
clickCustom
- Choose the operations you need to suppress
Now for the tricky part, if you need to do that for many diagrams at once. The information is stored in t_diagram.StyleEx
. This contains a semicolon separated list of entries. One of those entries might look like
SPL=S_E4BB5A=69A30E,2A49EF:;
Now E4BB5A
are the first 6 nibbles of the element GUID which is affected. 69A30E
and 2A49EF
are those of attributes or operations which shall be suppressed. So in order to suppress an operation on all diagrams you need to do the following:
oGuid = operation.methodGuid.substring(1,6) // get "69A30E" from "{69A30E-..."
eGuid = element.elementGuid.substring(1,6) // E4BB5A
sup = "SPL=S_" + eGuid + "=" + oGuid + ":;"
for dia in allDiagramsInRepos { // you need to build that on your own
dia.styleEx += sup
dia.update()
}
Of course you need to merge with existing SPL
entries rather than simply adding them. But you should get the idea.
来源:https://stackoverflow.com/questions/40149646/hide-operations-in-diagram-ea