home *** CD-ROM | disk | FTP | other *** search
- !!Script
- // Copyright ⌐ 1997-1998 - Modelworks Software
- // @Created build 237 cm19981117
-
- /**
- @Tool: editBuildOrder~lets you edit the order of packages in a project.
- @EndTool:
- @Summary: editBuildOrder~lets you edit the order of packages in a project
- */
-
- 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();
-
- var packagesNotInbuild = RemoveNonbuildPackages(packageList);
-
- if (packageList)
- {
- var newPackageList = reorderList("Edit build order", "Choose the order in which the packages will be built",
- packageList, getString);
-
- if (newPackageList)
- {
- newPackageList.appendList(packagesNotInbuild);
- project.setPackageList(newPackageList);
-
- project.forceUpdate();
- Application.updateWorkspaceTab("Class");
- Application.updateWorkspaceTab("Package");
- Application.updateWorkspaceTab("Files");
- }
- }
- }
- else
- {
- alert("A project must be open before you can add a package");
- }
- }
-
- function RemoveNonbuildPackages(packageList)
- {
- var list = newList();
- var position = packageList.getHeadPosition();
- while (position && position.valid)
- {
- var current = position.clone();
- var pkg = packageList.getNext(position);
- if (!pkg.includeInBuild)
- {
- packageList.removeAt(current);
- list.addTail(pkg);
- }
- }
- return list;
- }
-
- function getString(item)
- {
- // assumes item is a package
- if (item.name.length > 0)
- {
- return item.name + " - " + item.sourcePath ;
- }
- return "<untitled> - " + item.sourcePath;
- }
-
-
- !!/Script
-