Sparx Systems Forum
Enterprise Architect => Uml Process => Topic started by: Alberto Favetta on July 22, 2013, 06:37:30 pm
-
Hi,
sometimes we are used to insert, in a diagram, links to other diagrams.
Is there a way to know where a diagram is linked?
It is possible with elements and even packages (find in all diagrams command) but for the diagrams the command is not available.
thanks!
Alberto
-
Not that easy. You can try this SQL:
select o.ea_guid AS CLASSGUID, o.Object_Type AS CLASSTYPE, o.name as LName, d.name as DName from t_object as o, t_diagram as d where pdata1 = format(d.Diagram_ID, "#") and Object_Type like "UMLDiagram" and d.ea_guid = "<Search Term>"Create a SQL search from that. From the context menu of the diagram in question issue Copy Reference/Node GUID and paste the result in the search field.
A dedicated add-in could do better...
q.
-
Hi Alberto,
the SQL:
Select o.ea_guid AS CLASSGUID, o.object_type As CLASSTYPE,
o.name, o.Object_Type AS Type, o.stereotype,'Reference to diagram' As Usage, dia.name As Diagram_Name, dia.diagram_type
#DB=DUMMY# /* Reference to Diagram */ #DB=DUMMY#
from
#DB=JET# t_object o INNER JOIN t_diagram dia on ( o.pdata1 = Format(dia.diagram_id )) #DB=JET#
#DB=SQLSVR# t_object o INNER JOIN t_diagram dia on ( o.pdata1 = dia.diagram_id ) #DB=SQLSVR#
#DB=ORACLE# t_object o INNER JOIN t_diagram dia on ( o.pdata1 = Cast(dia.diagram_id as Varchar2(39)) ) #DB=ORACLE#
where dia.ea_guid = '<Search Term>' AND o.object_type in ('InteractionOccurrence', 'Text', 'UMLDiagram')
UNION
Select o.ea_guid , o.object_type ,
o.name, o.Object_Type , o.stereotype,
'Composite of diagram' , ' ', ' '
from
t_xref x INNER JOIN t_object o on (x.client = o.ea_guid)
where x.supplier = '<Search Term>'
order by 3,4,5
Helmut
-
Hi Alberto,
the Browser script to find diagram usage by right click, script, ..
option explicit
!INC Local Scripts.EAConstants-VBScript
'
'--------------------------------------------------------------------------------------------------
'- Find Usage of Diagram
'--------------------------------------------------------------------------------------------------
'- Diagram: Find Usage of selected Diagram'
'
' History:
' 07. December 2011: Created
'
'
'
'
sub main()
' check diagram
'Session.Output "test"
'Session.Prompt "This script does support diagram items. ", promptOK
dim guid
dim id
dim el
dim s
dim selected
set selected = Repository.GetContextObject()
dim selectedDiagram as EA.Diagram ' to use intelli sense for Diagram
Set selectedDiagram = selected
'-------------------------------------------------------------------------------------
'on Diagram
if not selected is nothing AND selectedDiagram.ObjectType = otDiagram then
Repository.RunModelSearch "Diagram usage", selectedDiagram.DiagramGUID, "", ""
exit sub
'Session.Output CStr(selectedConnector)
' Session.Prompt "This script does not support diagram items of this type.", promptOK
else
'-------------------------------------------------------------------------------------
'in Browser
' Get the type of element selected in the Project Browser
dim treeSelectedType
treeSelectedType = Repository.GetTreeSelectedItemType()
' Handling Code: Uncomment any types you wish this script to support
' NOTE: You can toggle comments on multiple lines that are currently
' selected with [CTRL]+[SHIFT]+[C].
select case treeSelectedType
case otDiagram
dim theDiagram as EA.Diagram
set theDiagram = Repository.GetTreeSelectedObject()
Repository.RunModelSearch "Find CompositeElement of Diagram", theDiagram.DiagramGUID, "", ""
'
'
' Code for when a method is selected
' case otMethod
case else
' Error message
Session.Prompt "This script does not support items of this type.", promptOK
end select
end if
end sub
main()
Create a script Group Browser Scripts, New VB Script, overwrite it
Helmut