From: Matthieu P. <xdo...@ch...> - 2005-04-29 21:59:13
|
matthieu peschaud wrote: | [...] Hi everybody, if it can help someone having a similar problem than me, and looking in the mailing list archive ;) here is the solution I choose for my problem : The idea is to make the fileset given to the docletTask directly accessible to every subtasks. To do that I have overloaded the addFileset in in the main ant task ("jcsdoclet" for me) : private LinkedList fileSets =3D null; public void addFileset(FileSet set) { if (fileSets =3D=3D null) fileSets =3D new LinkedList(); fileSets.add(set); super.addFileset(set); } then I have put setters and getters on the fileSets element public void setFileSets(LinkedList fileSets) { this.fileSets =3D fileSets; } public LinkedList getFileSets() { return fileSets; } This is just to make the fileSets linked list available into the configuration parameters map of the DocletContext. After that it's quite easy to get the filesets everywhere in the subtasks. Here an example of the way I use it to initialize my xjavadoc instance : private XJavaDoc xjavadoc; private XJavaDoc initializeRMXjavadoc() { LinkedList filesets =3D (LinkedList) DocletContext.getInstance().getConfigParam("filesets"); FileSourceSet[] sourceSets =3D new = FileSourceSet[filesets.size()]; xjavadoc =3D new XJavaDoc(); xjavadoc.setUseNodeParser(true); for (int i =3D 0; i < filesets.size(); i++) { FileSet fs =3D (FileSet) filesets.get(i); File dir =3D fs.getDir(fs.getProject()); DirectoryScanner ds =3D = fs.getDirectoryScanner(fs.getProject()); String[] files =3D ds.getIncludedFiles(); sourceSets[i] =3D new FileSourceSet(dir, files); xjavadoc.addSourceSet(sourceSets[i]); } return RMxjavadoc; } I can now have a direct access on every class sources, and save my modifications : XClass newclazz =3D xjavadoc.getXClass(clazz.getQualifiedName()); newclazz =3D changeClassTags(newclazz); // modifications on tags saveClassToPath(newclazz, getDestDir()); // a simple save method There is maybe a simplier solution, but a have no more idea This is working, and it have the avantages to work with xdoclet 1.2 without need of core modifications. I hope xdoclet 2 will have good solutions to extract body of methods, to write tags directly useable within templates files. I will have an attentive look on this project. _=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00= =00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00= =00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00= =00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00= =00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00= =00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00= =00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00= =00=00 |