ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik Hatcher <jakarta-...@ehatchersolutions.com>
Subject Re: Task missing method ? Write an ant project to disk ?
Date Sun, 15 Sep 2002 11:16:15 GMT
Olivier SCHMITT wrote:
> hi,
> i'm currently building a Java IDE with ant support.

Either you're really really good do not like any of the open-source 
IDE's enough to extend them to your tastes (NetBeans, Eclipse, jEdit) or 
you're insane!

> 1) Is it a way to create an ant project object and write it to disk in 
> XML format ?

Nope.  Someone was working on such a thing, I believe, but I have not 
seen any results of this.

> 2) I have choosen a JTree to represent an ant project structure.
> there are project node, target node, task node and finally property node.
> I select set methods for each task and display the value of the task 
> field for the corresponding set method. I use java.lang.reflect package 
> to get all task methods and select some.
> this a simple way to display all parameters for a given task and set or 
> get them
> For example :
> task : org.apache.tools.ant.task.Mkdir
> the mkdir class has this method :
> public void setDir(File aDir)
> so i display the property Dir

This is a reasonable first approximation, but its still not good enough. 
   You need to follow the rules that IntrospectionHelper uses to get the 
real picture of which attributes to show.  And how are you going to deal 
with sub-elements, such as datatypes or task-custom ones?  Also, the 
proposal/xdocs generated information is aiming towards having metadata 
available to such IDE's so that they can get a clear picture of what Ant 
supports or not - there are setters in some cases that are not 
documented and are not designed to be used from a build file, but 
introspection finds them as if they are attributes.  Be very careful 
here - and please leverage the proposal/xdocs information.

> and make an attempt to get the value with 
> getDir() but Mkdir has no getDir() method !
> the dir field in it is private !!! So i can't create a daughter class !
> I must create a new task class, copy the code of Mkdir and add getDir() 
> method.What do you think ?

Yikes!  You're really going to a lot of trouble for very little reward I 
think.  NetBeans, I believe (its been a while since I used it), uses XML 
parsing to read the build file and allow dialog boxes to interact with 
the build file structure in that manner.  This is related to your first 
issue about the Project object.

A couple of suggestions - don't try to reinvent the wheel on this.  IDEA 
has fantastic Ant support, but no fancy dialogs to navigate the tasks, 
just simple XML auto-expansion.  NetBeans takes it a bit further with 
XML parsing to present dialogs with the build file details populated.

	Erik


--
To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>


Mime
View raw message