Search in sources :

Example 1 with IContentAssistProposalRequest

use of org.eclipse.wst.xsl.ui.provisional.contentassist.IContentAssistProposalRequest in project webtools.sourceediting by eclipse.

the class EXSLTCommonContentAssistProcessor method computeCompletionProposals.

public ICompletionProposal[] computeCompletionProposals(ITextViewer textViewer, int documentPosition) {
    initializeProposalVariables(textViewer, documentPosition);
    // Only provide proposals for elements in either the XSLT Namespace or EXSLT namespace.
    String namespaceURI = xmlNode.getNamespaceURI();
    if (namespaceURI == null || !namespaceURI.contains("http://exslt.org/") && !namespaceURI.equals(XSLCore.XSL_NAMESPACE_URI)) {
        return null;
    }
    EXSLTContentAssistRequestFactory requestFactory = new EXSLTContentAssistRequestFactory(textViewer, cursorPosition, xmlNode, sdRegion, completionRegion, matchString);
    IContentAssistProposalRequest contentAssistRequest = requestFactory.getContentAssistRequest();
    exsltProposals = contentAssistRequest.getCompletionProposals();
    ICompletionProposal[] proposals = new ICompletionProposal[exsltProposals.size()];
    exsltProposals.toArray(proposals);
    return proposals;
}
Also used : IContentAssistProposalRequest(org.eclipse.wst.xsl.ui.provisional.contentassist.IContentAssistProposalRequest) ICompletionProposal(org.eclipse.jface.text.contentassist.ICompletionProposal)

Example 2 with IContentAssistProposalRequest

use of org.eclipse.wst.xsl.ui.provisional.contentassist.IContentAssistProposalRequest in project webtools.sourceediting by eclipse.

the class XSLContentAssistRequestFactory method getContentAssistRequest.

/**
 * Get the appropriate content assist request class for the XSL request.
 * @return
 */
public IContentAssistProposalRequest getContentAssistRequest() {
    NamedNodeMap nodeMap = xmlNode.getAttributes();
    IDOMElement element = (IDOMElement) xmlNode;
    IContentAssistProposalRequest proposal = commonAttributeProposals(nodeMap);
    if (proposal instanceof NullContentAssistRequest) {
        if (isElementProposal(element)) {
            proposal = getElementProposals(nodeMap, element);
        }
    }
    return proposal;
}
Also used : NamedNodeMap(org.w3c.dom.NamedNodeMap) IContentAssistProposalRequest(org.eclipse.wst.xsl.ui.provisional.contentassist.IContentAssistProposalRequest) NullContentAssistRequest(org.eclipse.wst.xsl.ui.provisional.contentassist.NullContentAssistRequest) IDOMElement(org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement)

Example 3 with IContentAssistProposalRequest

use of org.eclipse.wst.xsl.ui.provisional.contentassist.IContentAssistProposalRequest in project webtools.sourceediting by eclipse.

the class XSLContentAssistProcessor method getXSLNamespaceProposals.

private ArrayList<ICompletionProposal> getXSLNamespaceProposals() {
    if (XSLCore.isXSLNamespace(xmlNode)) {
        XSLContentAssistRequestFactory requestFactory = new XSLContentAssistRequestFactory(textViewer, cursorPosition, xmlNode, sdRegion, completionRegion, matchString);
        IContentAssistProposalRequest contentAssistRequest = requestFactory.getContentAssistRequest();
        xslProposals = contentAssistRequest.getCompletionProposals();
    }
    return xslProposals;
}
Also used : IContentAssistProposalRequest(org.eclipse.wst.xsl.ui.provisional.contentassist.IContentAssistProposalRequest)

Example 4 with IContentAssistProposalRequest

use of org.eclipse.wst.xsl.ui.provisional.contentassist.IContentAssistProposalRequest in project webtools.sourceediting by eclipse.

the class EXSLTContentAssistRequestFactory method getContentAssistRequest.

/**
 * Get the appropriate content assist request class for the XSL request.
 * @return
 */
public IContentAssistProposalRequest getContentAssistRequest() {
    NamedNodeMap nodeMap = xmlNode.getAttributes();
    IDOMElement element = (IDOMElement) xmlNode;
    IContentAssistProposalRequest proposal = commonAttributeProposals(nodeMap);
    if (proposal instanceof NullContentAssistRequest) {
        if (isElementProposal(element)) {
            proposal = getNullProposal();
        }
    }
    return proposal;
}
Also used : NamedNodeMap(org.w3c.dom.NamedNodeMap) IContentAssistProposalRequest(org.eclipse.wst.xsl.ui.provisional.contentassist.IContentAssistProposalRequest) NullContentAssistRequest(org.eclipse.wst.xsl.ui.provisional.contentassist.NullContentAssistRequest) IDOMElement(org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement)

Aggregations

IContentAssistProposalRequest (org.eclipse.wst.xsl.ui.provisional.contentassist.IContentAssistProposalRequest)4 IDOMElement (org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement)2 NullContentAssistRequest (org.eclipse.wst.xsl.ui.provisional.contentassist.NullContentAssistRequest)2 NamedNodeMap (org.w3c.dom.NamedNodeMap)2 ICompletionProposal (org.eclipse.jface.text.contentassist.ICompletionProposal)1