// Delete all links on objects in current display set /* Delete all links attached to all objects in the current display set. who when what --- ---- ---- cfc aug 31 00 added dialog added link module selection added link direction selection added object set selection */ /* Kitchen Tools for customizing DOORS with DXL V5.2 ------------------------------------------------- DISCLAIMER: This programming tool has been thoroughly checked and tested at all stages of its production. Telelogic cannot accept any responsibility for any loss, disruption or damage to your data or your computer system that may occur while using this script. If you do not accept these conditions, do not use this customised script. ------------------------------------------------- */ if ( !confirm "This script will delete links on objects in current display set.\n" //- "To delete specific links to objects in the current display set, \n" //- "filter the current View as needed and use the checkboxes and selections \n" //- "in the filter tool window to choose which links you'd like to delete.\n\n" //- "Continue?" ) { halt } #include #include string directions[] = {"All", "Incoming", "Outgoing"} string objectSet[] = {"All", "Selection", "Display set"} DB db = null DBE rbxLinkDir = null DBE tglAllLinkMods = null DBE mltLinkMods = null DBE rbxObjSet = null int numLnkMods = 0 // count link modules Item it for it in current Project do { string modName = fullName(it) if ( !null module_ modName && type module_ modName == "Link" ) numLnkMods++ } if ( numLnkMods == 0 ) { ack "There are no link modules in this project." halt } // create array of link module names string lnkMods[numLnkMods] numLnkMods = 0 for it in current Project do { string modName = fullName(it) if ( null module_ modName || type module_ modName != "Link" ) continue lnkMods[numLnkMods++] = modName } void doToggle(DBE dbe) { if(get tglAllLinkMods) inactive mltLinkMods else active mltLinkMods } void deleteLinks(bool chkSel) { string dir = directions[get(rbxLinkDir)] if(dir == "All") dir = "*" else if(dir == "Incoming") dir = "<-" else dir = "->" if(get tglAllLinkMods) { // delete links for all link modules Object o for o in current Module do { if(chkSel && isSelected o || !chkSel) deleteLinks(o, dir, "*") } } else { // delete links for selected link modules string lmn for lmn in mltLinkMods do { Object o for o in current Module do { if(chkSel && isSelected o || !chkSel) deleteLinks(o, dir, lmn) } } } refresh current } void doDeleteLinks(DB db) { string objSet = objectSet[get(rbxObjSet)] bool chkSel = false bool filt = false if(objSet == "All" && filtering current Module) { filt = true filtering off } else if(objSet == "Selection") chkSel = true deleteLinks(chkSel) if(objSet == "All" && filt) filtering on } db = create "Delete Links" rbxLinkDir = radioBox(db, "Links: ", directions, 0) tglAllLinkMods = toggle(db, "All link modules", true) mltLinkMods = multiList(db, "Link modules:", 200, 5, lnkMods) rbxObjSet = radioBox(db, "Object set: ", objectSet, 0) set(tglAllLinkMods, doToggle) apply(db, "Delete", doDeleteLinks) inactive mltLinkMods show db)