home *** CD-ROM | disk | FTP | other *** search
- !!Script
- // Copyright ⌐ 1997-2000 - Modelworks Software
-
- /**
- @Tool: namePackage~lets you name a package. You will need to close
- and then reopen the project to see the new name.
- @EndTool:
- @Summary: editPackage~lets you name a package
- */
-
- function DoCommand()
- {
- var project = getCurrentProject();
-
- if (project)
- {
- var packageList = project.getPackageList();
-
- if (packageList)
- {
- var packageToEdit = chooseFromList("Choose a package to name",
- packageList, getString, false);
-
- if (packageToEdit)
- {
- var name = prompt("Enter a name for this package", packageToEdit.name);
- if (name != packageToEdit.name)
- {
- packageToEdit.title = name;
- packageToEdit.forceUpdate();
- Application.updateWorkspaceTab("Class");
- Application.updateWorkspaceTab("Package");
- Application.updateWorkspaceTab("Files");
- }
- }
- }
- }
- else
- {
- alert("A project must be open before you can add 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
-