Return-Path: Delivered-To: apmail-ant-dev-archive@www.apache.org Received: (qmail 52207 invoked from network); 7 Jun 2006 08:30:37 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 7 Jun 2006 08:30:37 -0000 Received: (qmail 19813 invoked by uid 500); 7 Jun 2006 08:30:35 -0000 Delivered-To: apmail-ant-dev-archive@ant.apache.org Received: (qmail 19776 invoked by uid 500); 7 Jun 2006 08:30:35 -0000 Mailing-List: contact dev-help@ant.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Ant Developers List" Reply-To: "Ant Developers List" Delivered-To: mailing list dev@ant.apache.org Received: (qmail 19765 invoked by uid 99); 7 Jun 2006 08:30:35 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 07 Jun 2006 01:30:35 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of whaefelinger@epo.org designates 145.64.132.99 as permitted sender) Received: from [145.64.132.99] (HELO gvmail04.epo.nl) (145.64.132.99) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 07 Jun 2006 01:30:33 -0700 Received: from localhost (localhost [127.0.0.1]) by gvmail04.epo.nl (Postfix) with ESMTP id EAEE82841B for ; Wed, 7 Jun 2006 10:30:12 +0200 (CEST) Received: from mail01.internal.epo.org (smtpmail.internal.epo.org [10.0.5.175]) by gvmail04.epo.nl (Postfix) with ESMTP id CDB3227F12 for ; Wed, 7 Jun 2006 10:30:10 +0200 (CEST) In-Reply-To: <255d8d690606061041va09b56eh8c970adb5e7e71bc@mail.gmail.com> To: "Ant Developers List" Subject: Re: how to access a MacroDef? MIME-Version: 1.0 X-Mailer: Lotus Notes 653HF812 February 24, 2006 From: Wolfgang =?ISO-8859-1?Q?H=E4felinger?= Message-ID: Date: Wed, 7 Jun 2006 10:30:10 +0200 X-MIMETrack: Serialize by Router on Mail01/EPO(Release 7.0.1|January 17, 2006) at 07-06-2006 10:30:10, Serialize complete at 07-06-2006 10:30:10 Content-Type: text/plain; charset="US-ASCII" X-Virus-Scanned: at epo.org X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Allright, it appears much more easier than expected. ComponentHelper componenthelper; Object obj; MacroInstance instance; componenthelper = ComponentHelper.getComponentHelper(project()); obj = componentHelper.createComponent(mymacroname); instance = (MacroInstance)obj; instance.execute(); Appears that there's no need to call setProject() or setOwningTarget() on the macro's instance. However, not sure whether this is the "right" way to do. Perhaps Peter can comment on this. Thanks for all help so far. Wolfgang. "Dominique Devienne" 06-06-2006 19:41 Please respond to "Ant Developers List" To "Ant Developers List" cc Subject Re: how to access a MacroDef? > I tried something like > > ComponentHelper componenthelper = > ComponentHelper.getComponentHelper(project()); > MacroDef def = (MacroDef) > componenthelper.getTaskDefinitions().get(mymacroname); > > just in order to understand that Hastable getTaskDefinitions() contains a > String => Class relation. > > So where are those MacroDef's hidden? So your 'def' is null, right? Try not casting it to MacroDef, and see which kind of Java Class is returned, if any. It may be an UnknownElement (my guess), a MacroInstance, etc... >From the UE, you may be able to get a MacroInstance or a MacroDef, and if the later, configure it into a MacroInstance, which is what you want to run. I vaguely know this code only. Peter's the expert. --D --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org For additional commands, e-mail: dev-help@ant.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org For additional commands, e-mail: dev-help@ant.apache.org