I need some code that will generate a dialog box to prompt a user to browse/type the location of the specific link module or select all link modules, similar to how the analysis wizard does it. Since DOORS 8 can prevent certain users from editing DXL, I need this workaround. Here’s the script, the portion that needs a dialog box for picking all or a specific link module is noted by ***.
// Creates a DXL Attribute that contains all Out-Links from desired Link Module. The Out-Links are in order they
// appear in target modules. Attribute also contains Module Names and Object headings of linked objects.
/*
File: Sorted_OutLink_attribute.DXL Rev:1.0 11/20/03
/* Modification history:
*/
void showOut(Object o, int depth) {
//*** NEED DIALOG BOX HERE
//*** Start Link Set Tailoring
//***
//*** Add full path and name of desired Link module below
//*** Use "*" for all link modules
string linkModName = "*"
//***
//*** End Link Set Tailoring
//***
Link l
LinkRef lr
string otherModName
Module otherMod = null
Module linkMod = null
Object othero
string plain, plainDisp
int plainTextLen
int count
bool doneOne = false
Skip skipTargets = create //Skip List for target objects
Skip skipMods = create //Skip List for target modules
Item modItem, trgItem
Object lnko
string trgNum, heading, headNum //heading strings for object headings
string modID, trgModID //module IDs for skip list keys
string objID, trgID, ID //object IDs for skip list keys
Buffer disp = create //buffer for displaying attribute
int modCnt=0
int j
int lnkcnt = 0
bool head
//auto generated by DOORS Analysis wizard
for l in o->linkModName do {
otherModName = fullName(target l)
if (null otherModName) continue
if (!module otherModName) continue
if (isDeleted module otherModName) continue
othero = target l
if (null othero) otherMod=read(otherModName,false)
othero = target l
if (null othero) continue
if (isDeleted othero) continue
otherMod = module othero
doneOne = true
if (depth == 1) {
objID = (identifier othero)
modItem = item(otherModName) //need item to get unique ID for skip list key
modID = uniqueID(modItem)
ID = modID ":" objID //construct skip list key
put(skipTargets, ID "", othero) //add target object to skip list
lnkcnt++
if(!find(skipMods, modID "",otherMod)) //check to see if module is in skip list already
{
put(skipMods, modID "", otherMod) //add module to skip list
modCnt++ //count modules in list
}
}
}
Module m
disp = ""
string modNameSort[modCnt] //array of strings to sort module names
k=0
Regexp line = regexp "[-]"
for m in skipMods do
{
modNameSort[k] = fullName(m) //full name used to sort with
k++
}
sort modNameSort //sort list
for (j=0; j<modCnt; j++) //loop through skip list
{
trgFullModName = modNameSort[j] //sorted list
trgItem = item(trgFullModName)
trgModID = uniqueID(trgItem) //construct skip list key again
trgModName = name trgItem //used ID to retrieve module name without path
disp +="{\\b {\\ul " trgModName "}}\n" //add name to buffer
linkMod = read(trgFullModName, false) //open module with displaying
sorting off //turn sorting off so objects are in documented order
head = false
for lnko in linkMod do //loop through all objects in module
{
trgObjID = (identifier lnko)
trgNum = number(lnko)
if (!(line trgNum)) //regular expression for object headings
{
headNum = trgNum
heading = lnko."Object Heading"
head = true
}
trgID = trgModID ":" trgObjID //re-construct skip list key
if (find(skipTargets, trgID "", lnko)) //search skip list for object
{
if (head)
{
disp += "{\\i " headNum " " heading "}\n"
head = false
}
disp += "{\\b [" trgObjID "] }" probeRichAttr_(lnko,"Object Text", false) "\n"
delete(skipTargets, trgID)
}
}
}
delete(skipTargets)
delete(skipMods)
o.attrDXLName = richText stringOf(disp)
}
showOut(obj,1)
Edited: 8-Sep-2005
at 16:06
by Steven ODay