public final class CodeTemplateInsertRequest extends Object
State
The insert request can be in three states:CodeTemplateInsertRequest.isInserted()
and CodeTemplateInsertRequest.isReleased()
return false. Registered CodeTemplateProcessor
s
will be asked to fill in the default values into the parameters.
CodeTemplateInsertRequest.isInserted()
returns true and CodeTemplateInsertRequest.isReleased()
returns false.
CodeTemplateInsertRequest.isReleased()
returns true. There is no more
work to do. Code templates processor(s) servicing the request will be released.
Parameters
The code template's text is first parsed to find the parameters. Each first occurrence of a parameter with particular name define a master parameter. All the other occurrences of a parameter with the same name define slave parameters (of the previously defined master).CodeTemplateParameter
Modifier and Type | Method and Description |
---|---|
List<? extends CodeTemplateParameter> |
getAllParameters()
Get all the parameters (masters and slaves)
present in the code template text in the order as they occur
in the parametrized text.
|
CodeTemplate |
getCodeTemplate()
Get code template associated with this insert request.
|
JTextComponent |
getComponent()
Get the text component into which the template should be inserted
at the current caret position.
|
String |
getInsertText()
Get the text where all the parameters are replaced
by their present values.
|
int |
getInsertTextOffset()
Return offset of the inserted template in the document's text.
|
CodeTemplateParameter |
getMasterParameter(String name)
Get master parameter with the given name.
|
List<? extends CodeTemplateParameter> |
getMasterParameters()
Get list of master parameters in the order they are located
in the code template text.
|
String |
getParametrizedText()
Get the present parametrized text handled by this request.
|
boolean |
isInserted()
Check whether the code template that this request
represents was already inserted into the document.
|
boolean |
isReleased()
Check whether this request is already released which means
that the code template was inserted and values of all the parameters
were modified by the user so there is no more work to be done.
|
void |
setParametrizedText(String parametrizedText)
Set the parametrized text to a new value.
|
public CodeTemplate getCodeTemplate()
public JTextComponent getComponent()
public List<? extends CodeTemplateParameter> getMasterParameters()
public CodeTemplateParameter getMasterParameter(String name)
name
- non-null name of the master parameter to be searched.public List<? extends CodeTemplateParameter> getAllParameters()
CodeTemplateInsertRequest.getMasterParameters()
public boolean isInserted()
CodeTemplateProcessor.parameterValueChanged(CodeTemplateParameter, boolean)
.
Returns false if the code template was not yet inserted into the document
i.e. the CodeTemplateProcessor.updateDefaultValues()
is currently being called on the registered processors.
CodeTemplateInsertRequest.isReleased()
public boolean isReleased()
CodeTemplateInsertRequest.isInserted()
gives additional info whether request is inserted into the document or not.CodeTemplateInsertRequest.isInserted()
public String getParametrizedText()
CodeTemplate.getParametrizedText()
is used.
CodeTemplateInsertRequest.setParametrizedText(String)
.public void setParametrizedText(String parametrizedText)
parametrizedText
- new parametrized text to be used.public String getInsertText()
public int getInsertTextOffset()