+ /** Creates the tree-based structure for this project. */\r
+ private void registerProjectAndParents(Project project,\r
+ SlcAntConfig slcAntConfig) {\r
+ StructureRegistry registry = (StructureRegistry) project\r
+ .getReference(REF_STRUCTURE_REGISTRY);\r
+ File rootDir = new File(project\r
+ .getUserProperty(SlcAntConfig.ROOT_DIR_PROPERTY))\r
+ .getAbsoluteFile();\r
+ File baseDir = project.getBaseDir().getAbsoluteFile();\r
+ List<File> dirs = new Vector<File>();\r
+ File currentDir = baseDir;\r
+ do {\r
+ dirs.add(currentDir);\r
+ currentDir = currentDir.getParentFile();\r
+ if (log.isTraceEnabled())\r
+ log.trace("List " + currentDir);\r
+ } while (!currentDir.equals(rootDir.getParentFile()));\r
+\r
+ // first path is root dir (because of previous algorithm)\r
+ TreeSPath currPath = TreeSPath.createRootPath(rootDir.getName());\r
+ for (int i = dirs.size() - 1; i >= 0; i--) {\r
+ File dir = dirs.get(i);\r
+\r
+ // retrieves description for this path\r
+ final String description;\r
+ if (i == 0) {// project itself\r
+ description = project.getDescription() != null ? project\r
+ .getDescription() : "[no desc]";\r
+ } else {\r
+ description = slcAntConfig.getDescriptionForDir(dir);\r
+ }\r
+ SimpleSElement element = new SimpleSElement(description);\r
+\r
+ // creates and register path\r
+ if (!dir.equals(rootDir)) {// already set\r
+ currPath = currPath.createChild(dir.getName());\r
+ }\r
+ registry.register(currPath, element);\r
+ }\r
+ project.addReference(REF_PROJECT_PATH, currPath);\r