Package org.eclipse.jface.text.contentassist

Examples of org.eclipse.jface.text.contentassist.CompletionProposal


        List<ICompletionProposal> result = new LinkedList<ICompletionProposal>();

        String suggestedVersion = marker.getAttribute(PROP_SUGGESTED_VERSION, null);
        int start = marker.getAttribute(IMarker.CHAR_START, 0);
        int end = marker.getAttribute(IMarker.CHAR_END, 0);
        CompletionProposal proposal = new CompletionProposal(Constants.BUNDLE_VERSION + ": " + suggestedVersion, start, end - start, end, null, "Change bundle version to " + suggestedVersion, null, null);
        result.add(proposal);

        return result;
    }
View Full Code Here


                if (o instanceof OtpErlangString) {
                    final OtpErlangString s = (OtpErlangString) o;
                    final String suffix = includes ? "" : ":";
                    final String cpl = quoted(s.stringValue() + suffix, kind);
                    final int prefixLength = prefix.length();
                    result.add(new CompletionProposal(cpl, offset - prefixLength,
                            prefixLength, cpl.length()));
                }
            }
        }
        return result;
View Full Code Here

            final int prefixLength = prefix.length();
            final String src = doc.get(o, offset - o - prefixLength);
            final Collection<String> vars = ErlangEngine.getInstance()
                    .getContextAssistService().getVariables(src, prefix);
            for (final String var : vars) {
                result.add(new CompletionProposal(var, offset - prefixLength,
                        prefixLength, var.length()));
            }
        }
        return result;
    }
View Full Code Here

    private void addIfMatches(final String name, final String prefix, final int offset,
            final List<ICompletionProposal> result) {
        final int length = prefix.length();
        if (name.regionMatches(true, 0, prefix, 0, length)) {
            result.add(new CompletionProposal(name, offset - length, length, name
                    .length()));
        }
    }
View Full Code Here

    List<ICompletionProposal> getTypeCompletions(final IOtpRpc backend,
            final String moduleOrRecord, final int offset, final String prefix) {
        final List<ICompletionProposal> result = new ArrayList<ICompletionProposal>();
        for (final String builtin : getBuiltinTypeCompletions()) {
            if (builtin.startsWith(prefix.trim())) {
                result.add(new CompletionProposal(builtin, offset - prefix.length(),
                        prefix.length(), builtin.length()));
            }
        }
        // TODO provide types completions from workspace
        return result;
View Full Code Here

        ICompletionProposalExtension4 {

    CompletionProposal delegate;

    public DummyCompletionProposal(final int offset) {
        delegate = new CompletionProposal("", 0, 0, offset, null,
                "No completion proposal available", null, null);
    }
View Full Code Here

  public ICompletionProposal[] computeQuickAssistProposals(IQuickAssistInvocationContext invocationContext) {
    ArrayList proposals = new ArrayList();

    switch (fProblemId) {
      case ProblemIDsXML.EmptyTag :
        proposals.add(new CompletionProposal("", invocationContext.getOffset(), invocationContext.getLength(), 0, getImage(), XMLUIMessages.QuickFixProcessorXML_0, null, "")); //$NON-NLS-1$ //$NON-NLS-2$
        break;
      case ProblemIDsXML.MissingEndTag :
        String tagName = (String) ((Object[]) fAdditionalFixInfo)[0];
        String tagClose = (String) ((Object[]) fAdditionalFixInfo)[1];
        int tagCloseOffset = ((Integer) ((Object[]) fAdditionalFixInfo)[2]).intValue();
        int startTagEndOffset = ((Integer) ((Object[]) fAdditionalFixInfo)[3]).intValue();
        int firstChildStartOffset = ((Integer) ((Object[]) fAdditionalFixInfo)[4]).intValue();
        int endOffset = ((Integer) ((Object[]) fAdditionalFixInfo)[5]).intValue();
        proposals.add(new CompletionProposal(tagClose, tagCloseOffset, 0, 0, getImage(), XMLUIMessages.QuickFixProcessorXML_1, null, "")); //$NON-NLS-1$
        proposals.add(new CompletionProposal("", invocationContext.getOffset(), startTagEndOffset - invocationContext.getOffset(), 0, getImage(), XMLUIMessages.QuickFixProcessorXML_2, null, "")); //$NON-NLS-1$ //$NON-NLS-2$
        proposals.add(new CompletionProposal("</" + tagName + ">", firstChildStartOffset, 0, 0, getImage(), XMLUIMessages.QuickFixProcessorXML_3, null, "")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
        proposals.add(new CompletionProposal("</" + tagName + ">", endOffset, 0, 0, getImage(), XMLUIMessages.QuickFixProcessorXML_4, null, "")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
        break;
      case ProblemIDsXML.AttrsInEndTag :
        proposals.add(new CompletionProposal("", invocationContext.getOffset(), invocationContext.getLength(), 0, getImage(), XMLUIMessages.QuickFixProcessorXML_5, null, "")); //$NON-NLS-1$ //$NON-NLS-2$
        break;
      case ProblemIDsXML.MissingAttrValue :
        String defaultAttrValue = (String) ((Object[]) fAdditionalFixInfo)[0];
        int insertOffset = ((Integer) ((Object[]) fAdditionalFixInfo)[1]).intValue();
        proposals.add(new CompletionProposal("\"" + defaultAttrValue + "\"", invocationContext.getOffset() + invocationContext.getLength() + insertOffset, 0, defaultAttrValue.length() + 2, getImage(), XMLUIMessages.QuickFixProcessorXML_6, null, "")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
        proposals.add(new CompletionProposal("", invocationContext.getOffset(), invocationContext.getLength(), 0, getImage(), XMLUIMessages.QuickFixProcessorXML_7, null, "")); //$NON-NLS-1$ //$NON-NLS-2$
        break;
      case ProblemIDsXML.NoAttrValue :
        defaultAttrValue = (String) fAdditionalFixInfo;
        proposals.add(new CompletionProposal("=\"" + defaultAttrValue + "\"", invocationContext.getOffset() + invocationContext.getLength(), 0, defaultAttrValue.length() + 3, getImage(), XMLUIMessages.QuickFixProcessorXML_6, null, "")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
        proposals.add(new CompletionProposal("", invocationContext.getOffset(), invocationContext.getLength(), 0, getImage(), XMLUIMessages.QuickFixProcessorXML_7, null, "")); //$NON-NLS-1$ //$NON-NLS-2$
        break;
      case ProblemIDsXML.SpacesBeforeTagName :
        proposals.add(new CompletionProposal("", invocationContext.getOffset(), invocationContext.getLength(), 0, getImage(), XMLUIMessages.QuickFixProcessorXML_8, null, "")); //$NON-NLS-1$ //$NON-NLS-2$
        break;
      case ProblemIDsXML.SpacesBeforePI :
        proposals.add(new CompletionProposal("", invocationContext.getOffset(), invocationContext.getLength(), 0, getImage(), XMLUIMessages.QuickFixProcessorXML_9, null, "")); //$NON-NLS-1$ //$NON-NLS-2$
        break;
      case ProblemIDsXML.NamespaceInPI :
        proposals.add(new CompletionProposal("", invocationContext.getOffset(), invocationContext.getLength(), 0, getImage(), XMLUIMessages.QuickFixProcessorXML_10, null, "")); //$NON-NLS-1$ //$NON-NLS-2$
        break;
      case ProblemIDsXML.UnknownElement :
        proposals.add(new RemoveUnknownElementQuickFixProposal(fAdditionalFixInfo, getImage(), XMLUIMessages.QuickFixProcessorXML_11));
        proposals.add(new RenameInFileQuickAssistProposal());
        break;
      case ProblemIDsXML.UnknownAttr :
        proposals.add(new CompletionProposal("", invocationContext.getOffset(), invocationContext.getLength(), 0, getImage(), XMLUIMessages.QuickFixProcessorXML_7, null, "")); //$NON-NLS-1$ //$NON-NLS-2$
        proposals.add(new RenameInFileQuickAssistProposal());
        break;
      case ProblemIDsXML.InvalidAttrValue :
        proposals.add(new CompletionProposal("", invocationContext.getOffset(), invocationContext.getLength(), 0, getImage(), XMLUIMessages.QuickFixProcessorXML_12, null, "")); //$NON-NLS-1$ //$NON-NLS-2$
        break;
      case ProblemIDsXML.MissingRequiredAttr :
        String requiredAttr = (String) ((Object[]) fAdditionalFixInfo)[0];
        insertOffset = ((Integer) ((Object[]) fAdditionalFixInfo)[1]).intValue();
        proposals.add(new CompletionProposal(requiredAttr, invocationContext.getOffset() + insertOffset, 0, requiredAttr.length(), getImage(), XMLUIMessages.QuickFixProcessorXML_13, null, "")); //$NON-NLS-1$
        break;
      case ProblemIDsXML.AttrValueNotQuoted :
        String attrValue = (String) fAdditionalFixInfo;
        proposals.add(new CompletionProposal("\"" + attrValue + "\"", invocationContext.getOffset(), invocationContext.getLength(), attrValue.length() + 2, getImage(), XMLUIMessages.QuickFixProcessorXML_14, null, "")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
        break;
      case ProblemIDsXML.MissingClosingBracket :
        proposals.add(new CompletionProposal(">", invocationContext.getOffset() + invocationContext.getLength(), 0, 1, getImage(), XMLUIMessages.QuickFixProcessorXML_15, null, "")); //$NON-NLS-1$ //$NON-NLS-2$
        break;
    }
    return (ICompletionProposal[]) proposals.toArray(new ICompletionProposal[proposals.size()]);
  }
View Full Code Here

      descr = "Django template filter";
    else if (wordType.equals("FORLOOP"))
      descr = "Django loop variable";
    String dispStr = String.format("%s   - %s", keyWord, descr);
    return
      new CompletionProposal(keyWord,   //replacementString
          wordPart.getOffset(),    //replacementOffset the offset of the text to be replaced
          wordPart.getString().length(),   //replacementLength the length of the text to be replaced
          keyWord.length(),       //cursorPosition the position of the cursor following the insert relative to replacementOffset
          null,            //image to display
          dispStr,           //displayString the string to be displayed for the proposal
View Full Code Here

    Image image = registry.get(IDjangoImages.TAG_IMAGE);
    if (partition.equals(IDjangoPartitions.DJANGO_VARIABLE))
      image = registry.get(IDjangoImages.FILTER_IMAGE);
   
    return
      new CompletionProposal(keyWord,   //replacementString
          wordPart.getOffset(),    //replacementOffset the offset of the text to be replaced
          wordPart.getString().length(),   //replacementLength the length of the text to be replaced
          keyWord.length(),       //cursorPosition the position of the cursor following the insert relative to replacementOffset
          image,            //image to display
          dispStr,           //displayString the string to be displayed for the proposal
View Full Code Here

        // convert code completion proposal into eclipse ICompletionProposal
        ICompletionProposal[] ret = new ICompletionProposal[proposals.length];
        for (int i = 0; i < proposals.length; i++) {
            CodeCompletionProposal prop = proposals[i];
            ret[i] = new CompletionProposal(prop.getReplacementString(), prop
                    .getReplacementOffset(), prop.getReplacementLength(), prop.getCursorPosition(),
                    null, prop.getDisplayString(), null, prop.getDoc());
        }

        return ret;
View Full Code Here

TOP

Related Classes of org.eclipse.jface.text.contentassist.CompletionProposal

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.