All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.nuiton.i18n.plugin.parser.impl.HelpMojo Maven / Gradle / Ivy

package org.nuiton.i18n.plugin.parser.impl;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;

/**
 * Display help information on maven-i18n-plugin.
Call
  mvn i18n:help -Ddetail=true -Dgoal=<goal-name>
to display parameter details. * * @version generated on Mon Jan 24 21:14:24 CET 2011 * @author org.apache.maven.tools.plugin.generator.PluginHelpGenerator (version 2.5.1) * @goal help * @requiresProject false */ public class HelpMojo extends AbstractMojo { /** * If true, display all settable properties for each goal. * * @parameter expression="${detail}" default-value="false" */ private boolean detail; /** * The name of the goal for which to show help. If unspecified, all goals will be displayed. * * @parameter expression="${goal}" */ private java.lang.String goal; /** * The maximum length of a display line, should be positive. * * @parameter expression="${lineLength}" default-value="80" */ private int lineLength; /** * The number of spaces per indentation level, should be positive. * * @parameter expression="${indentSize}" default-value="2" */ private int indentSize; /** {@inheritDoc} */ public void execute() throws MojoExecutionException { if ( lineLength <= 0 ) { getLog().warn( "The parameter 'lineLength' should be positive, using '80' as default." ); lineLength = 80; } if ( indentSize <= 0 ) { getLog().warn( "The parameter 'indentSize' should be positive, using '2' as default." ); indentSize = 2; } StringBuffer sb = new StringBuffer(); append( sb, "org.nuiton.i18n:maven-i18n-plugin:2.1", 0 ); append( sb, "", 0 ); append( sb, "I18n :: Maven Plugin", 0 ); append( sb, "Maven plugin to deal with i18n stuff in a project, mainly base on the nuiton-i18n api (but not only).", 1 ); append( sb, "", 0 ); if ( goal == null || goal.length() <= 0 ) { append( sb, "This plugin has 12 goals:", 0 ); append( sb, "", 0 ); } if ( goal == null || goal.length() <= 0 || "bundle".equals( goal ) ) { append( sb, "i18n:bundle", 0 ); append( sb, "Generate an aggregate i18n bundle for all dependencies of the project.\nThe main idea is to have a final unique i18n bundle for a application to launch, this really improve i18n loading time to have a unique named bundle, no need to seek in all dependencies...\n\nMoreover, this permits also to deal with order of i18n keys, more precisly, we want to use the higher level i18n key for an application. If the i18n key is present on a library, we want to be able to override it in application (or user wants it:)).\n\nThis goal permits this using the dependencies graph order of artifacts.\n", 1 ); append( sb, "", 0 ); if ( detail ) { append( sb, "Available parameters:", 1 ); append( sb, "", 0 ); append( sb, "addBundleOuputDirParent (Default: true)", 2 ); append( sb, "A flag to use the parent of directory bundleOutputDir as directory to add in build ressources.\nIf the flag is not activated, the, we use directly the given bundleOutputDir directory.\n\nNote : By default we use the parent directory, since this is more natural, only special cases should desactivate this parameter.\n", 3 ); append( sb, "", 0 ); append( sb, "bundleOutputDir (Default: ${basedir}/target/generated-sources/resources/META-INF)", 2 ); append( sb, "Directory where to generate aggregated bundles.", 3 ); append( sb, "", 0 ); append( sb, "bundleOutputName (Default: ${project.artifactId}-i18n)", 2 ); append( sb, "Name of the bundle to generate.", 3 ); append( sb, "", 0 ); append( sb, "bundles (Default: fr_FR,en_GB)", 2 ); append( sb, "Locales to treate, separated by comma.\nExample :\n\nfr_FR,en_GB\n", 3 ); append( sb, "", 0 ); append( sb, "checkBundle (Default: true)", 2 ); append( sb, "A flag to check that bundles are complete (no missing i18n translations).\nNote : This behaviour will be activated is failsIfWarning is on.\n", 3 ); append( sb, "", 0 ); append( sb, "collectOutputDir (Default: ${basedir}/target/i18n)", 2 ); append( sb, "Repertoire ou generer les bundles.", 3 ); append( sb, "", 0 ); append( sb, "collectOutputName (Default: collect-${project.artifactId}-i18n)", 2 ); append( sb, "Nom de base des fichiers qui contient les localisations des bundles.", 3 ); append( sb, "", 0 ); append( sb, "encoding (Default: ${project.build.sourceEncoding})", 2 ); append( sb, "Encoding used to load and store files.\nNote: If nothing is filled here, we will use the system property file.encoding.\n", 3 ); append( sb, "", 0 ); append( sb, "failsIfWarning (Default: false)", 2 ); append( sb, "A flag to make the build fails if there is some warnings while generating bundle, says when it misses some translations.\nNote : This parameter should be used in a release profile to ensure bundles are complete.\n", 3 ); append( sb, "", 0 ); append( sb, "generateDefaultLocale (Default: false)", 2 ); append( sb, "A flag to generate a bundle with the first locale defined as a default bundle (with no locale specialization).", 3 ); append( sb, "", 0 ); append( sb, "generateDefinitionFile (Default: true)", 2 ); append( sb, "A flag to generate the i18n definition file.\nThis file contains all generated bundles and the paths of all i18n artifacts used to make it.\n", 3 ); append( sb, "", 0 ); append( sb, "genSrc (Default: true)", 2 ); append( sb, "To update generated files to user i18n files.\nNote : By default, this is active, in order to have a project uptodate with last i18n bundles detected.\n", 3 ); append( sb, "", 0 ); append( sb, "out (Default: ${basedir}/target/generated-sources/i18n)", 2 ); append( sb, "Directory where to generate i18n files.", 3 ); append( sb, "", 0 ); append( sb, "project (Default: ${project})", 2 ); append( sb, "Dependance du projet.", 3 ); append( sb, "", 0 ); append( sb, "showEmpty (Default: false)", 2 ); append( sb, "A flag to show missing i18n translation.\nNote : Need the checkBundle to be activated).\n", 3 ); append( sb, "", 0 ); append( sb, "silent (Default: false)", 2 ); append( sb, "Silent flag to see only errors in console.", 3 ); append( sb, "", 0 ); append( sb, "src (Default: ${basedir}/src/main/resources/i18n)", 2 ); append( sb, "Directory where to find project i18n files.", 3 ); append( sb, "", 0 ); append( sb, "strictMode (Default: false)", 2 ); append( sb, "Strict mode to only keep in user i18n detected i18n keys and remove obsolete keys.\nNote : By default not active. Use this with care since it can delete keys. Moreover if this flag is activated, then all files will be parsed.\n", 3 ); append( sb, "", 0 ); append( sb, "verbose (Default: ${maven.verbose})", 2 ); append( sb, "Verbose flag.\nNote : if not setted, we used the maven.verbose property.\n", 3 ); append( sb, "", 0 ); } } if ( goal == null || goal.length() <= 0 || "collect-i18n-artifacts".equals( goal ) ) { append( sb, "i18n:collect-i18n-artifacts", 0 ); append( sb, "Detects any i18n artifacts in the dependencies of the project and store their references in a file.\nThe generated file will be used by bundle mojo to generate the final aggregated bundle.\n", 1 ); append( sb, "", 0 ); if ( detail ) { append( sb, "Available parameters:", 1 ); append( sb, "", 0 ); append( sb, "bundles (Default: fr_FR,en_GB)", 2 ); append( sb, "Locales to treate, separated by comma.\nExample :\n\nfr_FR,en_GB\n", 3 ); append( sb, "", 0 ); append( sb, "collectOutputDir (Default: ${basedir}/target/i18n)", 2 ); append( sb, "Repertoire ou generer les bundles.", 3 ); append( sb, "", 0 ); append( sb, "collectOutputName (Default: collect-${project.artifactId}-i18n)", 2 ); append( sb, "Nom de base des fichiers qui contient les localisations des bundles.", 3 ); append( sb, "", 0 ); append( sb, "encoding (Default: ${project.build.sourceEncoding})", 2 ); append( sb, "Encoding used to load and store files.\nNote: If nothing is filled here, we will use the system property file.encoding.\n", 3 ); append( sb, "", 0 ); append( sb, "genSrc (Default: true)", 2 ); append( sb, "To update generated files to user i18n files.\nNote : By default, this is active, in order to have a project uptodate with last i18n bundles detected.\n", 3 ); append( sb, "", 0 ); append( sb, "out (Default: ${basedir}/target/generated-sources/i18n)", 2 ); append( sb, "Directory where to generate i18n files.", 3 ); append( sb, "", 0 ); append( sb, "project (Default: ${project})", 2 ); append( sb, "Dependance du projet.", 3 ); append( sb, "", 0 ); append( sb, "silent (Default: false)", 2 ); append( sb, "Silent flag to see only errors in console.", 3 ); append( sb, "", 0 ); append( sb, "src (Default: ${basedir}/src/main/resources/i18n)", 2 ); append( sb, "Directory where to find project i18n files.", 3 ); append( sb, "", 0 ); append( sb, "strictMode (Default: false)", 2 ); append( sb, "Strict mode to only keep in user i18n detected i18n keys and remove obsolete keys.\nNote : By default not active. Use this with care since it can delete keys. Moreover if this flag is activated, then all files will be parsed.\n", 3 ); append( sb, "", 0 ); append( sb, "verbose (Default: ${maven.verbose})", 2 ); append( sb, "Verbose flag.\nNote : if not setted, we used the maven.verbose property.\n", 3 ); append( sb, "", 0 ); } } if ( goal == null || goal.length() <= 0 || "gen".equals( goal ) ) { append( sb, "i18n:gen", 0 ); append( sb, "Merge new generated i18n bundles with older existing ones.", 1 ); append( sb, "", 0 ); if ( detail ) { append( sb, "Available parameters:", 1 ); append( sb, "", 0 ); append( sb, "bundles (Default: fr_FR,en_GB)", 2 ); append( sb, "Locales to treate, separated by comma.\nExample :\n\nfr_FR,en_GB\n", 3 ); append( sb, "", 0 ); append( sb, "checkBundle (Default: true)", 2 ); append( sb, "A flag to check that bundles are complete (no missing i18n translations).", 3 ); append( sb, "", 0 ); append( sb, "encoding (Default: ${project.build.sourceEncoding})", 2 ); append( sb, "Encoding used to load and store files.\nNote: If nothing is filled here, we will use the system property file.encoding.\n", 3 ); append( sb, "", 0 ); append( sb, "genSrc (Default: true)", 2 ); append( sb, "To update generated files to user i18n files.\nNote : By default, this is active, in order to have a project uptodate with last i18n bundles detected.\n", 3 ); append( sb, "", 0 ); append( sb, "keepBackup (Default: false)", 2 ); append( sb, "To keep a backup of old i18n bundles (suffiex by a ~).\nNote: By default, this property is not active.\n", 3 ); append( sb, "", 0 ); append( sb, "keepGetters (Default: false)", 2 ); append( sb, "To keep generated getter files.\nNote: By default, this property is not active.\n", 3 ); append( sb, "", 0 ); append( sb, "out (Default: ${basedir}/target/generated-sources/i18n)", 2 ); append( sb, "Directory where to generate i18n files.", 3 ); append( sb, "", 0 ); append( sb, "project (Default: ${project})", 2 ); append( sb, "Dependance du projet.", 3 ); append( sb, "", 0 ); append( sb, "showEmpty (Default: false)", 2 ); append( sb, "A flag to show missing i18n translation.\nNote : Need the checkBundle to be activated).\n", 3 ); append( sb, "", 0 ); append( sb, "silent (Default: false)", 2 ); append( sb, "Silent flag to see only errors in console.", 3 ); append( sb, "", 0 ); append( sb, "src (Default: ${basedir}/src/main/resources/i18n)", 2 ); append( sb, "Directory where to find project i18n files.", 3 ); append( sb, "", 0 ); append( sb, "strictMode (Default: false)", 2 ); append( sb, "Strict mode to only keep in user i18n detected i18n keys and remove obsolete keys.\nNote : By default not active. Use this with care since it can delete keys. Moreover if this flag is activated, then all files will be parsed.\n", 3 ); append( sb, "", 0 ); append( sb, "verbose (Default: ${maven.verbose})", 2 ); append( sb, "Verbose flag.\nNote : if not setted, we used the maven.verbose property.\n", 3 ); append( sb, "", 0 ); } } if ( goal == null || goal.length() <= 0 || "get".equals( goal ) ) { append( sb, "i18n:get", 0 ); append( sb, "Recupere les diff\u00e9rents fichiers des parsers en un fichier de proprietes.", 1 ); append( sb, "", 0 ); if ( detail ) { append( sb, "Available parameters:", 1 ); append( sb, "", 0 ); append( sb, "bundles (Default: fr_FR,en_GB)", 2 ); append( sb, "Locales to treate, separated by comma.\nExample :\n\nfr_FR,en_GB\n", 3 ); append( sb, "", 0 ); append( sb, "encoding (Default: ${project.build.sourceEncoding})", 2 ); append( sb, "Encoding used to load and store files.\nNote: If nothing is filled here, we will use the system property file.encoding.\n", 3 ); append( sb, "", 0 ); append( sb, "genSrc (Default: true)", 2 ); append( sb, "To update generated files to user i18n files.\nNote : By default, this is active, in order to have a project uptodate with last i18n bundles detected.\n", 3 ); append( sb, "", 0 ); append( sb, "keepGetters (Default: false)", 2 ); append( sb, "To keep generated getter files.\nNote: By default, this property is not active.\n", 3 ); append( sb, "", 0 ); append( sb, "out (Default: ${basedir}/target/generated-sources/i18n)", 2 ); append( sb, "Directory where to generate i18n files.", 3 ); append( sb, "", 0 ); append( sb, "project (Default: ${project})", 2 ); append( sb, "Dependance du projet.", 3 ); append( sb, "", 0 ); append( sb, "silent (Default: false)", 2 ); append( sb, "Silent flag to see only errors in console.", 3 ); append( sb, "", 0 ); append( sb, "src (Default: ${basedir}/src/main/resources/i18n)", 2 ); append( sb, "Directory where to find project i18n files.", 3 ); append( sb, "", 0 ); append( sb, "strictMode (Default: false)", 2 ); append( sb, "Strict mode to only keep in user i18n detected i18n keys and remove obsolete keys.\nNote : By default not active. Use this with care since it can delete keys. Moreover if this flag is activated, then all files will be parsed.\n", 3 ); append( sb, "", 0 ); append( sb, "verbose (Default: ${maven.verbose})", 2 ); append( sb, "Verbose flag.\nNote : if not setted, we used the maven.verbose property.\n", 3 ); append( sb, "", 0 ); } } if ( goal == null || goal.length() <= 0 || "help".equals( goal ) ) { append( sb, "i18n:help", 0 ); append( sb, "Display help information on maven-i18n-plugin.\nCall\n\u00a0\u00a0mvn\u00a0i18n:help\u00a0-Ddetail=true\u00a0-Dgoal=\nto display parameter details.", 1 ); append( sb, "", 0 ); if ( detail ) { append( sb, "Available parameters:", 1 ); append( sb, "", 0 ); append( sb, "detail (Default: false)", 2 ); append( sb, "If true, display all settable properties for each goal.", 3 ); append( sb, "", 0 ); append( sb, "goal", 2 ); append( sb, "The name of the goal for which to show help. If unspecified, all goals will be displayed.", 3 ); append( sb, "", 0 ); append( sb, "indentSize (Default: 2)", 2 ); append( sb, "The number of spaces per indentation level, should be positive.", 3 ); append( sb, "", 0 ); append( sb, "lineLength (Default: 80)", 2 ); append( sb, "The maximum length of a display line, should be positive.", 3 ); append( sb, "", 0 ); } } if ( goal == null || goal.length() <= 0 || "parserGWTJava".equals( goal ) ) { append( sb, "i18n:parserGWTJava", 0 ); append( sb, "To detect from GWT java files new I18n keys, says content of patterns :\n-\t@Key(\'XXX\')\n-\[email protected](\'XXX\')\n-\[email protected](\'XXX\')\nNote: this goal must always be invoked before the process-resources phase, otherwise all files will be considered as uptodate.", 1 ); append( sb, "", 0 ); if ( detail ) { append( sb, "Available parameters:", 1 ); append( sb, "", 0 ); append( sb, "backupGetter (Default: false)", 2 ); append( sb, "Flag to save previous getter in a backup before doing parsing.\nNote: by default, do not perform backup (but it was here originaly so let it possible...)\n", 3 ); append( sb, "", 0 ); append( sb, "bundles (Default: fr_FR,en_GB)", 2 ); append( sb, "Locales to treate, separated by comma.\nExample :\n\nfr_FR,en_GB\n", 3 ); append( sb, "", 0 ); append( sb, "cp (Default: ${basedir}/target/classes)", 2 ); append( sb, "Build directory (used to know if files in sources are up-to-date).", 3 ); append( sb, "", 0 ); append( sb, "defaultBasedir (Default: ${basedir}/src/main/java)", 2 ); append( sb, "Root directory of the default entry.", 3 ); append( sb, "", 0 ); append( sb, "defaultIncludes (Default: **/*.java)", 2 ); append( sb, "Default included files to process (ant-like expression).", 3 ); append( sb, "", 0 ); append( sb, "encoding (Default: ${project.build.sourceEncoding})", 2 ); append( sb, "Encoding used to load and store files.\nNote: If nothing is filled here, we will use the system property file.encoding.\n", 3 ); append( sb, "", 0 ); append( sb, "entries", 2 ); append( sb, "Source entries (src+includes+excludes) to process.", 3 ); append( sb, "", 0 ); append( sb, "force (Default: false)", 2 ); append( sb, "To force reparse of all sources.", 3 ); append( sb, "", 0 ); append( sb, "genSrc (Default: true)", 2 ); append( sb, "To update generated files to user i18n files.\nNote : By default, this is active, in order to have a project uptodate with last i18n bundles detected.\n", 3 ); append( sb, "", 0 ); append( sb, "keysModifier (Default: false)", 2 ); append( sb, "Deprecated. since 1.2, will no more used", 3 ); append( sb, "", 0 ); append( sb, "To activate the modification of keys\nNote : By default not active, since it requires to have UI available and this is not acceptable for server build.\n\nNote : At the moment the fully fonctionnality is no more available and will be recode in a separated goal (one day...)\n", 3 ); append( sb, "", 0 ); append( sb, "out (Default: ${basedir}/target/generated-sources/i18n)", 2 ); append( sb, "Directory where to generate i18n files.", 3 ); append( sb, "", 0 ); append( sb, "outputGetter (Default: gwt-java.getter)", 2 ); append( sb, "Defines the file name of the getter where to put detected i18n keys while getter phase.", 3 ); append( sb, "", 0 ); append( sb, "project (Default: ${project})", 2 ); append( sb, "Dependance du projet.", 3 ); append( sb, "", 0 ); append( sb, "showTouchedFiles (Default: ${maven.verbose})", 2 ); append( sb, "Flag to display touched files while parsing.\nNote: the value will be always true if verbose is set at true.\n", 3 ); append( sb, "", 0 ); append( sb, "silent (Default: false)", 2 ); append( sb, "Silent flag to see only errors in console.", 3 ); append( sb, "", 0 ); append( sb, "src (Default: ${basedir}/src/main/resources/i18n)", 2 ); append( sb, "Directory where to find project i18n files.", 3 ); append( sb, "", 0 ); append( sb, "strictMode (Default: false)", 2 ); append( sb, "Strict mode to only keep in user i18n detected i18n keys and remove obsolete keys.\nNote : By default not active. Use this with care since it can delete keys. Moreover if this flag is activated, then all files will be parsed.\n", 3 ); append( sb, "", 0 ); append( sb, "treateDefaultEntry (Default: true)", 2 ); append( sb, "To treate default entry offered by the mojo.", 3 ); append( sb, "", 0 ); append( sb, "verbose (Default: ${maven.verbose})", 2 ); append( sb, "Verbose flag.\nNote : if not setted, we used the maven.verbose property.\n", 3 ); append( sb, "", 0 ); append( sb, "workdir (Default: ${basedir}/target/i18n-workdir)", 2 ); append( sb, "Where to generated temporary processed files.", 3 ); append( sb, "", 0 ); } } if ( goal == null || goal.length() <= 0 || "parserJava".equals( goal ) ) { append( sb, "i18n:parserJava", 0 ); append( sb, "To parse java files to detect new i18n keys.\nNote: this goal must always be invoked before the process-resources phase, otherwise all files will be considered as uptodate.\n", 1 ); append( sb, "", 0 ); if ( detail ) { append( sb, "Available parameters:", 1 ); append( sb, "", 0 ); append( sb, "backupGetter (Default: false)", 2 ); append( sb, "Flag to save previous getter in a backup before doing parsing.\nNote: by default, do not perform backup (but it was here originaly so let it possible...)\n", 3 ); append( sb, "", 0 ); append( sb, "bundles (Default: fr_FR,en_GB)", 2 ); append( sb, "Locales to treate, separated by comma.\nExample :\n\nfr_FR,en_GB\n", 3 ); append( sb, "", 0 ); append( sb, "cp (Default: ${basedir}/target/classes)", 2 ); append( sb, "Build directory (used to know if files in sources are up-to-date).", 3 ); append( sb, "", 0 ); append( sb, "defaultBasedir (Default: ${basedir}/src/main/java)", 2 ); append( sb, "Root directory of the default entry.", 3 ); append( sb, "", 0 ); append( sb, "defaultIncludes (Default: **/*.java)", 2 ); append( sb, "Default included files to process (ant-like expression).", 3 ); append( sb, "", 0 ); append( sb, "encoding (Default: ${project.build.sourceEncoding})", 2 ); append( sb, "Encoding used to load and store files.\nNote: If nothing is filled here, we will use the system property file.encoding.\n", 3 ); append( sb, "", 0 ); append( sb, "entries", 2 ); append( sb, "Source entries (src+includes+excludes) to process.", 3 ); append( sb, "", 0 ); append( sb, "force (Default: false)", 2 ); append( sb, "To force reparse of all sources.", 3 ); append( sb, "", 0 ); append( sb, "genSrc (Default: true)", 2 ); append( sb, "To update generated files to user i18n files.\nNote : By default, this is active, in order to have a project uptodate with last i18n bundles detected.\n", 3 ); append( sb, "", 0 ); append( sb, "keysModifier (Default: false)", 2 ); append( sb, "Deprecated. since 1.2, will no more used", 3 ); append( sb, "", 0 ); append( sb, "To activate the modification of keys\nNote : By default not active, since it requires to have UI available and this is not acceptable for server build.\n\nNote : At the moment the fully fonctionnality is no more available and will be recode in a separated goal (one day...)\n", 3 ); append( sb, "", 0 ); append( sb, "out (Default: ${basedir}/target/generated-sources/i18n)", 2 ); append( sb, "Directory where to generate i18n files.", 3 ); append( sb, "", 0 ); append( sb, "outputGetter (Default: java.getter)", 2 ); append( sb, "Defines the file name of the getter where to put detected i18n keys while getter phase.", 3 ); append( sb, "", 0 ); append( sb, "project (Default: ${project})", 2 ); append( sb, "Dependance du projet.", 3 ); append( sb, "", 0 ); append( sb, "showTouchedFiles (Default: ${maven.verbose})", 2 ); append( sb, "Flag to display touched files while parsing.\nNote: the value will be always true if verbose is set at true.\n", 3 ); append( sb, "", 0 ); append( sb, "silent (Default: false)", 2 ); append( sb, "Silent flag to see only errors in console.", 3 ); append( sb, "", 0 ); append( sb, "src (Default: ${basedir}/src/main/resources/i18n)", 2 ); append( sb, "Directory where to find project i18n files.", 3 ); append( sb, "", 0 ); append( sb, "strictMode (Default: false)", 2 ); append( sb, "Strict mode to only keep in user i18n detected i18n keys and remove obsolete keys.\nNote : By default not active. Use this with care since it can delete keys. Moreover if this flag is activated, then all files will be parsed.\n", 3 ); append( sb, "", 0 ); append( sb, "treateDefaultEntry (Default: true)", 2 ); append( sb, "To treate default entry offered by the mojo.", 3 ); append( sb, "", 0 ); append( sb, "verbose (Default: ${maven.verbose})", 2 ); append( sb, "Verbose flag.\nNote : if not setted, we used the maven.verbose property.\n", 3 ); append( sb, "", 0 ); } } if ( goal == null || goal.length() <= 0 || "parserJsp".equals( goal ) ) { append( sb, "i18n:parserJsp", 0 ); append( sb, "Find i18n keys from jsp files.\nNote: this goal must always be invoked before the process-resources phase, otherwise all files will be considered as uptodate.\n", 1 ); append( sb, "", 0 ); if ( detail ) { append( sb, "Available parameters:", 1 ); append( sb, "", 0 ); append( sb, "backupGetter (Default: false)", 2 ); append( sb, "Flag to save previous getter in a backup before doing parsing.\nNote: by default, do not perform backup (but it was here originaly so let it possible...)\n", 3 ); append( sb, "", 0 ); append( sb, "bundles (Default: fr_FR,en_GB)", 2 ); append( sb, "Locales to treate, separated by comma.\nExample :\n\nfr_FR,en_GB\n", 3 ); append( sb, "", 0 ); append( sb, "coreRuleFile", 2 ); append( sb, "Defines the core rules file used to detect i18n keys in jsp files.\nNote : If you do not want to use it, set it to empty and fill the userRulesFiles parameter.\n", 3 ); append( sb, "", 0 ); append( sb, "cp (Default: ${basedir}/target/classes)", 2 ); append( sb, "Build directory (used to know if files in sources are up-to-date).", 3 ); append( sb, "", 0 ); append( sb, "defaultBasedir (Default: ${basedir}/src/main/webapp)", 2 ); append( sb, "Root directory of the default entry.", 3 ); append( sb, "", 0 ); append( sb, "defaultIncludes (Default: **/**.jsp)", 2 ); append( sb, "Default included files to process (ant-like expression).", 3 ); append( sb, "", 0 ); append( sb, "encoding (Default: ${project.build.sourceEncoding})", 2 ); append( sb, "Encoding used to load and store files.\nNote: If nothing is filled here, we will use the system property file.encoding.\n", 3 ); append( sb, "", 0 ); append( sb, "entries", 2 ); append( sb, "Source entries (src+includes+excludes) to process.", 3 ); append( sb, "", 0 ); append( sb, "force (Default: false)", 2 ); append( sb, "To force reparse of all sources.", 3 ); append( sb, "", 0 ); append( sb, "genSrc (Default: true)", 2 ); append( sb, "To update generated files to user i18n files.\nNote : By default, this is active, in order to have a project uptodate with last i18n bundles detected.\n", 3 ); append( sb, "", 0 ); append( sb, "keysModifier (Default: false)", 2 ); append( sb, "Deprecated. since 1.2, will no more used", 3 ); append( sb, "", 0 ); append( sb, "To activate the modification of keys\nNote : By default not active, since it requires to have UI available and this is not acceptable for server build.\n\nNote : At the moment the fully fonctionnality is no more available and will be recode in a separated goal (one day...)\n", 3 ); append( sb, "", 0 ); append( sb, "namespaces", 2 ); append( sb, "Defines namespaces mapping if needed.\nExample :\n\n\nhttp://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd\n\n", 3 ); append( sb, "", 0 ); append( sb, "out (Default: ${basedir}/target/generated-sources/i18n)", 2 ); append( sb, "Directory where to generate i18n files.", 3 ); append( sb, "", 0 ); append( sb, "outputGetter (Default: jsp.getter)", 2 ); append( sb, "Defines the file name of the getter where to put detected i18n keys while getter phase.", 3 ); append( sb, "", 0 ); append( sb, "project (Default: ${project})", 2 ); append( sb, "Dependance du projet.", 3 ); append( sb, "", 0 ); append( sb, "showTouchedFiles (Default: ${maven.verbose})", 2 ); append( sb, "Flag to display touched files while parsing.\nNote: the value will be always true if verbose is set at true.\n", 3 ); append( sb, "", 0 ); append( sb, "silent (Default: false)", 2 ); append( sb, "Silent flag to see only errors in console.", 3 ); append( sb, "", 0 ); append( sb, "src (Default: ${basedir}/src/main/resources/i18n)", 2 ); append( sb, "Directory where to find project i18n files.", 3 ); append( sb, "", 0 ); append( sb, "strictMode (Default: false)", 2 ); append( sb, "Strict mode to only keep in user i18n detected i18n keys and remove obsolete keys.\nNote : By default not active. Use this with care since it can delete keys. Moreover if this flag is activated, then all files will be parsed.\n", 3 ); append( sb, "", 0 ); append( sb, "treateDefaultEntry (Default: true)", 2 ); append( sb, "To treate default entry offered by the mojo.", 3 ); append( sb, "", 0 ); append( sb, "userRulesFiles", 2 ); append( sb, "Extra rules files to use for detecting i18n keys in xml validation files.\nNote : If the coreRulesFile is not defined, then you must fill this parameter.\n", 3 ); append( sb, "", 0 ); append( sb, "verbose (Default: ${maven.verbose})", 2 ); append( sb, "Verbose flag.\nNote : if not setted, we used the maven.verbose property.\n", 3 ); append( sb, "", 0 ); append( sb, "workdir (Default: ${basedir}/target/i18n-workdir)", 2 ); append( sb, "Where to generated temporary processed files.", 3 ); append( sb, "", 0 ); } } if ( goal == null || goal.length() <= 0 || "parserTapestry".equals( goal ) ) { append( sb, "i18n:parserTapestry", 0 ); append( sb, "To parse Tapestry templates to detect new I18n keys, says content of patterns : ${message:XXX} and ${format:XXX=...}.\n\nNote: this goal must always be invoked before the process-resources phase, otherwise all files will be considered as uptodate.\n", 1 ); append( sb, "", 0 ); if ( detail ) { append( sb, "Available parameters:", 1 ); append( sb, "", 0 ); append( sb, "backupGetter (Default: false)", 2 ); append( sb, "Flag to save previous getter in a backup before doing parsing.\nNote: by default, do not perform backup (but it was here originaly so let it possible...)\n", 3 ); append( sb, "", 0 ); append( sb, "bundles (Default: fr_FR,en_GB)", 2 ); append( sb, "Locales to treate, separated by comma.\nExample :\n\nfr_FR,en_GB\n", 3 ); append( sb, "", 0 ); append( sb, "cp (Default: ${basedir}/target/classes)", 2 ); append( sb, "Build directory (used to know if files in sources are up-to-date).", 3 ); append( sb, "", 0 ); append( sb, "defaultBasedir (Default: ${basedir}/src/main/webapp)", 2 ); append( sb, "Root directory of the default entry.", 3 ); append( sb, "", 0 ); append( sb, "defaultIncludes (Default: **/*.tml)", 2 ); append( sb, "Default included files to process (ant-like expression).", 3 ); append( sb, "", 0 ); append( sb, "encoding (Default: ${project.build.sourceEncoding})", 2 ); append( sb, "Encoding used to load and store files.\nNote: If nothing is filled here, we will use the system property file.encoding.\n", 3 ); append( sb, "", 0 ); append( sb, "entries", 2 ); append( sb, "Source entries (src+includes+excludes) to process.", 3 ); append( sb, "", 0 ); append( sb, "force (Default: false)", 2 ); append( sb, "To force reparse of all sources.", 3 ); append( sb, "", 0 ); append( sb, "genSrc (Default: true)", 2 ); append( sb, "To update generated files to user i18n files.\nNote : By default, this is active, in order to have a project uptodate with last i18n bundles detected.\n", 3 ); append( sb, "", 0 ); append( sb, "keysModifier (Default: false)", 2 ); append( sb, "Deprecated. since 1.2, will no more used", 3 ); append( sb, "", 0 ); append( sb, "To activate the modification of keys\nNote : By default not active, since it requires to have UI available and this is not acceptable for server build.\n\nNote : At the moment the fully fonctionnality is no more available and will be recode in a separated goal (one day...)\n", 3 ); append( sb, "", 0 ); append( sb, "out (Default: ${basedir}/target/generated-sources/i18n)", 2 ); append( sb, "Directory where to generate i18n files.", 3 ); append( sb, "", 0 ); append( sb, "outputGetter (Default: tapestry.getter)", 2 ); append( sb, "Defines the file name of the getter where to put detected i18n keys while getter phase.", 3 ); append( sb, "", 0 ); append( sb, "project (Default: ${project})", 2 ); append( sb, "Dependance du projet.", 3 ); append( sb, "", 0 ); append( sb, "showTouchedFiles (Default: ${maven.verbose})", 2 ); append( sb, "Flag to display touched files while parsing.\nNote: the value will be always true if verbose is set at true.\n", 3 ); append( sb, "", 0 ); append( sb, "silent (Default: false)", 2 ); append( sb, "Silent flag to see only errors in console.", 3 ); append( sb, "", 0 ); append( sb, "src (Default: ${basedir}/src/main/resources/i18n)", 2 ); append( sb, "Directory where to find project i18n files.", 3 ); append( sb, "", 0 ); append( sb, "strictMode (Default: false)", 2 ); append( sb, "Strict mode to only keep in user i18n detected i18n keys and remove obsolete keys.\nNote : By default not active. Use this with care since it can delete keys. Moreover if this flag is activated, then all files will be parsed.\n", 3 ); append( sb, "", 0 ); append( sb, "treateDefaultEntry (Default: true)", 2 ); append( sb, "To treate default entry offered by the mojo.", 3 ); append( sb, "", 0 ); append( sb, "verbose (Default: ${maven.verbose})", 2 ); append( sb, "Verbose flag.\nNote : if not setted, we used the maven.verbose property.\n", 3 ); append( sb, "", 0 ); append( sb, "workdir (Default: ${basedir}/target/i18n-workdir)", 2 ); append( sb, "Where to generated temporary processed files.", 3 ); append( sb, "", 0 ); } } if ( goal == null || goal.length() <= 0 || "parserValidation".equals( goal ) ) { append( sb, "i18n:parserValidation", 0 ); append( sb, "Find i18n keys from xworks xml validation files.\nNote: this goal must always be invoked before the process-resources phase, otherwise all files will be considered as uptodate.\n", 1 ); append( sb, "", 0 ); if ( detail ) { append( sb, "Available parameters:", 1 ); append( sb, "", 0 ); append( sb, "backupGetter (Default: false)", 2 ); append( sb, "Flag to save previous getter in a backup before doing parsing.\nNote: by default, do not perform backup (but it was here originaly so let it possible...)\n", 3 ); append( sb, "", 0 ); append( sb, "bundles (Default: fr_FR,en_GB)", 2 ); append( sb, "Locales to treate, separated by comma.\nExample :\n\nfr_FR,en_GB\n", 3 ); append( sb, "", 0 ); append( sb, "coreRuleFile (Default: validation.rules)", 2 ); append( sb, "Defines the core rules file used to detect i18n keys in xml validation files.\nNote : If you do not want to use it, set it to empty and fill the userRulesFiles parameter.\n", 3 ); append( sb, "", 0 ); append( sb, "cp (Default: ${basedir}/target/classes)", 2 ); append( sb, "Build directory (used to know if files in sources are up-to-date).", 3 ); append( sb, "", 0 ); append( sb, "defaultBasedir (Default: ${basedir}/src/main/resources)", 2 ); append( sb, "Root directory of the default entry.", 3 ); append( sb, "", 0 ); append( sb, "defaultIncludes (Default: **/**-validation.xml)", 2 ); append( sb, "Default included files to process (ant-like expression).", 3 ); append( sb, "", 0 ); append( sb, "encoding (Default: ${project.build.sourceEncoding})", 2 ); append( sb, "Encoding used to load and store files.\nNote: If nothing is filled here, we will use the system property file.encoding.\n", 3 ); append( sb, "", 0 ); append( sb, "entries", 2 ); append( sb, "Source entries (src+includes+excludes) to process.", 3 ); append( sb, "", 0 ); append( sb, "force (Default: false)", 2 ); append( sb, "To force reparse of all sources.", 3 ); append( sb, "", 0 ); append( sb, "genSrc (Default: true)", 2 ); append( sb, "To update generated files to user i18n files.\nNote : By default, this is active, in order to have a project uptodate with last i18n bundles detected.\n", 3 ); append( sb, "", 0 ); append( sb, "keysModifier (Default: false)", 2 ); append( sb, "Deprecated. since 1.2, will no more used", 3 ); append( sb, "", 0 ); append( sb, "To activate the modification of keys\nNote : By default not active, since it requires to have UI available and this is not acceptable for server build.\n\nNote : At the moment the fully fonctionnality is no more available and will be recode in a separated goal (one day...)\n", 3 ); append( sb, "", 0 ); append( sb, "namespaces", 2 ); append( sb, "Defines namespaces mapping if needed.\nExample :\n\n\nhttp://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd\n\n", 3 ); append( sb, "", 0 ); append( sb, "out (Default: ${basedir}/target/generated-sources/i18n)", 2 ); append( sb, "Directory where to generate i18n files.", 3 ); append( sb, "", 0 ); append( sb, "outputGetter (Default: validation.getter)", 2 ); append( sb, "Defines the file name of the getter where to put detected i18n keys while getter phase.", 3 ); append( sb, "", 0 ); append( sb, "project (Default: ${project})", 2 ); append( sb, "Dependance du projet.", 3 ); append( sb, "", 0 ); append( sb, "showTouchedFiles (Default: ${maven.verbose})", 2 ); append( sb, "Flag to display touched files while parsing.\nNote: the value will be always true if verbose is set at true.\n", 3 ); append( sb, "", 0 ); append( sb, "silent (Default: false)", 2 ); append( sb, "Silent flag to see only errors in console.", 3 ); append( sb, "", 0 ); append( sb, "src (Default: ${basedir}/src/main/resources/i18n)", 2 ); append( sb, "Directory where to find project i18n files.", 3 ); append( sb, "", 0 ); append( sb, "strictMode (Default: false)", 2 ); append( sb, "Strict mode to only keep in user i18n detected i18n keys and remove obsolete keys.\nNote : By default not active. Use this with care since it can delete keys. Moreover if this flag is activated, then all files will be parsed.\n", 3 ); append( sb, "", 0 ); append( sb, "treateDefaultEntry (Default: true)", 2 ); append( sb, "To treate default entry offered by the mojo.", 3 ); append( sb, "", 0 ); append( sb, "useLocalResolver (Default: true)", 2 ); append( sb, "Always use the local xowrks dtd to increase performance.", 3 ); append( sb, "", 0 ); append( sb, "userRulesFiles", 2 ); append( sb, "Extra rules files to use for detecting i18n keys in xml validation files.\nNote : If the coreRulesFile is not defined, then you must fill this parameter.\n", 3 ); append( sb, "", 0 ); append( sb, "verbose (Default: ${maven.verbose})", 2 ); append( sb, "Verbose flag.\nNote : if not setted, we used the maven.verbose property.\n", 3 ); append( sb, "", 0 ); } } if ( goal == null || goal.length() <= 0 || "parserXml".equals( goal ) ) { append( sb, "i18n:parserXml", 0 ); append( sb, "To obtain i18n keys from xml files using the userRulesFiles (and an optional coreRuleFile if any serves your purpose).\nNote: this goal must always be invoked before the process-resources phase, otherwise all files will be considered as uptodate.\n", 1 ); append( sb, "", 0 ); if ( detail ) { append( sb, "Available parameters:", 1 ); append( sb, "", 0 ); append( sb, "backupGetter (Default: false)", 2 ); append( sb, "Flag to save previous getter in a backup before doing parsing.\nNote: by default, do not perform backup (but it was here originaly so let it possible...)\n", 3 ); append( sb, "", 0 ); append( sb, "basedir (Default: ${basedir}/src/main/resources)", 2 ); append( sb, "Default directory where to look for files.", 3 ); append( sb, "", 0 ); append( sb, "bundles (Default: fr_FR,en_GB)", 2 ); append( sb, "Locales to treate, separated by comma.\nExample :\n\nfr_FR,en_GB\n", 3 ); append( sb, "", 0 ); append( sb, "coreRuleFile", 2 ); append( sb, "Defines an optional files which contain xpath rules to obtain i18n keys in xml files and is defined in plugin.", 3 ); append( sb, "", 0 ); append( sb, "cp (Default: ${basedir}/target/classes)", 2 ); append( sb, "Build directory (used to know if files in sources are up-to-date).", 3 ); append( sb, "", 0 ); append( sb, "encoding (Default: ${project.build.sourceEncoding})", 2 ); append( sb, "Encoding used to load and store files.\nNote: If nothing is filled here, we will use the system property file.encoding.\n", 3 ); append( sb, "", 0 ); append( sb, "entries", 2 ); append( sb, "Source entries (src+includes+excludes) to process.", 3 ); append( sb, "", 0 ); append( sb, "force (Default: false)", 2 ); append( sb, "To force reparse of all sources.", 3 ); append( sb, "", 0 ); append( sb, "genSrc (Default: true)", 2 ); append( sb, "To update generated files to user i18n files.\nNote : By default, this is active, in order to have a project uptodate with last i18n bundles detected.\n", 3 ); append( sb, "", 0 ); append( sb, "includes", 2 ); append( sb, "Defines files to parse.", 3 ); append( sb, "", 0 ); append( sb, "keysModifier (Default: false)", 2 ); append( sb, "Deprecated. since 1.2, will no more used", 3 ); append( sb, "", 0 ); append( sb, "To activate the modification of keys\nNote : By default not active, since it requires to have UI available and this is not acceptable for server build.\n\nNote : At the moment the fully fonctionnality is no more available and will be recode in a separated goal (one day...)\n", 3 ); append( sb, "", 0 ); append( sb, "namespaces", 2 ); append( sb, "Defines namespaces mapping if needed.\nExample :\n\n\nhttp://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd\n\n", 3 ); append( sb, "", 0 ); append( sb, "out (Default: ${basedir}/target/generated-sources/i18n)", 2 ); append( sb, "Directory where to generate i18n files.", 3 ); append( sb, "", 0 ); append( sb, "outputGetter (Default: xmlUser.getter)", 2 ); append( sb, "Defines the file name of the getter where to put detected i18n keys while getter phase.", 3 ); append( sb, "", 0 ); append( sb, "project (Default: ${project})", 2 ); append( sb, "Dependance du projet.", 3 ); append( sb, "", 0 ); append( sb, "showTouchedFiles (Default: ${maven.verbose})", 2 ); append( sb, "Flag to display touched files while parsing.\nNote: the value will be always true if verbose is set at true.\n", 3 ); append( sb, "", 0 ); append( sb, "silent (Default: false)", 2 ); append( sb, "Silent flag to see only errors in console.", 3 ); append( sb, "", 0 ); append( sb, "src (Default: ${basedir}/src/main/resources/i18n)", 2 ); append( sb, "Directory where to find project i18n files.", 3 ); append( sb, "", 0 ); append( sb, "strictMode (Default: false)", 2 ); append( sb, "Strict mode to only keep in user i18n detected i18n keys and remove obsolete keys.\nNote : By default not active. Use this with care since it can delete keys. Moreover if this flag is activated, then all files will be parsed.\n", 3 ); append( sb, "", 0 ); append( sb, "treateDefaultEntry (Default: true)", 2 ); append( sb, "To treate default entry offered by the mojo.", 3 ); append( sb, "", 0 ); append( sb, "userRulesFiles", 2 ); append( sb, "Extra rules files to use for detecting i18n keys in xml validation files.\nNote : If the coreRulesFile is not defined, then you must fill this parameter.\n", 3 ); append( sb, "", 0 ); append( sb, "verbose (Default: ${maven.verbose})", 2 ); append( sb, "Verbose flag.\nNote : if not setted, we used the maven.verbose property.\n", 3 ); append( sb, "", 0 ); } } if ( goal == null || goal.length() <= 0 || "tapestry-bundle".equals( goal ) ) { append( sb, "i18n:tapestry-bundle", 0 ); append( sb, "Generates a unique bundle for a tapestry application.\nNote : The mojo has nothing specific to tapestry and should be renamed (or removed since the bundle mojo do the same with more options)...\n", 1 ); append( sb, "", 0 ); if ( detail ) { append( sb, "Available parameters:", 1 ); append( sb, "", 0 ); append( sb, "bundleOutputDir (Default: ${basedir}/target/generated-sources/resources/META-INF)", 2 ); append( sb, "Directory where to generate aggregated bundles.", 3 ); append( sb, "", 0 ); append( sb, "bundleOutputName (Default: ${project.artifactId}-i18n)", 2 ); append( sb, "Name of the bundle to generate.", 3 ); append( sb, "", 0 ); append( sb, "bundles (Default: fr_FR,en_GB)", 2 ); append( sb, "Locales to treate, separated by comma.\nExample :\n\nfr_FR,en_GB\n", 3 ); append( sb, "", 0 ); append( sb, "checkBundle (Default: true)", 2 ); append( sb, "A flag to check that bundles are complete (no missing i18n translations).\nNote : This behaviour will be activated is failsIfWarning is on.\n", 3 ); append( sb, "", 0 ); append( sb, "collectOutputDir (Default: ${basedir}/target/i18n)", 2 ); append( sb, "Repertoire ou generer les bundles.", 3 ); append( sb, "", 0 ); append( sb, "collectOutputName (Default: collect-${project.artifactId}-i18n)", 2 ); append( sb, "Nom de base des fichiers qui contient les localisations des bundles.", 3 ); append( sb, "", 0 ); append( sb, "encoding (Default: ${project.build.sourceEncoding})", 2 ); append( sb, "Encoding used to load and store files.\nNote: If nothing is filled here, we will use the system property file.encoding.\n", 3 ); append( sb, "", 0 ); append( sb, "failsIfWarning (Default: false)", 2 ); append( sb, "A flag to make the build fails if there is some warnings while generating bundle, says when it misses some translations.\nNote : This parameter should be used in a release profile to ensure bundles are complete.\n", 3 ); append( sb, "", 0 ); append( sb, "generateDefaultLocale (Default: false)", 2 ); append( sb, "A flag to generate a bundle with the first locale defined as a default bundle (with no locale specialization).", 3 ); append( sb, "", 0 ); append( sb, "genSrc (Default: true)", 2 ); append( sb, "To update generated files to user i18n files.\nNote : By default, this is active, in order to have a project uptodate with last i18n bundles detected.\n", 3 ); append( sb, "", 0 ); append( sb, "out (Default: ${basedir}/target/generated-sources/i18n)", 2 ); append( sb, "Directory where to generate i18n files.", 3 ); append( sb, "", 0 ); append( sb, "project (Default: ${project})", 2 ); append( sb, "Dependance du projet.", 3 ); append( sb, "", 0 ); append( sb, "showEmpty (Default: false)", 2 ); append( sb, "A flag to show missing i18n translation.\nNote : Need the checkBundle to be activated).\n", 3 ); append( sb, "", 0 ); append( sb, "silent (Default: false)", 2 ); append( sb, "Silent flag to see only errors in console.", 3 ); append( sb, "", 0 ); append( sb, "src (Default: ${basedir}/src/main/resources/i18n)", 2 ); append( sb, "Directory where to find project i18n files.", 3 ); append( sb, "", 0 ); append( sb, "strictMode (Default: false)", 2 ); append( sb, "Strict mode to only keep in user i18n detected i18n keys and remove obsolete keys.\nNote : By default not active. Use this with care since it can delete keys. Moreover if this flag is activated, then all files will be parsed.\n", 3 ); append( sb, "", 0 ); append( sb, "verbose (Default: ${maven.verbose})", 2 ); append( sb, "Verbose flag.\nNote : if not setted, we used the maven.verbose property.\n", 3 ); append( sb, "", 0 ); } } if ( getLog().isInfoEnabled() ) { getLog().info( sb.toString() ); } } /** *

Repeat a String n times to form a new string.

* * @param str String to repeat * @param repeat number of times to repeat str * @return String with repeated String * @throws NegativeArraySizeException if repeat < 0 * @throws NullPointerException if str is null */ private static String repeat( String str, int repeat ) { StringBuffer buffer = new StringBuffer( repeat * str.length() ); for ( int i = 0; i < repeat; i++ ) { buffer.append( str ); } return buffer.toString(); } /** * Append a description to the buffer by respecting the indentSize and lineLength parameters. * Note: The last character is always a new line. * * @param sb The buffer to append the description, not null. * @param description The description, not null. * @param indent The base indentation level of each line, must not be negative. */ private void append( StringBuffer sb, String description, int indent ) { for ( Iterator it = toLines( description, indent, indentSize, lineLength ).iterator(); it.hasNext(); ) { sb.append( it.next().toString() ).append( '\n' ); } } /** * Splits the specified text into lines of convenient display length. * * @param text The text to split into lines, must not be null. * @param indent The base indentation level of each line, must not be negative. * @param indentSize The size of each indentation, must not be negative. * @param lineLength The length of the line, must not be negative. * @return The sequence of display lines, never null. * @throws NegativeArraySizeException if indent < 0 */ private static List toLines( String text, int indent, int indentSize, int lineLength ) { List lines = new ArrayList(); String ind = repeat( "\t", indent ); String[] plainLines = text.split( "(\r\n)|(\r)|(\n)" ); for ( int i = 0; i < plainLines.length; i++ ) { toLines( lines, ind + plainLines[i], indentSize, lineLength ); } return lines; } /** * Adds the specified line to the output sequence, performing line wrapping if necessary. * * @param lines The sequence of display lines, must not be null. * @param line The line to add, must not be null. * @param indentSize The size of each indentation, must not be negative. * @param lineLength The length of the line, must not be negative. */ private static void toLines( List lines, String line, int indentSize, int lineLength ) { int lineIndent = getIndentLevel( line ); StringBuffer buf = new StringBuffer( 256 ); String[] tokens = line.split( " +" ); for ( int i = 0; i < tokens.length; i++ ) { String token = tokens[i]; if ( i > 0 ) { if ( buf.length() + token.length() >= lineLength ) { lines.add( buf.toString() ); buf.setLength( 0 ); buf.append( repeat( " ", lineIndent * indentSize ) ); } else { buf.append( ' ' ); } } for ( int j = 0; j < token.length(); j++ ) { char c = token.charAt( j ); if ( c == '\t' ) { buf.append( repeat( " ", indentSize - buf.length() % indentSize ) ); } else if ( c == '\u00A0' ) { buf.append( ' ' ); } else { buf.append( c ); } } } lines.add( buf.toString() ); } /** * Gets the indentation level of the specified line. * * @param line The line whose indentation level should be retrieved, must not be null. * @return The indentation level of the line. */ private static int getIndentLevel( String line ) { int level = 0; for ( int i = 0; i < line.length() && line.charAt( i ) == '\t'; i++ ) { level++; } for ( int i = level + 1; i <= level + 4 && i < line.length(); i++ ) { if ( line.charAt( i ) == '\t' ) { level++; break; } } return level; } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy