Package org.eclipse.wst.xml.ui.internal.contentassist

Examples of org.eclipse.wst.xml.ui.internal.contentassist.ContentAssistRequest


   */
  protected ContentAssistRequest computeCompletionProposals(String matchString, ITextRegion completionRegion,
      IDOMNode treeNode, IDOMNode xmlnode, CompletionProposalInvocationContext context) {

    //be sure to get the super proposals
    ContentAssistRequest request = super.computeCompletionProposals(matchString, completionRegion, treeNode, xmlnode, context);
   
    //calculate JSP specific proposals
    int documentPosition = context.getInvocationOffset();
    IStructuredDocumentRegion sdRegion = ContentAssistUtils.getStructuredDocumentRegion(
        context.getViewer(), documentPosition);

    Document doc = null;
    if (xmlnode != null) {
      if (xmlnode.getNodeType() == Node.DOCUMENT_NODE) {
        doc = (Document) xmlnode;
      } else {
        doc = xmlnode.getOwnerDocument();
      }
    }
    String[] directiveNames = {"page", "include", "taglib"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
   
    ITextRegion prevTextRegion = null;
    try {
      int offset = sdRegion.getStartOffset(completionRegion);
      if(offset > 0) {
        offset--;
      }
      ITypedRegion prevRegion = context.getDocument().getPartition(offset);
      prevTextRegion = sdRegion.getRegionAtCharacterOffset(prevRegion.getOffset());
    } catch(BadLocationException e) {
      //this should never happen
      Logger.logException(e);
    }
   
    // suggest JSP Expression inside of XML comments
    if (completionRegion.getType() == DOMRegionContext.XML_COMMENT_TEXT && !isXMLFormat(doc)) {
      if (request == null) {
        request = new ContentAssistRequest(treeNode, xmlnode, sdRegion,
            completionRegion, documentPosition, 0, ""); //$NON-NLS-1$
      }
      request.addProposal(new CustomCompletionProposal("<%=  %>",//$NON-NLS-1$
          documentPosition, 0, 4,
          JSPEditorPluginImageHelper.getInstance().getImage(JSPEditorPluginImages.IMG_OBJ_TAG_JSP),
          "jsp:expression", null, "&lt;%= %&gt;", XMLRelevanceConstants.R_JSP)); //$NON-NLS-1$ //$NON-NLS-2$
    }
    /* handle proposals in and around JSP_DIRECTIVE_OPEN,
     * JSP_DIRECTIVE_CLOSE (preceded by OPEN) and JSP_DIRECTIVE_NAME
     */
    else if ((completionRegion.getType() == DOMJSPRegionContexts.JSP_DIRECTIVE_OPEN &&
        documentPosition >= sdRegion.getTextEndOffset(completionRegion)) ||
        (completionRegion.getType() == DOMJSPRegionContexts.JSP_DIRECTIVE_NAME &&
            documentPosition <= sdRegion.getTextEndOffset(completionRegion)) ||
        (completionRegion.getType() == DOMJSPRegionContexts.JSP_DIRECTIVE_CLOSE &&
            prevTextRegion != null &&
            prevTextRegion.getType() == DOMJSPRegionContexts.JSP_DIRECTIVE_OPEN &&
            documentPosition <= sdRegion.getTextEndOffset(completionRegion))) {

      if (completionRegion.getType() == DOMJSPRegionContexts.JSP_DIRECTIVE_OPEN ||
          completionRegion.getType() == DOMJSPRegionContexts.JSP_DIRECTIVE_CLOSE) {
       
        if (request == null) {
          request = new ContentAssistRequest(xmlnode, xmlnode, sdRegion,
              completionRegion, documentPosition, 0, matchString);
        }
       
        //determine if there is any part of a directive name already existing
        Iterator regions = sdRegion.getRegions().iterator();
        String nameString = null;
        int begin = request.getReplacementBeginPosition();
        int length = request.getReplacementLength();
        while (regions.hasNext()) {
          ITextRegion region = (ITextRegion) regions.next();
          if (region.getType() == DOMJSPRegionContexts.JSP_DIRECTIVE_NAME) {
            nameString = sdRegion.getText(region);
            begin = sdRegion.getStartOffset(region);
            length = region.getTextLength();
            break;
          }
        }
        if (nameString == null) {
          nameString = ""; //$NON-NLS-1$
        }
       
        /* Suggest the directive names that have been determined to be
         * appropriate based on existing content
         */
        for (int i = 0; i < directiveNames.length; i++) {
          if (directiveNames[i].startsWith(nameString) || documentPosition <= begin) {
            request.addProposal(new CustomCompletionProposal(directiveNames[i], begin,
                length, directiveNames[i].length(),
                JSPEditorPluginImageHelper.getInstance().getImage(JSPEditorPluginImages.IMG_OBJ_TAG_JSP),
                directiveNames[i], null, null, XMLRelevanceConstants.R_JSP));
          }
        }
      }
      // by default, JSP_DIRECTIVE_NAME
      else {
        if (request == null) {
          request = new ContentAssistRequest(xmlnode, xmlnode, sdRegion,
              completionRegion, sdRegion.getStartOffset(completionRegion),
              completionRegion.getTextLength(), matchString);
        }
        //add each of the directive names as a proposal
        for (int i = 0; i < directiveNames.length; i++) {
          if (directiveNames[i].startsWith(matchString)) {
            request.addProposal(new CustomCompletionProposal(
                directiveNames[i], request.getReplacementBeginPosition(),
                request.getReplacementLength(), directiveNames[i].length(),
                JSPEditorPluginImageHelper.getInstance().getImage(JSPEditorPluginImages.IMG_OBJ_TAG_JSP),
                directiveNames[i], null, null, XMLRelevanceConstants.R_JSP));
          }
        }
      }
    }
    else if ((completionRegion.getType() == DOMJSPRegionContexts.JSP_DIRECTIVE_NAME &&
        documentPosition > sdRegion.getTextEndOffset(completionRegion)) ||
        (completionRegion.getType() == DOMJSPRegionContexts.JSP_DIRECTIVE_CLOSE &&
            documentPosition <= sdRegion.getStartOffset(completionRegion))) {
     
      if (request == null) {
        request = computeAttributeProposals(matchString, completionRegion,
            treeNode, xmlnode, context);
      }
    }
    // no name?: <%@ %>
    else if (completionRegion.getType() == DOMJSPRegionContexts.JSP_DIRECTIVE_CLOSE &&
        documentPosition <= sdRegion.getStartOffset(completionRegion)) {
      if (request != null) {
        request = computeAttributeProposals(matchString, completionRegion, treeNode,
            xmlnode, context);
      }
      Iterator regions = sdRegion.getRegions().iterator();
      String nameString = null;
      while (regions.hasNext()) {
        ITextRegion region = (ITextRegion) regions.next();
        if (region.getType() == DOMJSPRegionContexts.JSP_DIRECTIVE_NAME) {
          nameString = sdRegion.getText(region);
          break;
        }
      }
      if (nameString == null) {
        for (int i = 0; i < directiveNames.length; i++) {
          request.addProposal(new CustomCompletionProposal(
              directiveNames[i], request.getReplacementBeginPosition(),
              request.getReplacementLength(), directiveNames[i].length(),
              JSPEditorPluginImageHelper.getInstance().getImage(JSPEditorPluginImages.IMG_OBJ_TAG_JSP),
              directiveNames[i], null, null, XMLRelevanceConstants.R_JSP));
        }
      }
    }
View Full Code Here


   * @see AbstractContentAssistProcessor#computeCompletionProposals(int,
   *      String, ITextRegion, IDOMNode, IDOMNode)
   */
  protected ContentAssistRequest computeCompletionProposals(int documentPosition, String matchString, ITextRegion completionRegion, IDOMNode treeNode, IDOMNode xmlnode) {

    ContentAssistRequest request = super.computeCompletionProposals(documentPosition, matchString, completionRegion, treeNode, xmlnode);
    IStructuredDocumentRegion sdRegion = ContentAssistUtils.getStructuredDocumentRegion(fTextViewer, documentPosition);

    Document doc = null;
    if (xmlnode != null) {
      if (xmlnode.getNodeType() == Node.DOCUMENT_NODE)
        doc = (Document) xmlnode;
      else
        doc = xmlnode.getOwnerDocument();
    }
    String[] directiveNames = {"page", "include", "taglib"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    // suggest JSP Expression inside of XML comments
    if (completionRegion.getType() == DOMRegionContext.XML_COMMENT_TEXT && !isXMLFormat(doc)) {
      if (request == null)
        request = newContentAssistRequest(treeNode, xmlnode, sdRegion, completionRegion, documentPosition, 0, ""); //$NON-NLS-1$
      request.addProposal(new CustomCompletionProposal("<%=  %>", documentPosition, 0, 4, JSPEditorPluginImageHelper.getInstance().getImage(JSPEditorPluginImages.IMG_OBJ_TAG_GENERIC), "jsp:expression", null, "&lt;%= %&gt;", XMLRelevanceConstants.R_JSP)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
    }
    // handle proposals in and around JSP_DIRECTIVE_OPEN and
    // JSP_DIRECTIVE_NAME
    else if ((completionRegion.getType() == DOMJSPRegionContexts.JSP_DIRECTIVE_OPEN && documentPosition >= sdRegion.getTextEndOffset(completionRegion)) || (completionRegion.getType() == DOMJSPRegionContexts.JSP_DIRECTIVE_NAME && documentPosition <= sdRegion.getTextEndOffset(completionRegion))) {
      if (completionRegion.getType() == DOMJSPRegionContexts.JSP_DIRECTIVE_OPEN) {
        if (request == null)
          request = newContentAssistRequest(xmlnode, xmlnode, sdRegion, completionRegion, documentPosition, 0, matchString);
        Iterator regions = sdRegion.getRegions().iterator();
        String nameString = null;
        int begin = request.getReplacementBeginPosition();
        int length = request.getReplacementLength();
        while (regions.hasNext()) {
          ITextRegion region = (ITextRegion) regions.next();
          if (region.getType() == DOMJSPRegionContexts.JSP_DIRECTIVE_NAME) {
            nameString = sdRegion.getText(region);
            begin = sdRegion.getStartOffset(region);
            length = region.getTextLength();
            break;
          }
        }
        if (nameString == null)
          nameString = ""; //$NON-NLS-1$
        for (int i = 0; i < directiveNames.length; i++) {
          if (directiveNames[i].startsWith(nameString) || documentPosition <= begin)
            request.addProposal(new CustomCompletionProposal(directiveNames[i], begin, length, directiveNames[i].length(), JSPEditorPluginImageHelper.getInstance().getImage(JSPEditorPluginImages.IMG_OBJ_TAG_GENERIC), directiveNames[i], null, null, XMLRelevanceConstants.R_JSP));
        }
      }
      else { // by default, JSP_DIRECTIVE_NAME
        if (request == null)
          request = newContentAssistRequest(xmlnode, xmlnode, sdRegion, completionRegion, sdRegion.getStartOffset(completionRegion), completionRegion.getTextLength(), matchString);
        for (int i = 0; i < directiveNames.length; i++) {
          if (directiveNames[i].startsWith(matchString))
            request.addProposal(new CustomCompletionProposal(directiveNames[i], request.getReplacementBeginPosition(), request.getReplacementLength(), directiveNames[i].length(), JSPEditorPluginImageHelper.getInstance().getImage(JSPEditorPluginImages.IMG_OBJ_TAG_GENERIC), directiveNames[i], null, null, XMLRelevanceConstants.R_JSP));
        }
      }
    }
    else if ((completionRegion.getType() == DOMJSPRegionContexts.JSP_DIRECTIVE_NAME && documentPosition > sdRegion.getTextEndOffset(completionRegion)) || (completionRegion.getType() == DOMJSPRegionContexts.JSP_DIRECTIVE_CLOSE && documentPosition <= sdRegion.getStartOffset(completionRegion))) {
      if (request == null)
        request = computeAttributeProposals(documentPosition, matchString, completionRegion, treeNode, xmlnode);
      super.addTagCloseProposals(request);
      // CMVC 274033, this is being added for all <jsp:* tags
      // in addAttributeNameProposals(contentAssistRequest)
      // super.addAttributeNameProposals(request);
    }
    // no name?: <%@ %>
    else if (completionRegion.getType() == DOMJSPRegionContexts.JSP_DIRECTIVE_CLOSE && documentPosition <= sdRegion.getStartOffset(completionRegion)) {
      if (request != null)
        request = computeAttributeProposals(documentPosition, matchString, completionRegion, treeNode, xmlnode);
      Iterator regions = sdRegion.getRegions().iterator();
      String nameString = null;
      while (regions.hasNext()) {
        ITextRegion region = (ITextRegion) regions.next();
        if (region.getType() == DOMJSPRegionContexts.JSP_DIRECTIVE_NAME) {
          nameString = sdRegion.getText(region);
          break;
        }
      }
      if (nameString == null) {
        for (int i = 0; i < directiveNames.length; i++) {
          request.addProposal(new CustomCompletionProposal(directiveNames[i], request.getReplacementBeginPosition(), request.getReplacementLength(), directiveNames[i].length(), JSPEditorPluginImageHelper.getInstance().getImage(JSPEditorPluginImages.IMG_OBJ_TAG_GENERIC), directiveNames[i], null, null, XMLRelevanceConstants.R_JSP));
        }
      }
    }

    // bug115927 use original document position for all/any region
View Full Code Here

   */
  protected ContentAssistRequest computeCompletionProposals(String matchString, ITextRegion completionRegion,
      IDOMNode treeNode, IDOMNode xmlnode, CompletionProposalInvocationContext context) {

    //be sure to get the super proposals
    ContentAssistRequest request = super.computeCompletionProposals(matchString, completionRegion, treeNode, xmlnode, context);
   
    //calculate JSP specific proposals
    int documentPosition = context.getInvocationOffset();
    IStructuredDocumentRegion sdRegion = ContentAssistUtils.getStructuredDocumentRegion(
        context.getViewer(), documentPosition);

    Document doc = null;
    if (xmlnode != null) {
      if (xmlnode.getNodeType() == Node.DOCUMENT_NODE) {
        doc = (Document) xmlnode;
      } else {
        doc = xmlnode.getOwnerDocument();
      }
    }
    String[] directiveNames = {"page", "include", "taglib"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
   
    ITextRegion prevTextRegion = null;
    try {
      int offset = sdRegion.getStartOffset(completionRegion);
      if(offset > 0) {
        offset--;
      }
      ITypedRegion prevRegion = context.getDocument().getPartition(offset);
      prevTextRegion = sdRegion.getRegionAtCharacterOffset(prevRegion.getOffset());
    } catch(BadLocationException e) {
      //this should never happen
      Logger.logException(e);
    }
   
    // suggest JSP Expression inside of XML comments
    if (completionRegion.getType() == DOMRegionContext.XML_COMMENT_TEXT && !isXMLFormat(doc)) {
      if (request == null) {
        request = new ContentAssistRequest(treeNode, xmlnode, sdRegion,
            completionRegion, documentPosition, 0, ""); //$NON-NLS-1$
      }
      request.addProposal(new CustomCompletionProposal("<%=  %>",//$NON-NLS-1$
          documentPosition, 0, 4,
          JSPEditorPluginImageHelper.getInstance().getImage(JSPEditorPluginImages.IMG_OBJ_TAG_JSP),
          "jsp:expression", null, "&lt;%= %&gt;", XMLRelevanceConstants.R_JSP)); //$NON-NLS-1$ //$NON-NLS-2$
    }
    /* handle proposals in and around JSP_DIRECTIVE_OPEN,
     * JSP_DIRECTIVE_CLOSE (preceded by OPEN) and JSP_DIRECTIVE_NAME
     */
    else if ((completionRegion.getType() == DOMJSPRegionContexts.JSP_DIRECTIVE_OPEN &&
        documentPosition >= sdRegion.getTextEndOffset(completionRegion)) ||
        (completionRegion.getType() == DOMJSPRegionContexts.JSP_DIRECTIVE_NAME &&
            documentPosition <= sdRegion.getTextEndOffset(completionRegion)) ||
        (completionRegion.getType() == DOMJSPRegionContexts.JSP_DIRECTIVE_CLOSE &&
            prevTextRegion != null &&
            prevTextRegion.getType() == DOMJSPRegionContexts.JSP_DIRECTIVE_OPEN &&
            documentPosition <= sdRegion.getTextEndOffset(completionRegion))) {

      if (completionRegion.getType() == DOMJSPRegionContexts.JSP_DIRECTIVE_OPEN ||
          completionRegion.getType() == DOMJSPRegionContexts.JSP_DIRECTIVE_CLOSE) {
       
        if (request == null) {
          request = new ContentAssistRequest(xmlnode, xmlnode, sdRegion,
              completionRegion, documentPosition, 0, matchString);
        }
       
        //determine if there is any part of a directive name already existing
        Iterator regions = sdRegion.getRegions().iterator();
        String nameString = null;
        int begin = request.getReplacementBeginPosition();
        int length = request.getReplacementLength();
        while (regions.hasNext()) {
          ITextRegion region = (ITextRegion) regions.next();
          if (region.getType() == DOMJSPRegionContexts.JSP_DIRECTIVE_NAME) {
            nameString = sdRegion.getText(region);
            begin = sdRegion.getStartOffset(region);
            length = region.getTextLength();
            break;
          }
        }
        if (nameString == null) {
          nameString = ""; //$NON-NLS-1$
        }
       
        /* Suggest the directive names that have been determined to be
         * appropriate based on existing content
         */
        for (int i = 0; i < directiveNames.length; i++) {
          if (directiveNames[i].startsWith(nameString) || documentPosition <= begin) {
            request.addProposal(new CustomCompletionProposal(directiveNames[i], begin,
                length, directiveNames[i].length(),
                JSPEditorPluginImageHelper.getInstance().getImage(JSPEditorPluginImages.IMG_OBJ_TAG_JSP),
                directiveNames[i], null, null, XMLRelevanceConstants.R_JSP));
          }
        }
      }
      // by default, JSP_DIRECTIVE_NAME
      else {
        if (request == null) {
          request = new ContentAssistRequest(xmlnode, xmlnode, sdRegion,
              completionRegion, sdRegion.getStartOffset(completionRegion),
              completionRegion.getTextLength(), matchString);
        }
        //add each of the directive names as a proposal
        for (int i = 0; i < directiveNames.length; i++) {
          if (directiveNames[i].startsWith(matchString)) {
            request.addProposal(new CustomCompletionProposal(
                directiveNames[i], request.getReplacementBeginPosition(),
                request.getReplacementLength(), directiveNames[i].length(),
                JSPEditorPluginImageHelper.getInstance().getImage(JSPEditorPluginImages.IMG_OBJ_TAG_JSP),
                directiveNames[i], null, null, XMLRelevanceConstants.R_JSP));
          }
        }
      }
    }
    else if ((completionRegion.getType() == DOMJSPRegionContexts.JSP_DIRECTIVE_NAME &&
        documentPosition > sdRegion.getTextEndOffset(completionRegion)) ||
        (completionRegion.getType() == DOMJSPRegionContexts.JSP_DIRECTIVE_CLOSE &&
            documentPosition <= sdRegion.getStartOffset(completionRegion))) {
     
      if (request == null) {
        request = computeAttributeProposals(matchString, completionRegion,
            treeNode, xmlnode, context);
      }
    }
    // no name?: <%@ %>
    else if (completionRegion.getType() == DOMJSPRegionContexts.JSP_DIRECTIVE_CLOSE &&
        documentPosition <= sdRegion.getStartOffset(completionRegion)) {
      if (request != null) {
        request = computeAttributeProposals(matchString, completionRegion, treeNode,
            xmlnode, context);
      }
      Iterator regions = sdRegion.getRegions().iterator();
      String nameString = null;
      while (regions.hasNext()) {
        ITextRegion region = (ITextRegion) regions.next();
        if (region.getType() == DOMJSPRegionContexts.JSP_DIRECTIVE_NAME) {
          nameString = sdRegion.getText(region);
          break;
        }
      }
      if (nameString == null) {
        for (int i = 0; i < directiveNames.length; i++) {
          request.addProposal(new CustomCompletionProposal(
              directiveNames[i], request.getReplacementBeginPosition(),
              request.getReplacementLength(), directiveNames[i].length(),
              JSPEditorPluginImageHelper.getInstance().getImage(JSPEditorPluginImages.IMG_OBJ_TAG_JSP),
              directiveNames[i], null, null, XMLRelevanceConstants.R_JSP));
        }
      }
    }
View Full Code Here

      offset += nodeAtOffset.getNodeName().length()+2;
      len -= nodeAtOffset.getNodeName().length()+3;
    }
   
   
    ContentAssistRequest contentAssistRequest = new ContentAssistRequest(nodeAtOffset, node, getStructuredDocumentRegion(documentPosition), completionRegion, offset, len, matchString);
    IContentAssistProposalRecorder recorder = new DefaultContentAssistProposalRecorder(contentAssistRequest);
    IContentAssistContext context = new DefaultContentAssistContext(contentAssistRequest, "xyz", //@TODO
        matchString);   
   
    BeansJavaCompletionUtils.addClassValueProposals(context, recorder, BeansJavaCompletionUtils.FLAG_PACKAGE | BeansJavaCompletionUtils.FLAG_CLASS | BeansJavaCompletionUtils.FLAG_INTERFACE);
    convertProposals(contentAssistRequest.getProposals());
   
    return contentAssistRequest;   
  }
View Full Code Here

  @SuppressWarnings("restriction")
  protected ContentAssistRequest computeDozerPropertyContentProposals(int documentPosition, String matchString, ITextRegion completionRegion, IDOMNode nodeAtOffset, IDOMNode node) {
    int offset = nodeAtOffset.getStartOffset();
    int len = nodeAtOffset.getLength();
   
    ContentAssistRequest contentAssistRequest = new ContentAssistRequest(nodeAtOffset, node, getStructuredDocumentRegion(documentPosition), completionRegion, offset, len, matchString);
   
    IFile file = BeansEditorUtils.getFile(contentAssistRequest);
    IProject project = file.getProject();
    String className = DozerPluginUtils.getMappingClassName(nodeAtOffset.getParentNode());
    IType type = JdtUtils.getJavaType(project, className);
   
    //by default immer this hinzu
    DozerJavaCompletionProposal newProposal = new DozerJavaCompletionProposal(
        "\" this",
        offset,
        len,
        2,
        JavaPluginImages.get(JavaPluginImages.IMG_OBJS_CLASS),
        "this",
        (IContextInformation)null,
        0,
        true,
        null);
    contentAssistRequest.addProposal(newProposal);
   
    DozerPluginUtils.addPropertyNameAttributeValueProposals(contentAssistRequest, matchString, "", type);   
    convertProposals(contentAssistRequest.getProposals());
   
    return contentAssistRequest;   
 
View Full Code Here

  @SuppressWarnings("restriction")
  protected ContentAssistRequest computeDozerMethodContentProposals(int documentPosition, String matchString, ITextRegion completionRegion, IDOMNode nodeAtOffset, IDOMNode node, boolean onlySetter) {
    int offset = nodeAtOffset.getStartOffset()+nodeAtOffset.getNodeName().length()+1;
    int len = nodeAtOffset.getLength()-nodeAtOffset.getNodeName().length()-2;

    ContentAssistRequest contentAssistRequest = new ContentAssistRequest(nodeAtOffset, node, getStructuredDocumentRegion(documentPosition), completionRegion, offset, len, matchString);
    String targetClassName = DozerPluginUtils.getMappingClassName(node);
    addGetterSetterMethodProposals(contentAssistRequest, matchString, targetClassName, onlySetter);
       
    return contentAssistRequest;   
  }
View Full Code Here

  @SuppressWarnings("restriction")
  protected ContentAssistRequest computeDozerBeanContentProposals(int documentPosition, String matchString, ITextRegion completionRegion, IDOMNode nodeAtOffset, IDOMNode node) {
    int offset = nodeAtOffset.getStartOffset()+nodeAtOffset.getNodeName().length()+2;
    int len = nodeAtOffset.getLength()-nodeAtOffset.getNodeName().length()-3;
   
    ContentAssistRequest contentAssistRequest = new ContentAssistRequest(nodeAtOffset, node, getStructuredDocumentRegion(documentPosition), completionRegion, offset, len, matchString);
    IFile file = BeansEditorUtils.getFile(this.fTextViewer.getDocument());
    IBean bean = DozerPluginUtils.getDozerBeanForMappingFile(file);
    IModelElement[] ccwiPropertyMapEntries = DozerPluginUtils.getPossibleCCIMappingForMappingFile(bean);
   
    if (ccwiPropertyMapEntries != null) {
      for (IModelElement beansMapEntry : ccwiPropertyMapEntries) {
        BeansMapEntry entry = (BeansMapEntry)beansMapEntry;
        BeansTypedString key = (BeansTypedString)entry.getKey();
 
        if (key.getString() != null && !key.getString().equals("")) {
          DozerJavaCompletionProposal newProposal = new DozerJavaCompletionProposal(
                                  "\""+key.getString(),
                                  offset,
                                  len,
                                  0,
                                  BeansModelImages.getImage(entry),
                                  key.getString(),
                                  (IContextInformation)null,
                                  0,
                                  true,
                                  bean);
          contentAssistRequest.addProposal(newProposal);
        }
      }
    }
   
    return contentAssistRequest;   
View Full Code Here

  public IContentProposal[] getProposals(String contents, int position) {
    request = null;
    if (getAttribute() != null && getCompletionRegion() != null) {
      int start = input.getStartStructuredDocumentRegion().getStart() + getCompletionRegion().getStart();
      request = new ContentAssistRequest(input, input, input.getStartStructuredDocumentRegion(),
          getCompletionRegion(), start, getCompletionRegion().getLength(), contents);
    }
    else {
      request = new ContentAssistRequest(input, input, input.getStartStructuredDocumentRegion(),
          getCompletionRegion(), position, contents.length(), contents);
    }

    // TODO: define a context and recorder that don't require a request.
    IContentAssistContext context = createContentAssistContext(contents);
View Full Code Here

TOP

Related Classes of org.eclipse.wst.xml.ui.internal.contentassist.ContentAssistRequest

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.