Package org.eclipse.wst.xsl.ui.provisional.contentassist
public class AbstractXMLElementContentAssistRequest extends org.eclipse.wst.xsl.ui.provisional.contentassist.AbstractXSLContentAssistRequestAdopters can extend this class to implement their own content assistance for Element proposals using the XML Content Model.
Field Summary | |
protected org.eclipse.wst.xsl.ui.internal.contentassist.contentmodel.XSLContentModelGenerator | contentModel |
protected MarkupTagInfoProvider | infoProvider |
protected static java.lang.String | XPATH_FIRST_XSLANCESTOR_NODE |
Constructor Summary |
AbstractXMLElementContentAssistRequest(org.w3c.dom.Node node
,
IStructuredDocumentRegion documentRegion
,
ITextRegion completionRegion
,
int begin
,
int length
,
java.lang.String filter
,
ITextViewer textViewer) |
Method Summary | |
protected void | addTagNameProposals(int position) Adds proposals for the XML_TAG_NAME region. |
protected boolean | beginsWith(java.lang.String aString
,
java.lang.String prefix) |
protected org.eclipse.wst.xsl.ui.provisional.contentassist.CustomCompletionProposal | createProposal(java.lang.String proposedText
,
java.lang.String additionalInfo
,
int offset
,
Image image
,
int startLength) |
protected java.lang.String | getAdditionalInfo(CMNode parentOrOwner
,
CMNode cmnode) Retrieves cmnode's documentation to display in the completion proposal's additional info. If no documentation exists for cmnode, try displaying parentOrOwner's documentation String any documentation information to display for cmnode. null if there is nothing to display. |
protected java.util.List | getAvailableChildElementDeclarations(org.w3c.dom.Element parent
,
int childPosition) Returns a list of CMNodes that are available within this parent context Given the grammar shown below and a snippet of XML code (where the '|' indicated the cursor position) the list would return all of the element declarations that are potential child elements of Foo. grammar : Foo -> (A, B, C) snippet : |
protected java.util.List | getAvailableChildrenAtIndex(org.w3c.dom.Element parent
,
int index
,
int validityChecking) |
protected java.util.Iterator | getAvailableContentNodes(IDOMDocument domDocument
,
org.w3c.dom.Node ancestorNode
,
int includeOptions) |
protected CMElementDeclaration | getCMElementDeclaration(org.w3c.dom.Node node) |
protected Image | getCMNodeImage(CMNode cmNode) |
protected int | getCursorPositionForProposedText(java.lang.String proposedText) This is the position the cursor should be in after the proposal is applied |
protected int | getElementPosition(org.w3c.dom.Node child) |
protected MarkupTagInfoProvider | getInfoProvider() Gets the infoProvider. fInfoProvider and if fInfoProvider was null create a new
instance |
protected ITextRegion | getNameRegion(IStructuredDocumentRegion flatNode) |
protected java.lang.String | getRequiredName(org.w3c.dom.Node ownerNode
,
CMNode cmnode) |
protected boolean | inAttributeRegion() Check to see if the current position is in an Attribute Region if so, return true otherwise false |
protected boolean | isNameRegion(ITextRegion region) Checks to the see if the element is in the correct region. |
Field Detail |
protected org.eclipse.wst.xsl.ui.internal.contentassist.contentmodel.XSLContentModelGenerator contentModel
protected MarkupTagInfoProvider infoProvider
protected static java.lang.String XPATH_FIRST_XSLANCESTOR_NODE
Constructor Detail |
public AbstractXMLElementContentAssistRequest(org.w3c.dom.Node node
,
IStructuredDocumentRegion documentRegion
,
ITextRegion completionRegion
,
int begin
,
int length
,
java.lang.String filter
,
ITextViewer textViewer)
Methods Detail |
protected void addTagNameProposals(int position)
Adds proposals for the XML_TAG_NAME region.
position
protected boolean beginsWith(java.lang.String aString
,
java.lang.String prefix)
aString
prefix
boolean
protected org.eclipse.wst.xsl.ui.provisional.contentassist.CustomCompletionProposal createProposal(java.lang.String proposedText
,
java.lang.String additionalInfo
,
int offset
,
Image image
,
int startLength)
proposedText
additionalInfo
offset
image
startLength
org.eclipse.wst.xsl.ui.provisional.contentassist.CustomCompletionProposal
protected java.lang.String getAdditionalInfo(CMNode parentOrOwner
,
CMNode cmnode)
Retrieves cmnode's documentation to display in the completion proposal's
additional info. If no documentation exists for cmnode, try displaying
parentOrOwner's documentation
String any documentation information to display for cmnode.
null
if there is nothing to display.
parentOrOwner
cmnode
java.lang.String
protected java.util.List getAvailableChildElementDeclarations(org.w3c.dom.Element parent
,
int childPosition)
Returns a list of CMNodes that are available within this parent context
Given the grammar shown below and a snippet of XML code (where the '|'
indicated the cursor position)
the list would return all of the element declarations that are
potential child elements of Foo.
grammar : Foo -> (A, B, C)
snippet :
parent
childPosition
java.util.List
protected java.util.List getAvailableChildrenAtIndex(org.w3c.dom.Element parent
,
int index
,
int validityChecking)
parent
index
validityChecking
java.util.List
protected java.util.Iterator getAvailableContentNodes(IDOMDocument domDocument
,
org.w3c.dom.Node ancestorNode
,
int includeOptions)
domDocument
ancestorNode
includeOptions
java.util.Iterator
protected CMElementDeclaration getCMElementDeclaration(org.w3c.dom.Node node)
node
CMElementDeclaration
protected Image getCMNodeImage(CMNode cmNode)
cmNode
Image
protected int getCursorPositionForProposedText(java.lang.String proposedText)
This is the position the cursor should be in after the proposal is applied
proposedText
int
- the position the cursor should be in after the proposal is applied
protected int getElementPosition(org.w3c.dom.Node child)
child
int
protected MarkupTagInfoProvider getInfoProvider()
Gets the infoProvider.
fInfoProvider and if fInfoProvider was null
create a new
instance
MarkupTagInfoProvider
protected ITextRegion getNameRegion(IStructuredDocumentRegion flatNode)
flatNode
ITextRegion
protected java.lang.String getRequiredName(org.w3c.dom.Node ownerNode
,
CMNode cmnode)
ownerNode
cmnode
java.lang.String
protected boolean inAttributeRegion()
Check to see if the current position is in an Attribute Region if so, return true otherwise false
boolean
- True if in attribute region, false otherwise.
protected boolean isNameRegion(ITextRegion region)
Checks to the see if the element is in the correct region.
region
boolean