home *** CD-ROM | disk | FTP | other *** search
- !!Script
- // Copyright ⌐ 1997-1998 - Modelworks Software
-
- /**
- @Tool: removePackage~displays a list of packages you can remove
- from a project.
- @Image: Remove Package Dialog@removePackage_Project.gif
- @EndTool:
- @Summary: removePackage~displays a list of packages you can remove
- */
-
- function DoUpdate(cmdUI)
- {
- var project = getCurrentProject();
- cmdUI.enable(project != null && !project.readOnly)
- return true;
- }
-
- function DoCommand()
- {
- var project = getCurrentProject();
-
- if (project)
- {
- var packageList = project.getPackageList();
- if (packageList)
- {
- var packagesToRemoveList = chooseFromList("Choose packages to remove",
- packageList, getString, true);
-
- if (packagesToRemoveList)
- {
- var position = packagesToRemoveList.getHeadPosition();
- while(position.valid)
- {
- project.removePackage(packagesToRemoveList.getNext(position));
- }
- }
- }
- else
- {
- alert("No packages are in this project");
- }
- }
- else
- {
- alert("A project must be open before you can remove a package");
- }
- }
-
- function getString(item)
- {
- // assumes item is a package
- if (item.name.length > 0)
- {
- return item.name + " - " + item.sourcePath ;
- }
- return "<untitled> - " + item.sourcePath;
- }
-
- !!/Script
-