home *** CD-ROM | disk | FTP | other *** search
- !!Script
- // Copyright ⌐ 1999 - Modelworks Software
- // @Created build 289 cm19990419
-
- /**
- @Tool: addPackages~adds all top level java packages to
- the current project.
- @EndTool:
- @Summary: addPackages~adds all top level java packages.
- */
-
- var gOutput = getOutput();
-
- function DoCommand()
- {
- var project = getCurrentProject();
-
- if (project)
- {
- var path = "" ; // Enter the path to your directory - ??\\MyProjects\\com\\modelworks"
- var pkgRoot = ""; // Enter your root package name - "com.modelworks"
-
- if (path == "" || pkgRoot == "")
- {
- alert("You must edit this script before you can run it.");
- return;
- }
-
- var directoryList = getDirectories(path);
- var position = directoryList.getHeadPosition();
- while (position && position.valid)
- {
- var directory = directoryList.getNext(position);
-
- gOutput.writeLine("Adding package for: " + directory.path);
-
- var pkgName = pkgRoot + "." + directory.title;
- var sourcePath = directory.path; // Change this if you want another path
-
- // Change destinationPath if you want another path
- var destinationPath = sourcePath.substring(0, sourcePath.length - pkgName.length);
-
- var pkg = newPackage("java", sourcePath, destinationPath, pkgName);
- pkg.includeSubdirectories = true;
-
- project.addPackage(pkg);
- }
-
- // Force update of tabs
- Application.updateWorkspaceTab("Class");
- Application.updateWorkspaceTab("Package");
- Application.updateWorkspaceTab("Files");
- }
- else
- {
- alert("A project must be open before you can add a package");
- }
- }
-
-
- !!/Script
-