public class DataEntryField extends Object
{
"title": "Generate 'content.dtd' and bind with xml-model",
"kind": "quickfix",
...
],
"data": {
"uri": "file:///.../content.xml",
"participantId": "org.eclipse.lemminx.extensions.contentmodel.participants.codeactions.NoGrammarConstraintsCodeAction#xml-model@dtd",
"file": "file:///.../content.dtd"
}
}
The two required data field for any resolve (codeAction, completion, etc) are:
- "uri" : the URI of the document XML where completion, codeAction, etc must be resolved (when user clicks on this quickfix).
- "participantId" : the participant ID which must be used to process the resolve of the completion, codeAction, etc.
- extra fields (in the below sample "file" is the file URI of the grammar file which must be generated).
Modifier and Type | Field and Description |
---|---|
static String |
OFFSET_FIELD |
Constructor and Description |
---|
DataEntryField() |
Modifier and Type | Method and Description |
---|---|
static com.google.gson.JsonObject |
createCompletionData(ICompletionRequest request,
String participantId)
Returns the minimal data to resolve a completion item.
|
static com.google.gson.JsonObject |
createData(String uri,
String participantId)
Create a JSON data entry field with the two required information:
|
static String |
getParticipantId(Object data)
Returns the participant ID which must be used to process the resolve of the
completion, codeAction, etc and null otherwise.
|
static String |
getProperty(Object data,
String fieldName)
Returns the property value of the given
fieldName if the given
data and null otherwise. |
static Boolean |
getPropertyAsBoolean(Object data,
String fieldName)
Returns the value of the field as an boolean or null if the field is empty.
|
static Integer |
getPropertyAsInt(Object data,
String fieldName)
Returns the value of the field as an integer or null if the field is empty.
|
static String |
getUri(Object data)
Returns the URI of the document XML where completion, codeAction, etc must be
resolved (when user clicks on this quickfix) and null otherwise.
|
public static final String OFFSET_FIELD
public static com.google.gson.JsonObject createData(String uri, String participantId)
uri
- the URI of the document XML where completion,
codeAction, etc must be resolved (when user clicks on
this quickfix).participantId
- the participant ID which must be used to process the
resolve of the completion, codeAction, etc.public static String getUri(Object data)
data
- the data entry field comings from the CompletionItem, CodeAction,
etc.public static String getParticipantId(Object data)
data
- the data entry field comings from the CompletionItem, CodeAction,
etc.public static String getProperty(Object data, String fieldName)
fieldName
if the given
data
and null otherwise.data
- the data entry field comings from the CompletionItem,
CodeAction, etc.fieldName
- the entry field name (ex : "uri", "participantId").fieldName
if the given
data
and null otherwise.public static Integer getPropertyAsInt(Object data, String fieldName)
data
- the object to read the field offieldName
- the field to readClassCastException
- if the field is not an integerpublic static Boolean getPropertyAsBoolean(Object data, String fieldName)
data
- the object to read the field offieldName
- the field to readClassCastException
- if the field is not an booleanpublic static com.google.gson.JsonObject createCompletionData(ICompletionRequest request, String participantId)
request
- the completion request.participantId
- the participant id to retrieve the resolver.Copyright © 2022. All rights reserved.