public final class CodeTemplateParameter extends Object
Master parameters can have additional hints in the form
${param hint=value [hint2=value2] ... } ${param hint="string-literal" ... } ${param hint ... }The hints give additional specification of what the parameter's value should be.
=value
are assigned with string value "true".Modifier and Type | Field and Description |
---|---|
static String |
COMPLETION_INVOKE_HINT_NAME |
static String |
CURSOR_PARAMETER_NAME
Name of the parameter corresponding to the caret position parameter.
|
static String |
DEFAULT_VALUE_HINT_NAME
Name of the hint that defines an explicit default value of a parameter.
|
static String |
EDITABLE_HINT_NAME
Name of the hint that defines whether the given parameter is editable
by the user or not.
|
static String |
LINE_HINT_NAME |
static String |
NO_FORMAT_PARAMETER_NAME |
static String |
NO_INDENT_PARAMETER_NAME |
static String |
ORDERING_HINT_NAME
The ordering attribute defines the sequence in which placeholders are
completed.
|
static String |
SELECTION_PARAMETER_NAME |
Modifier and Type | Method and Description |
---|---|
Map<String,String> |
getHints()
Get map of the [String,String] hints in the parameter.
|
int |
getInsertTextOffset()
Get starting offset of this parameter
in the
CodeTemplateInsertRequest.getInsertText() . |
CodeTemplateParameter |
getMaster()
Get the master parameter of this parameter.
|
String |
getName()
Get name of this parameter as parsed from the code template description's text.
|
int |
getParametrizedTextEndOffset()
Get the ending offset of this parameter in the parametrized text.
|
int |
getParametrizedTextStartOffset()
Get starting offset of this parameter in the parametrized text.
|
Collection<? extends CodeTemplateParameter> |
getSlaves()
Get unmodifiable collection of the slave parameters.
|
String |
getValue()
Get the present value of this parameter.
|
boolean |
isEditable()
Check whether this parameter is editable by the user.
|
boolean |
isSlave()
Check whether this parameter is slave or not.
|
boolean |
isUserModified()
Check whether the value of this parameter was modified by the user.
|
void |
setValue(String newValue)
Set a new value for this parameter.
|
public static final String CURSOR_PARAMETER_NAME
public static final String COMPLETION_INVOKE_HINT_NAME
public static final String SELECTION_PARAMETER_NAME
public static final String NO_FORMAT_PARAMETER_NAME
public static final String NO_INDENT_PARAMETER_NAME
public static final String LINE_HINT_NAME
public static final String DEFAULT_VALUE_HINT_NAME
public static final String EDITABLE_HINT_NAME
${param editable=false}
public static final String ORDERING_HINT_NAME
Example of ordering of parameters :
// paramC comes first, then paramB, then paramA ${paramA} ${paramB ordering=2} ${paramC ordering=1}https://netbeans.org/bugzilla/show_bug.cgi?id=181703
public String getName()
public String getValue()
CodeTemplateParameter.DEFAULT_VALUE_HINT_NAME
then the default value
is taken from the hint.
Once the code template gets inserted into the document
(can be checked by CodeTemplateInsertRequest.isInserted()
)
then the user may modify the parameter's value explicitly and this method
will reflect these changes.
public void setValue(String newValue)
CodeTemplateInsertRequest.isInserted()
public boolean isEditable()
public boolean isUserModified()
public int getInsertTextOffset()
CodeTemplateInsertRequest.getInsertText()
.CodeTemplateInsertRequest.isReleased()
.public int getParametrizedTextStartOffset()
CodeTemplateInsertRequest.getParametrizedText()
.CodeTemplateParameter.getParametrizedTextEndOffset()
public int getParametrizedTextEndOffset()
CodeTemplateInsertRequest.getParametrizedText()
.CodeTemplateParameter.getParametrizedTextStartOffset()
public Map<String,String> getHints()
${param hint1 hint2="defaultValue"}
will contain ["hint1","true"] and ["hint2","defaultValue"].public CodeTemplateParameter getMaster()
public Collection<? extends CodeTemplateParameter> getSlaves()
public boolean isSlave()