| java.lang.Object org.apache.tools.ant.module.api.support.ActionUtils
ActionUtils | final public class ActionUtils (Code) | | Makes it easier to implement org.netbeans.spi.project.ActionProvider in a standard way
by running targets in Ant scripts.
See Also: ActionProvider author: Jesse Glick |
Method Summary | |
public static String | antIncludesList(FileObject[] files, FileObject dir) Create an "includes" string such as is accepted by many Ant commands
as well as filesets. | public static String | antIncludesList(FileObject[] files, FileObject dir, boolean recursive) Create an "includes" string such as is accepted by many Ant commands
as well as filesets. | public static FileObject[] | findSelectedFiles(Lookup context, FileObject dir, String suffix, boolean strict) Convenience method to find a file selection in a selection (context).
All files must exist on disk (according to
FileUtil.toFile ).
If a constraining directory is supplied, they must also be contained in it.
If a constraining file suffix is supplied, the base names of the files
must end with that suffix.
The return value is null if there are no matching files; or if the strict
parameter is true and some of the files in the selection did not match
the constraints (disk files, directory, and/or suffix).
Typically
org.openide.loaders.DataNode s will form a node selection
which will be placed in the context. | public static FileObject[] | regexpMapFiles(FileObject[] fromFiles, FileObject fromDir, Pattern fromRx, FileObject toDir, String toSubst, boolean strict) Map files of one kind in a source directory to files of another kind in a target directory. | public static ExecutorTask | runTarget(FileObject buildXml, String[] targetNames, Properties properties) Runs an Ant target (or a sequence of them). |
antIncludesList | public static String antIncludesList(FileObject[] files, FileObject dir) throws IllegalArgumentException(Code) | | Create an "includes" string such as is accepted by many Ant commands
as well as filesets.
/ is always used as the separator in the relative paths.
Parameters: files - a list of files or folders to include, in the case of folderthe generated include contains recursively all files under the folder. Parameters: dir - a directory in which all the files reside a comma-separated list of relative file paths suitable for use by Ant(the empty string in case there are no files) throws: IllegalArgumentException - in case some file is not in the directory |
antIncludesList | public static String antIncludesList(FileObject[] files, FileObject dir, boolean recursive) throws IllegalArgumentException(Code) | | Create an "includes" string such as is accepted by many Ant commands
as well as filesets.
/ is always used as the separator in the relative paths.
Parameters: files - a list of files or folders to include, in the case of folderthe generated include contains recursively all files under the folder. Parameters: dir - a directory in which all the files reside Parameters: recursive - if true the include list for directory is recursive a comma-separated list of relative file paths suitable for use by Ant(the empty string in case there are no files) throws: IllegalArgumentException - in case some file is not in the directory since: org.apache.tools.ant.module/3 3.16 |
findSelectedFiles | public static FileObject[] findSelectedFiles(Lookup context, FileObject dir, String suffix, boolean strict)(Code) | | Convenience method to find a file selection in a selection (context).
All files must exist on disk (according to
FileUtil.toFile ).
If a constraining directory is supplied, they must also be contained in it.
If a constraining file suffix is supplied, the base names of the files
must end with that suffix.
The return value is null if there are no matching files; or if the strict
parameter is true and some of the files in the selection did not match
the constraints (disk files, directory, and/or suffix).
Typically
org.openide.loaders.DataNode s will form a node selection
which will be placed in the context. This method does not directly
look for nodes in the selection; but generally the lookups of the nodes in
a node selection are spliced into the context as well, so the
DataObject s
should be available. A corollary of not checking nodes directly is that any
nodes in the context which do not correspond to files at all (i.e. do not have
DataObject as a cookie) are ignored, even with the strict parameter on;
and that multiple nodes in the context with the same associated file are treated
as a single entry.
Parameters: context - a selection as provided to e.g. ActionProvider.isActionEnabled(...) Parameters: dir - a constraining parent directory, or null to not check for a parent directory Parameters: suffix - a file suffix (e.g. .java) to constrain files by,or null to not check suffixes Parameters: strict - if true, all files in the selection have to be accepted a nonempty selection of disk files, or null See Also: ActionProvider.isActionEnabled(...) |
regexpMapFiles | public static FileObject[] regexpMapFiles(FileObject[] fromFiles, FileObject fromDir, Pattern fromRx, FileObject toDir, String toSubst, boolean strict) throws IllegalArgumentException(Code) | | Map files of one kind in a source directory to files of another kind in a target directory.
You may use regular expressions to remap file names in the process.
Only files which actually exist in the target directory will be returned.
(If you expect the target files to be created
by Ant you do not need this method, since Ant's mappers suffice.)
The file paths considered by the regular expression (if supplied) always use
/ as the separator.
Typical usage to map a set of Java source files to corresponding tests:
regexpMapFiles(files, srcDir, Pattern.compile("/([^/]+)\\.java"), testSrcDir, "/\\1Test.java", true)
Parameters: fromFiles - a list of source files to start with (may be empty) Parameters: fromDir - a directory in which all the source files reside Parameters: fromRx - a regular expression to match against the source files(or null to keep the same relative file names); only onematch (somewhere in the path) is checked for; failure to matchprevents the file from being included Parameters: toDir - a target directory that results will reside in Parameters: toSubst - replacement text for fromRx (may include regexp references),or must be null if fromRx was null Parameters: strict - true to return null in case some starting files did not match any target file a list of corresponding target files (may be empty), or null if in strict modeand there was at least one source file which did not match a target file throws: IllegalArgumentException - in case some source file is not in the source directory |
runTarget | public static ExecutorTask runTarget(FileObject buildXml, String[] targetNames, Properties properties) throws IOException, IllegalArgumentException(Code) | | Runs an Ant target (or a sequence of them).
Parameters: buildXml - an Ant build script Parameters: targetNames - one or more targets to run; or null for the default target Parameters: properties - any Ant properties to define, or null a task tracking the progress of Ant throws: IOException - if there was a problem starting Ant throws: IllegalArgumentException - if you did not provide any targets |
|
|