Return-Path: Delivered-To: apmail-velocity-commits-archive@minotaur.apache.org Received: (qmail 50492 invoked from network); 15 Mar 2009 00:00:24 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 15 Mar 2009 00:00:24 -0000 Received: (qmail 25750 invoked by uid 500); 15 Mar 2009 00:00:24 -0000 Delivered-To: apmail-velocity-commits-archive@velocity.apache.org Received: (qmail 25721 invoked by uid 500); 15 Mar 2009 00:00:24 -0000 Mailing-List: contact commits-help@velocity.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@velocity.apache.org Delivered-To: mailing list commits@velocity.apache.org Received: (qmail 25712 invoked by uid 99); 15 Mar 2009 00:00:24 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 14 Mar 2009 17:00:24 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 15 Mar 2009 00:00:23 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id ACC482388975; Sat, 14 Mar 2009 23:59:45 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r754562 - in /velocity/engine/branches/2.0_Exp/src/java/org/apache/velocity/runtime: RuntimeInstance.java VelocimacroFactory.java VelocimacroManager.java directive/VelocimacroProxy.java Date: Sat, 14 Mar 2009 23:59:45 -0000 To: commits@velocity.apache.org From: byron@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090314235945.ACC482388975@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: byron Date: Sat Mar 14 23:59:44 2009 New Revision: 754562 URL: http://svn.apache.org/viewvc?rev=754562&view=rev Log: Added method to retrieve macro definitions for use by IDEs Modified: velocity/engine/branches/2.0_Exp/src/java/org/apache/velocity/runtime/RuntimeInstance.java velocity/engine/branches/2.0_Exp/src/java/org/apache/velocity/runtime/VelocimacroFactory.java velocity/engine/branches/2.0_Exp/src/java/org/apache/velocity/runtime/VelocimacroManager.java velocity/engine/branches/2.0_Exp/src/java/org/apache/velocity/runtime/directive/VelocimacroProxy.java Modified: velocity/engine/branches/2.0_Exp/src/java/org/apache/velocity/runtime/RuntimeInstance.java URL: http://svn.apache.org/viewvc/velocity/engine/branches/2.0_Exp/src/java/org/apache/velocity/runtime/RuntimeInstance.java?rev=754562&r1=754561&r2=754562&view=diff ============================================================================== --- velocity/engine/branches/2.0_Exp/src/java/org/apache/velocity/runtime/RuntimeInstance.java (original) +++ velocity/engine/branches/2.0_Exp/src/java/org/apache/velocity/runtime/RuntimeInstance.java Sat Mar 14 23:59:44 2009 @@ -50,6 +50,7 @@ import org.apache.velocity.exception.VelocityException; import org.apache.velocity.runtime.directive.Directive; import org.apache.velocity.runtime.directive.Macro; +import org.apache.velocity.runtime.directive.VelocimacroProxy; import org.apache.velocity.runtime.directive.Scope; import org.apache.velocity.runtime.directive.StopCommand; import org.apache.velocity.runtime.log.Log; @@ -1632,6 +1633,16 @@ } /** + * Return a list of VelocimacroProxies that are defined by the given + * template name. + */ + public List getVelocimacros(String templateName) + { + return vmFactory.getVelocimacros(templateName); + } + + + /** * Adds a new Velocimacro. Usually called by Macro only while parsing. * * Called by org.apache.velocity.runtime.directive.processAndRegister Modified: velocity/engine/branches/2.0_Exp/src/java/org/apache/velocity/runtime/VelocimacroFactory.java URL: http://svn.apache.org/viewvc/velocity/engine/branches/2.0_Exp/src/java/org/apache/velocity/runtime/VelocimacroFactory.java?rev=754562&r1=754561&r2=754562&view=diff ============================================================================== --- velocity/engine/branches/2.0_Exp/src/java/org/apache/velocity/runtime/VelocimacroFactory.java (original) +++ velocity/engine/branches/2.0_Exp/src/java/org/apache/velocity/runtime/VelocimacroFactory.java Sat Mar 14 23:59:44 2009 @@ -556,6 +556,15 @@ } /** + * Return a list of VelocimacroProxies that are defined by the given + * template name. + */ + public List getVelocimacros(String sourceTemplate) + { + return vmManager.getVelocimacros(sourceTemplate); + } + + /** * @since 1.6 */ public Directive getVelocimacro(String vmName, String sourceTemplate, String renderingTemplate) Modified: velocity/engine/branches/2.0_Exp/src/java/org/apache/velocity/runtime/VelocimacroManager.java URL: http://svn.apache.org/viewvc/velocity/engine/branches/2.0_Exp/src/java/org/apache/velocity/runtime/VelocimacroManager.java?rev=754562&r1=754561&r2=754562&view=diff ============================================================================== --- velocity/engine/branches/2.0_Exp/src/java/org/apache/velocity/runtime/VelocimacroManager.java (original) +++ velocity/engine/branches/2.0_Exp/src/java/org/apache/velocity/runtime/VelocimacroManager.java Sat Mar 14 23:59:44 2009 @@ -19,6 +19,7 @@ * under the License. */ +import java.util.ArrayList; import java.util.Collections; import java.util.HashSet; import java.util.List; @@ -87,6 +88,26 @@ } /** + * Return a list of VelocimacroProxies that are defined by the given + * template name. + */ + public List getVelocimacros(String templateName) + { + Map local = getNamespace(templateName, false); + ArrayList macros = new ArrayList(16); + if (local != null) + { + for (Object mo : local.values()) + { + MacroEntry me = (MacroEntry)mo; + macros.add(me.vp); + } + } + + return macros; + } + + /** * Adds a VM definition to the cache. * * Called by VelocimacroFactory.addVelociMacro (after parsing and discovery in Macro directive) Modified: velocity/engine/branches/2.0_Exp/src/java/org/apache/velocity/runtime/directive/VelocimacroProxy.java URL: http://svn.apache.org/viewvc/velocity/engine/branches/2.0_Exp/src/java/org/apache/velocity/runtime/directive/VelocimacroProxy.java?rev=754562&r1=754561&r2=754562&view=diff ============================================================================== --- velocity/engine/branches/2.0_Exp/src/java/org/apache/velocity/runtime/directive/VelocimacroProxy.java (original) +++ velocity/engine/branches/2.0_Exp/src/java/org/apache/velocity/runtime/directive/VelocimacroProxy.java Sat Mar 14 23:59:44 2009 @@ -107,6 +107,14 @@ } /** + * Return the list of macro arguments associated with this macro + */ + public List getMacroArgs() + { + return macroArgs; + } + + /** * @param tree */ public void setNodeTree(SimpleNode tree)