// /* DXL to delete linksets for a given project/folder */ // Global variables LinkModuleDescriptor linkModDesc Folder thisFolder = current string errorStr = "" int noOfLinksets = 0 int initialNoOfLinksets = 0 Array a = create(2,1) DB delLinksetBox = create "Delete Linksets." DBE myListView /*-------------------------------------------------------------------------*/ // FUNCTIONS /*-------------------------------------------------------------------------*/ void initializeDB () { int myCount = 0 // Find out how many linksets there are in this folder for linkModDesc in thisFolder do { noOfLinksets ++ initialNoOfLinksets ++ } if (null noOfLinksets) { infoBox "There are no linksets in the current folder." return } // need to initialize the string array so that the listView doesn't complain string sourceModule[noOfLinksets] while (myCount < noOfLinksets) { sourceModule[myCount] = "test" myCount ++ } // Initialize the listView myListView = listView(delLinksetBox, listViewOptionMultiselect, 400, 6, sourceModule) } // END initializeDB /*-------------------------------------------------------------------------*/ // function to find all the linksets in the current folder/project void findLinkModDesc (DB delLinksetBox) { int i = 1 print "number of linksets: " noOfLinksets "\n" for linkModDesc in thisFolder do { //print i "\n" string myLinkSet = getSourceName(linkModDesc) myLinkSet = myLinkSet " <--> " getTargetName(linkModDesc) print "Found linkset: \t\t" myLinkSet "\t\t Name: " getName(linkModDesc) "\n" // put all linksets in an array string szSourceModule = getSourceName(linkModDesc) string szTargetModule = getTargetName(linkModDesc) put(a, szSourceModule, i-1, 0) put(a, szTargetModule, i-1, 1) i++ } // put the linksets in the listview //print "i is: " i "\n" int count = 0 while (count < i-1) { //print "count is: " count "\n" string temp = (string get(a, count, 0)) //print "string temp is: " temp "\n" set(myListView, count, 0, temp) temp = (string get(a, count, 1)) //print "string temp is: " temp "\n" set(myListView, count, 1, temp) count++ } } // END findLinkModDesc /*-------------------------------------------------------------------------*/ // Identify the selected items, put them in an array, then delete them. void deleteLinks(DB delLinksetBox) { int i = 0 for i in myListView do { string s = (string get(a, i, 0)) string s1 = (string get(a, i, 1)) string myLinkset = s " <--> " s1 // got a pair, now delete them print "Attempting to delete:\t" myLinkset "\n" errorStr = removeLinkModuleDescriptor(thisFolder, s, s1) if (null errorStr) { print "Removed linkset: \t\t" myLinkset "\n" noOfLinksets -- print "number of linksets is now: " noOfLinksets "\n" } else { print "Error in removing linkset\n" errorStr } } print "Done deleting the selected linksets.\n" //empty myListView // since "empty myListView" doesn't seem to work properly, do: for(x=0; x"right"->"unattached" apply (delLinksetBox, "Delete Linkset", myQuestion) realize delLinksetBox insertColumn (myListView, 0, "First Column", 100, iconNone) insertColumn (myListView, 1, "Second Column", 400, iconNone) } // END customizeDB /*-------------------------------------------------------------------------*/ // END FUNCTIONS /*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/ // START /*-------------------------------------------------------------------------*/ initializeDB if (null noOfLinksets) { print "There are no linksets in the current folder: " fullName thisFolder "\n" } else { customizeDB findLinkModDesc (DB delLinksetBox) show delLinksetBox } /*-------------------------------------------------------------------------*/ // END /*-------------------------------------------------------------------------*/ ------