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 = null;

    public void addFileset(FileSet set)
    {
        if (fileSets == null)
            fileSets = 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 = 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 = (LinkedList)
DocletContext.getInstance().getConfigParam("filesets");
        FileSourceSet[] sourceSets = new FileSourceSet[filesets.size()];
        xjavadoc = new XJavaDoc();
        xjavadoc.setUseNodeParser(true);

        for (int i = 0; i < filesets.size(); i++) {
            FileSet fs = (FileSet) filesets.get(i);
            File dir = fs.getDir(fs.getProject());

            DirectoryScanner ds = fs.getDirectoryScanner(fs.getProject());
            String[] files = ds.getIncludedFiles();

            sourceSets[i] = 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 = xjavadoc.getXClass(clazz.getQualifiedName());
newclazz = 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.

_



-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games.
Get your fingers limbered up and give it your best shot. 4 great events, 4
opportunities to win big! Highest score wins.NEC IT Guy Games. Play to
win an NEC 61 plasma display. Visit http://www.necitguy.com/?r 
_______________________________________________
xdoclet-user mailing list
xdoclet-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xdoclet-user

Reply via email to