Examples of CustomCompletionProposal


Examples of org.eclipse.wst.sse.ui.internal.contentassist.CustomCompletionProposal

      e.printStackTrace();
    }

    for (int i = 0; i < propList.size(); i++) {
      PropertyItem message = (PropertyItem) propList.get(i);
      CustomCompletionProposal each = new CustomCompletionProposal(
          prefix + message.key + suffix, offset, replacementLength,
          cursorPosition, image, message.key, null, "Message key: "+message.key+" with value: " + message.value, 1);
      completionList.add(each);
    }
    return completionList;
View Full Code Here

Examples of org.eclipse.wst.sse.ui.internal.contentassist.CustomCompletionProposal

      CompletionProposalInvocationContext context){
    System.out.println("=======================addTapestryELProposals===========================");   
    List results = tapestryELProposalComputer.computeCompletionProposals(TapestryContants.PREFIX_PROP, context, treeNode, 5);
    results.addAll(tapestryMessageProposalComputer.computeCompletionProposals(TapestryContants.PREFIX_MESSAGE, context, treeNode, 8));
    for(int i=0; i< results.size(); i++){
      CustomCompletionProposal proposal = (CustomCompletionProposal) results.get(i);
      contentAssistRequest.addProposal(proposal);
    }
    //addTemplates(contentAssistRequest, TemplateContextTypeIdsXML.TAPESTRY_ENTITIES, context);
  }
View Full Code Here

Examples of org.eclipse.wst.sse.ui.internal.contentassist.CustomCompletionProposal

      ContentAssistRequest contentAssistRequest,
      ITextRegion completionRegion, IDOMNode treeNode,
      CompletionProposalInvocationContext context){ 
    List results = tapestryMessageProposalComputer.computeCompletionProposals(TapestryContants.PREFIX_BLANK, context, treeNode, 0);
    for(int i=0; i< results.size(); i++){
      CustomCompletionProposal proposal = (CustomCompletionProposal) results.get(i);
      contentAssistRequest.addProposal(proposal);
    }
  }
View Full Code Here

Examples of org.eclipse.wst.sse.ui.internal.contentassist.CustomCompletionProposal

      ContentAssistRequest contentAssistRequest,
      ITextRegion completionRegion, IDOMNode treeNode,
      CompletionProposalInvocationContext context) {
    List results = tapestryELProposalComputer.computeCompletionProposals(TapestryContants.PREFIX_BLANK, context, treeNode, 0);
    for(int i=0; i< results.size(); i++){
      CustomCompletionProposal proposal = (CustomCompletionProposal) results.get(i);
      contentAssistRequest.addProposal(proposal);
    }
  }
View Full Code Here

Examples of org.eclipse.wst.sse.ui.internal.contentassist.CustomCompletionProposal

                }
              }
 
              String proposedText = null;
              String proposedInfo = getAdditionalInfo(elementDecl, attrDecl);
              CustomCompletionProposal proposal = null;
              // attribute is at this location and already exists
              if (attrAtLocationHasValue) {
                // only propose the name
                proposedText = getRequiredName(node, attrDecl);
                proposal = new MarkupCompletionProposal(
View Full Code Here

Examples of org.eclipse.wst.sse.ui.internal.contentassist.CustomCompletionProposal

            if(!possibleValue.equals(defaultValue)) {
              currentValid = currentValid || possibleValue.equals(currentValue);
              if ((matchString.length() == 0) || possibleValue.startsWith(matchString)) {
                String rString = "\"" + possibleValue + "\""; //$NON-NLS-1$ //$NON-NLS-2$
                alternateMatch = "\"" + alternateMatch; //$NON-NLS-1$
                CustomCompletionProposal proposal = new MarkupCompletionProposal(
                    rString, rOffset, rLength, possibleValue.length() + 1,
                    XMLEditorPluginImageHelper.getInstance().getImage(XMLEditorPluginImages.IMG_OBJ_ENUM),
                    rString, alternateMatch, null, proposedInfo, XMLRelevanceConstants.R_XML_ATTRIBUTE_VALUE, true);
                contentAssistRequest.addProposal(proposal);
              }
            }
          }
          if(defaultValue != null && ((matchString.length() == 0) || defaultValue.startsWith(matchString))) {
            String rString = "\"" + defaultValue + "\""; //$NON-NLS-1$ //$NON-NLS-2$
            CustomCompletionProposal proposal = new MarkupCompletionProposal(
                rString, rOffset, rLength, defaultValue.length() + 1,
                XMLEditorPluginImageHelper.getInstance().getImage(XMLEditorPluginImages.IMG_OBJ_DEFAULT),
                rString, null, proposedInfo, XMLRelevanceConstants.R_XML_ATTRIBUTE_VALUE);
            contentAssistRequest.addProposal(proposal);
          }
        }
        else if (((attrDecl.getUsage() == CMAttributeDeclaration.FIXED) ||
            (attrDecl.getAttrType().getImpliedValueKind() == CMDataType.IMPLIED_VALUE_FIXED)) &&
            (attrDecl.getAttrType().getImpliedValue() != null)) {
         
          // FIXED values
          String value = attrDecl.getAttrType().getImpliedValue();
          if ((value != null) && (value.length() > 0)) {
            String rValue = "\"" + value + "\"";//$NON-NLS-2$//$NON-NLS-1$
            CustomCompletionProposal proposal = new MarkupCompletionProposal(
                rValue, contentAssistRequest.getReplacementBeginPosition(),
                contentAssistRequest.getReplacementLength(), rValue.length() + 1,
                image, rValue, null, proposedInfo,
                XMLRelevanceConstants.R_XML_ATTRIBUTE_VALUE);
            contentAssistRequest.addProposal(proposal);
            if ((currentValue.length() > 0) && !value.equals(currentValue)) {
              rValue = "\"" + currentValue + "\""; //$NON-NLS-2$//$NON-NLS-1$
              proposal = new MarkupCompletionProposal(rValue, contentAssistRequest.getReplacementBeginPosition(), contentAssistRequest.getReplacementLength(), rValue.length() + 1, image, rValue, null, proposedInfo, XMLRelevanceConstants.R_XML_ATTRIBUTE_VALUE);
              contentAssistRequest.addProposal(proposal);
            }
          }
        }
      }
      else {
        // unknown attribute, so supply nice empty values
        proposedInfo = getAdditionalInfo(null, elementDecl);
        CustomCompletionProposal proposal = null;
        if ((currentValue != null) && (currentValue.length() > 0)) {
          String rValue = "\"" + currentValue + "\""; //$NON-NLS-2$//$NON-NLS-1$
          proposal = new MarkupCompletionProposal(rValue,
              contentAssistRequest.getReplacementBeginPosition(),
              contentAssistRequest.getReplacementLength(), 1, image,
View Full Code Here

Examples of org.eclipse.wst.sse.ui.internal.contentassist.CustomCompletionProposal

 
  protected void addCommentProposal(
      ContentAssistRequest contentAssistRequest,
      CompletionProposalInvocationContext context) {
   
    contentAssistRequest.addProposal(new CustomCompletionProposal("<!--  -->", //$NON-NLS-1$
        contentAssistRequest.getReplacementBeginPosition(),
        contentAssistRequest.getReplacementLength(), 5,
        XMLEditorPluginImageHelper.getInstance().getImage(XMLEditorPluginImages.IMG_OBJ_COMMENT),
        NLS.bind(XMLUIMessages.Comment__, (new Object[]{" <!--  -->"})), //$NON-NLS-1$
        null, null, XMLRelevanceConstants.R_COMMENT));
View Full Code Here

Examples of org.eclipse.wst.sse.ui.internal.contentassist.CustomCompletionProposal

   */
  protected void addEndTagNameProposals(ContentAssistRequest contentAssistRequest,
      CompletionProposalInvocationContext context) {

    if (contentAssistRequest.getStartOffset() + contentAssistRequest.getRegion().getTextLength() < contentAssistRequest.getReplacementBeginPosition()) {
      CustomCompletionProposal proposal = new MarkupCompletionProposal(">", //$NON-NLS-1$
            contentAssistRequest.getReplacementBeginPosition(), contentAssistRequest.getReplacementLength(), 1, XMLEditorPluginImageHelper.getInstance().getImage(XMLEditorPluginImages.IMG_OBJ_TAG_GENERIC), NLS.bind(XMLUIMessages.Close_with__, (new Object[]{" '>'"})), //$NON-NLS-1$
            null, null, XMLRelevanceConstants.R_END_TAG_NAME);
      contentAssistRequest.addProposal(proposal);
    }
    else {
      Node aNode = contentAssistRequest.getNode();
      String matchString = contentAssistRequest.getMatchString();
      if (matchString.startsWith("</")) { //$NON-NLS-1$
        matchString = matchString.substring(2);
      }
      while (aNode != null) {
        if (aNode.getNodeType() == Node.ELEMENT_NODE) {
          if (aNode.getNodeName().startsWith(matchString)) {
            IDOMNode aXMLNode = (IDOMNode) aNode;
            CMElementDeclaration ed = getCMElementDeclaration(aNode);
            //declaration must be valid for this computer to make proposal
            if ((aXMLNode.getEndStructuredDocumentRegion() == null) && (ed == null || (validModelQueryNode(ed) && ed.getContentType() != CMElementDeclaration.EMPTY))) {
              String replacementText = aNode.getNodeName();
              String displayText = replacementText;
              String proposedInfo = (ed != null) ? getAdditionalInfo(null, ed) : null;
              if(!contentAssistRequest.getDocumentRegion().isEnded()) {
                replacementText += ">"; //$NON-NLS-1$
              }
              CustomCompletionProposal proposal = null;
              // double check to see if the region acted upon is
              // a tag name; replace it if so
              Image image = CMImageUtil.getImage(ed);
              if (image == null) {
                image = this.getGenericTagImage();
View Full Code Here

Examples of org.eclipse.wst.sse.ui.internal.contentassist.CustomCompletionProposal

    // ////////////////////////////////////////////////////////////////////////////////////
    else if (node.getNodeType() == Node.DOCUMENT_NODE) {
      setErrorMessage(XMLUIMessages.Content_Assist_not_availab_UI_);
    }
    if (addProposal == true) {
      CustomCompletionProposal proposal = new MarkupCompletionProposal(replaceText, replaceBegin, replaceLength, cursorOffset, image, displayString, null, proposedInfo, XMLRelevanceConstants.R_END_TAG);
      contentAssistRequest.addProposal(proposal);
    }
  }
View Full Code Here

Examples of org.eclipse.wst.sse.ui.internal.contentassist.CustomCompletionProposal

          selectionLength += context.getViewer().getSelectedRange().y;
        }
        // create a new proposal for entity string...
        replacementText = "&" + entityName + ";"; //$NON-NLS-1$ //$NON-NLS-2$
        displayString = "&" + entityName + "; (" + entityValue + ")"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
        ICompletionProposal cp = new CustomCompletionProposal(replacementText, sdRegion.getStartOffset(completionRegion), selectionLength, replacementText.length(), entityIcon, displayString, null, null, XMLRelevanceConstants.R_ENTITY);
        if (cp != null) {
          proposals.add(cp);
        }
      }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.