Package org.eclipse.wst.xsl.ui.provisional.contentassist


org.eclipse.wst.xsl.ui.provisional.contentassist
Class AbstractXMLElementContentAssistRequest



public class AbstractXMLElementContentAssistRequest
extends org.eclipse.wst.xsl.ui.provisional.contentassist.AbstractXSLContentAssistRequest
Adopters 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.XSLContentModelGeneratorcontentModel
    
protected MarkupTagInfoProviderinfoProvider
    
protected static java.lang.StringXPATH_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 voidaddTagNameProposals(int position)
     Adds proposals for the XML_TAG_NAME region.
protected booleanbeginsWith(java.lang.String aString , java.lang.String prefix)
    
protected org.eclipse.wst.xsl.ui.provisional.contentassist.CustomCompletionProposalcreateProposal(java.lang.String proposedText , java.lang.String additionalInfo , int offset , Image image , int startLength)
    
protected java.lang.StringgetAdditionalInfo(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.ListgetAvailableChildElementDeclarations(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 : | result : {A, B, C}
protected java.util.ListgetAvailableChildrenAtIndex(org.w3c.dom.Element parent , int index , int validityChecking)
    
protected java.util.IteratorgetAvailableContentNodes(IDOMDocument domDocument , org.w3c.dom.Node ancestorNode , int includeOptions)
    
protected CMElementDeclarationgetCMElementDeclaration(org.w3c.dom.Node node)
    
protected ImagegetCMNodeImage(CMNode cmNode)
    
protected intgetCursorPositionForProposedText(java.lang.String proposedText)
     This is the position the cursor should be in after the proposal is applied
protected intgetElementPosition(org.w3c.dom.Node child)
    
protected MarkupTagInfoProvidergetInfoProvider()
     Gets the infoProvider. fInfoProvider and if fInfoProvider was null create a new instance
protected ITextRegiongetNameRegion(IStructuredDocumentRegion flatNode)
    
protected java.lang.StringgetRequiredName(org.w3c.dom.Node ownerNode , CMNode cmnode)
    
protected booleaninAttributeRegion()
     Check to see if the current position is in an Attribute Region if so, return true otherwise false
protected booleanisNameRegion(ITextRegion region)
     Checks to the see if the element is in the correct region.

Field Detail

contentModel

protected org.eclipse.wst.xsl.ui.internal.contentassist.contentmodel.XSLContentModelGenerator contentModel


infoProvider

protected MarkupTagInfoProvider infoProvider


XPATH_FIRST_XSLANCESTOR_NODE

protected static java.lang.String XPATH_FIRST_XSLANCESTOR_NODE


Constructor Detail

AbstractXMLElementContentAssistRequest

public AbstractXMLElementContentAssistRequest(org.w3c.dom.Node node , IStructuredDocumentRegion documentRegion , ITextRegion completionRegion , int begin , int length , java.lang.String filter , ITextViewer textViewer)


Methods Detail

addTagNameProposals

protected void addTagNameProposals(int position)

Adds proposals for the XML_TAG_NAME region.

Parameters

position


beginsWith

protected boolean beginsWith(java.lang.String aString , java.lang.String prefix)

Parameters

aString

prefix

Returns

boolean


createProposal

protected org.eclipse.wst.xsl.ui.provisional.contentassist.CustomCompletionProposal createProposal(java.lang.String proposedText , java.lang.String additionalInfo , int offset , Image image , int startLength)

Parameters

proposedText

additionalInfo

offset

image

startLength

Returns

org.eclipse.wst.xsl.ui.provisional.contentassist.CustomCompletionProposal


getAdditionalInfo

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.

Parameters

parentOrOwner

cmnode

Returns

java.lang.String


getAvailableChildElementDeclarations

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 : | result : {A, B, C}

Parameters

parent

childPosition

Returns

java.util.List


getAvailableChildrenAtIndex

protected java.util.List getAvailableChildrenAtIndex(org.w3c.dom.Element parent , int index , int validityChecking)

Parameters

parent

index

validityChecking

Returns

java.util.List


getAvailableContentNodes

protected java.util.Iterator getAvailableContentNodes(IDOMDocument domDocument , org.w3c.dom.Node ancestorNode , int includeOptions)

Parameters

domDocument

ancestorNode

includeOptions

Returns

java.util.Iterator


getCMElementDeclaration

protected CMElementDeclaration getCMElementDeclaration(org.w3c.dom.Node node)

Parameters

node

Returns

CMElementDeclaration


getCMNodeImage

protected Image getCMNodeImage(CMNode cmNode)

Parameters

cmNode

Returns

Image


getCursorPositionForProposedText

protected int getCursorPositionForProposedText(java.lang.String proposedText)

This is the position the cursor should be in after the proposal is applied

Parameters

proposedText

Returns

int - the position the cursor should be in after the proposal is applied


getElementPosition

protected int getElementPosition(org.w3c.dom.Node child)

Parameters

child

Returns

int


getInfoProvider

protected MarkupTagInfoProvider getInfoProvider()

Gets the infoProvider. fInfoProvider and if fInfoProvider was null create a new instance

Returns

MarkupTagInfoProvider


getNameRegion

protected ITextRegion getNameRegion(IStructuredDocumentRegion flatNode)

Parameters

flatNode

Returns

ITextRegion


getRequiredName

protected java.lang.String getRequiredName(org.w3c.dom.Node ownerNode , CMNode cmnode)

Parameters

ownerNode

cmnode

Returns

java.lang.String


inAttributeRegion

protected boolean inAttributeRegion()

Check to see if the current position is in an Attribute Region if so, return true otherwise false

Returns

boolean - True if in attribute region, false otherwise.


isNameRegion

protected boolean isNameRegion(ITextRegion region)

Checks to the see if the element is in the correct region.

Parameters

region

Returns

boolean