home *** CD-ROM | disk | FTP | other *** search
- !!Script
- // Copyright ⌐ 1997-1998 - Modelworks Software
- // @Modified build 497 cm20010225
-
- /**
- @Tool: removeBookmark~displays the list of active bookmarks and lets
- you choose bookmarks to remove.
- @Image: Remove Bookmarks Dialog@removeBookmark_Dialog.gif
- @EndTool:
- @Summary: removeBookmark~removes one or more bookmarks
- */
-
- var gOutput = getOutput();
-
- function DoCommand()
- {
- var bookmarkMap = getMapFile("Bookmarks");
-
-
- var list = newList();
- var position = bookmarkMap.getHeadPosition();
- while (position && position.valid)
- {
- var next = bookmarkMap.getNext(position);
- if (next.value)
- {
- if (next.value.valid())
- {
- list.addTail(next);
- }
- else
- {
- bookmarkMap.remove(next.value.hashKey);
- }
- }
- else
- {
- bookmarkMap.removeAll();// Error
- }
- }
-
- if (list.count == 0)
- {
- alert("No bookmarks to remove");
- return;
- }
-
- list.sort();
-
- var result = chooseFromList("Choose bookmarks to remove",
- list, getString, true, false);
-
- if (result)
- {
- var position = result.getHeadPosition();
- while (position && position.valid)
- {
- var next = result.getNext(position);
-
- bookmarkMap.remove(next.value.hashKey);
- next.value.remove();
- }
- }
- }
-
- // Callback to get the display string for each item in the
- // chooseFromList function
- function getString(item)
- {
- // Assumes is is an association
- var bookmark = item.value;
- if (bookmark)
- {
- return bookmark.path + ":" + (bookmark.startLineIndex+1) + " - " + bookmark.description;
- }
- return "Invalid Bookmark";
- }
-
- !!/Script
-
-
-