maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vsive...@apache.org
Subject svn commit: r690203 - /maven/plugin-tools/trunk/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/generator/PluginHelpGenerator.java
Date Fri, 29 Aug 2008 12:22:20 GMT
Author: vsiveton
Date: Fri Aug 29 05:22:19 2008
New Revision: 690203

URL: http://svn.apache.org/viewvc?rev=690203&view=rev
Log:
o ordering mojodescriptors and parameters

Modified:
    maven/plugin-tools/trunk/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/generator/PluginHelpGenerator.java

Modified: maven/plugin-tools/trunk/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/generator/PluginHelpGenerator.java
URL: http://svn.apache.org/viewvc/maven/plugin-tools/trunk/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/generator/PluginHelpGenerator.java?rev=690203&r1=690202&r2=690203&view=diff
==============================================================================
--- maven/plugin-tools/trunk/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/generator/PluginHelpGenerator.java
(original)
+++ maven/plugin-tools/trunk/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/generator/PluginHelpGenerator.java
Fri Aug 29 05:22:19 2008
@@ -25,6 +25,8 @@
 import java.io.InputStream;
 import java.io.Writer;
 import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.Iterator;
@@ -451,6 +453,18 @@
 
         writer.write( LS );
 
+        Collections.sort( mojoDescriptors, new Comparator()
+        {
+            /** {@inheritDoc} */
+            public int compare( Object o1, Object o2 )
+            {
+                MojoDescriptor md1 = (MojoDescriptor) o1;
+                MojoDescriptor md2 = (MojoDescriptor) o2;
+
+                return md1.getId().compareTo( md2.getId() );
+            }
+        } );
+
         for ( Iterator it = mojoDescriptors.iterator(); it.hasNext(); )
         {
             MojoDescriptor descriptor = (MojoDescriptor) it.next();
@@ -498,13 +512,27 @@
 
         if ( descriptor.getParameters() != null && descriptor.getParameters().size()
> 0 )
         {
+            List params = descriptor.getParameters();
+
+            Collections.sort( params, new Comparator()
+            {
+                /** {@inheritDoc} */
+                public int compare( Object o1, Object o2 )
+                {
+                    Parameter parameter1 = (Parameter) o1;
+                    Parameter parameter2 = (Parameter) o2;
+
+                    return parameter1.getName().compareTo( parameter2.getName() );
+                }
+            } );
+
             writer.write( "            if ( detail )" + LS );
             writer.write( "            {" + LS );
 
             writer.write( "                append( sb, \"Available parameters:\", 1 );" +
LS );
             writer.write( "                append( sb, \"\", 0 );" + LS );
 
-            for ( Iterator it = descriptor.getParameters().iterator(); it.hasNext(); )
+            for ( Iterator it = params.iterator(); it.hasNext(); )
             {
                 Parameter parameter = (Parameter) it.next();
 



Mime
View raw message