Tools menu has an Apply Script option allowing to execute a Groovy[1]
| class Script |
|---|
| Modifier and Type | Method and Description |
|---|---|
| void | apply()
Execute the script. It is the only mandatory method
|
| boolean | showConsole()
Return false if the script console should be presented in the Editor message area. By default the messages are presented in a specific Script console
|
apply() method is the only mandatory method. For example, the following script just echo a message:public void apply() { context.echo("Hello World!"); }Alternatively, if the script has no specified method, the
apply() method declaration can be omitted. For example, the following code has the same result:context.echo("Hello World!");
context object which has the following API:| class context |
|---|
| Modifier and Type | Method and Description |
|---|---|
| void | abort(String message)
abort the script
|
| void | echo(String message)
print a message in the Script console
|
| void | echo(String message, String color)
print a message in the Script console, with a specific html color
|
| void | error(String message)
print an error message in the Script console
|
| File | getFile()
return the Script file
|
| File | getPath(String path)
return the File corresponding to a path relative to the script file
|
public void apply() { context.abort("Abort the script"); }
helper object which has the following API:| class helper |
|---|
| Modifier and Type | Method and Description |
|---|---|
| boolean | checkXML(XMLContainer cont)
Check the well-formedness of an XML file
|
| XMLFormatContainer | getContainer(File file)
Return the container associated with a file
|
| XMLFormatContainer | getContainer(URL url)
Return the container associated with an URL
|
| File | openDirectoryDialog(String title, String extensions)
Open a directory dialog and return the directory
|
| File | openFileDialog(String title, String extensions)
Open an Open File dialog and return the file
|
| XMLFormatContainer | openXMLFile(File file)
Open an XML file in the editor
|
| File | saveFileDialog(String title, String extensions)
Open a Save File dialog and return the file
|
| boolean | transform(XMLContainer cont, File xsl, File outputFile)
Transform an XML file using an XSL file
|
| boolean | validate(XMLContainer cont)
Validate an XML file
|
| boolean | validateAgainstSchema(XMLContainer cont, File schema)
Validate an XML file against a Schema
|
XMLContainers can be any type of XML file: XML, DTD, XSD, XSL.
XMLContainer represents any XML fileXSDContainer represents a SchemaXSLContainer represents an XSL fileDTDContainer represents a DTD
Copyright 2006-2016 Hervé. All Rights Reserved. Documentation and source under the LGPL v2 and Apache 2.0 licences