Tabnine Logo
CompletionProposal.getKind
Code IndexAdd Tabnine to your IDE (free)

How to use
getKind
method
in
org.eclipse.jdt.core.CompletionProposal

Best Java code snippets using org.eclipse.jdt.core.CompletionProposal.getKind (Showing top 20 results out of 315)

origin: eclipse/eclipse.jdt.ls

private boolean isSupportingRequiredProposals(CompletionProposal proposal) {
  return proposal != null
      && (proposal.getKind() == CompletionProposal.METHOD_REF
      || proposal.getKind() == CompletionProposal.FIELD_REF
      || proposal.getKind() == CompletionProposal.TYPE_REF
          || proposal.getKind() == CompletionProposal.CONSTRUCTOR_INVOCATION || proposal.getKind() == CompletionProposal.ANONYMOUS_CLASS_CONSTRUCTOR_INVOCATION
          || proposal.getKind() == CompletionProposal.ANONYMOUS_CLASS_DECLARATION);
}
origin: eclipse/eclipse.jdt.ls

  private String getProposal(CompletionProposal proposal) {
    try {
      for (Field field : CompletionProposal.class.getDeclaredFields()) {
        if (int.class.equals(field.getType()) && Integer.valueOf(proposal.getKind()).equals(field.get(null))) {
          return field.getName();
        }
      }
    } catch (Exception e) {
    }
    return "unknown";
  }
}
origin: org.eclipse/org.eclipse.jdt.ui

protected char[] computeTriggerCharacters() {
  if (fProposal.getKind() == CompletionProposal.METHOD_NAME_REFERENCE)
    return METHOD_NAME_TRIGGERS;
  if (hasParameters())
    return METHOD_WITH_ARGUMENTS_TRIGGERS;
  return METHOD_TRIGGERS;
}

origin: eclipse/eclipse.jdt.ls

protected boolean hasArgumentList(CompletionProposal proposal) {
  if (CompletionProposal.METHOD_NAME_REFERENCE == proposal.getKind()) {
    return false;
  }
  char[] completion= proposal.getCompletion();
  return !isInJavadoc() && completion.length > 0 && completion[completion.length - 1] == RPAREN;
}
origin: org.eclipse/org.eclipse.jdt.ui

/**
 * Creates the context information for a given method reference proposal.
 * The passed proposal must be of kind {@link CompletionProposal#METHOD_REF}.
 *
 * @param methodProposal the method proposal for which to create context information
 * @return the context information for <code>methodProposal</code>
 */
protected final IContextInformation createMethodContextInformation(CompletionProposal methodProposal) {
  Assert.isTrue(methodProposal.getKind() == CompletionProposal.METHOD_REF);
  return new ProposalContextInformation(methodProposal);
}
origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui

/**
 * Creates the context information for a given method reference proposal.
 * The passed proposal must be of kind {@link CompletionProposal#METHOD_REF}.
 *
 * @param methodProposal the method proposal for which to create context information
 * @return the context information for <code>methodProposal</code>
 */
protected final IContextInformation createMethodContextInformation(CompletionProposal methodProposal) {
  Assert.isTrue(methodProposal.getKind() == CompletionProposal.METHOD_REF);
  return new ProposalContextInformation(methodProposal);
}
origin: org.eclipse.jdt/org.eclipse.jdt.ui

/**
 * Creates the context information for a given method reference proposal.
 * The passed proposal must be of kind {@link CompletionProposal#METHOD_REF}.
 *
 * @param methodProposal the method proposal for which to create context information
 * @return the context information for <code>methodProposal</code>
 */
protected final IContextInformation createMethodContextInformation(CompletionProposal methodProposal) {
  Assert.isTrue(methodProposal.getKind() == CompletionProposal.METHOD_REF);
  return new ProposalContextInformation(methodProposal);
}
origin: org.eclipse.jdt/org.eclipse.jdt.ui

@Override
public CharSequence getPrefixCompletionText(IDocument document, int completionOffset) {
  CompletionProposal coreProposal= ((MemberProposalInfo)getProposalInfo()).fProposal;
  if (coreProposal.getKind() != CompletionProposal.ANONYMOUS_CLASS_CONSTRUCTOR_INVOCATION)
    return super.getPrefixCompletionText(document, completionOffset);
  return String.valueOf(coreProposal.getName());
}
origin: org.eclipse.jdt/org.eclipse.jdt.ui

@Override
protected boolean isPrefix(String prefix, String string) {
  if (fProposal.getKind() == CompletionProposal.METHOD_REF_WITH_CASTED_RECEIVER && prefix != null)
    prefix= prefix.substring(fProposal.getReceiverEnd() - fProposal.getReceiverStart() + 1);
  return super.isPrefix(prefix, string);
}
origin: eclipse/eclipse.jdt.ls

@Override
public void accept(CompletionProposal proposal) {
  if (!isIgnored(proposal.getKind())) {
    if (proposal.getKind() == CompletionProposal.PACKAGE_REF && unit.getParent() != null && String.valueOf(proposal.getCompletion()).equals(unit.getParent().getElementName())) {
      // Hacky way to boost relevance of current package, for package completions, until
      // https://bugs.eclipse.org/518140 is fixed
      proposal.setRelevance(proposal.getRelevance() + 1);
    }
    proposals.add(proposal);
  }
}
origin: org.eclipse.jdt/org.eclipse.jdt.ui

StyledString createModuleProposalLabel(CompletionProposal proposal) {
  int kind= proposal.getKind();
  Assert.isTrue(kind == CompletionProposal.MODULE_REF || kind == CompletionProposal.MODULE_DECLARATION);
  char[] label= proposal.getDeclarationSignature();
  Assert.isNotNull(label);
  return Strings.markJavaElementLabelLTR(new StyledString(String.valueOf(label)));
}
origin: org.eclipse.jdt/org.eclipse.jdt.ui

@Override
protected IContextInformation computeContextInformation() {
  // no context information for METHOD_NAME_REF proposals (e.g. for static imports)
  // https://bugs.eclipse.org/bugs/show_bug.cgi?id=94654
  if ((fProposal.getKind() == CompletionProposal.METHOD_REF || fProposal.getKind() == CompletionProposal.CONSTRUCTOR_INVOCATION) && hasParameters()
      && (getReplacementString().endsWith(RPAREN) || getReplacementString().endsWith(SEMICOLON) || getReplacementString().length() == 0)) {
    ProposalContextInformation contextInformation= new ProposalContextInformation(fProposal);
    if (fContextInformationPosition != 0 && fProposal.getCompletion().length == 0)
      contextInformation.setContextInformationPosition(fContextInformationPosition);
    return contextInformation;
  }
  return super.computeContextInformation();
}
origin: org.eclipse.jdt/org.eclipse.jdt.ui

@Override
protected boolean isOffsetValid(int offset) {
  if (fProposal.getKind() != CompletionProposal.CONSTRUCTOR_INVOCATION)
    return super.isOffsetValid(offset);
  return fProposal.getRequiredProposals()[0].getReplaceStart() <= offset;
}
origin: org.eclipse/org.eclipse.jdt.ui

protected IJavaCompletionProposal createJavaCompletionProposal(CompletionProposal proposal) {
  switch (proposal.getKind()) {
    case CompletionProposal.METHOD_REF:
      return createMethodReferenceProposal(proposal);
    case CompletionProposal.TYPE_REF:
      return createTypeProposal(proposal);
    default:
      return super.createJavaCompletionProposal(proposal);
  }
}
origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui

@Override
protected boolean isValidPrefix(String prefix) {
  CompletionProposal coreProposal= ((MemberProposalInfo)getProposalInfo()).fProposal;
  if (coreProposal.getKind() != CompletionProposal.ANONYMOUS_CLASS_CONSTRUCTOR_INVOCATION)
    return super.isValidPrefix(prefix);
  return super.isValidPrefix(prefix) || isPrefix(prefix, String.valueOf(coreProposal.getName()));
}
origin: eclipse/eclipse.jdt.ls

@Override
public void accept(CompletionProposal proposal) {
  if (proposal.getKind() == CompletionProposal.TYPE_REF) {
    addType(proposal.getSignature(), proposal.getFlags(), proposal.getRelevance());
  }
}
origin: org.eclipse.jdt/org.eclipse.jdt.ui

@Override
protected boolean isValidPrefix(String prefix) {
  CompletionProposal coreProposal= ((MemberProposalInfo)getProposalInfo()).fProposal;
  if (coreProposal.getKind() != CompletionProposal.ANONYMOUS_CLASS_CONSTRUCTOR_INVOCATION)
    return super.isValidPrefix(prefix);
  return super.isValidPrefix(prefix) || isPrefix(prefix, String.valueOf(coreProposal.getName()));
}
origin: org.eclipse/org.eclipse.jdt.ui

protected IContextInformation computeContextInformation() {
  // no context information for METHOD_NAME_REF proposals (e.g. for static imports)
  // https://bugs.eclipse.org/bugs/show_bug.cgi?id=94654
  if (fProposal.getKind() == CompletionProposal.METHOD_REF &&  hasParameters() && (getReplacementString().endsWith(RPAREN) || getReplacementString().length() == 0)) {
    ProposalContextInformation contextInformation= new ProposalContextInformation(fProposal);
    if (fContextInformationPosition != 0 && fProposal.getCompletion().length == 0)
      contextInformation.setContextInformationPosition(fContextInformationPosition);
    return contextInformation;
  }
  return super.computeContextInformation();
}

origin: org.eclipse.jdt/org.eclipse.jdt.ui

@Override
protected boolean isOffsetValid(int offset) {
  CompletionProposal coreProposal= ((MemberProposalInfo)getProposalInfo()).fProposal;
  if (coreProposal.getKind() != CompletionProposal.ANONYMOUS_CLASS_CONSTRUCTOR_INVOCATION)
    return super.isOffsetValid(offset);
  return coreProposal.getRequiredProposals()[0].getReplaceStart() <= offset;
}
origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui

@Override
public CharSequence getPrefixCompletionText(IDocument document, int completionOffset) {
  if (hasArgumentList() || fProposal.getKind() == CompletionProposal.CONSTRUCTOR_INVOCATION) {
    String completion= String.valueOf(fProposal.getName());
    if (isCamelCaseMatching()) {
      String prefix= getPrefix(document, completionOffset);
      return getCamelCaseCompound(prefix, completion);
    }
    return completion;
  }
  return super.getPrefixCompletionText(document, completionOffset);
}
org.eclipse.jdt.coreCompletionProposalgetKind

Javadoc

Returns the kind of completion being proposed.

The set of different kinds of completion proposals is expected to change over time. It is strongly recommended that clients do not assume that the kind is one of the ones they know about, and code defensively for the possibility of unexpected future growth.

Popular methods of CompletionProposal

  • getName
    Returns the simple name of the method, field, member, or variable relevant in the context, ornull if
  • getSignature
    Returns the signature of the method or type relevant in the context, or null if none. This field is
  • findParameterNames
    Finds the method parameter names. This information is relevant to method reference (and method decla
  • getCompletion
    Returns the proposed sequence of characters to insert into the source file buffer, replacing the cha
  • getDeclarationSignature
    Returns the type signature or package name of the relevant declaration in the context, or null if no
  • getReplaceStart
    Returns the character index of the start of the subrange in the source file buffer to be replaced by
  • create
    Creates a basic completion proposal. All instance field have plausible default values unless otherwi
  • getDeclarationKey
    Returns the key of the relevant declaration in the context, or null if none. This field is availabl
  • getRelevance
    Returns the relative relevance rating of this proposal.
  • getReplaceEnd
    Returns the character index of the end of the subrange in the source file buffer to be replaced by t
  • getCompletionLocation
    Returns the character index in the source file buffer where source completion was requested (theoffs
  • getFlags
    Returns the modifier flags relevant in the context, orFlags.AccDefault if none. This field is avail
  • getCompletionLocation,
  • getFlags,
  • getRequiredProposals,
  • setCompletion,
  • setDeclarationSignature,
  • setRelevance,
  • setReplaceRange,
  • setSignature,
  • setFlags

Popular in Java

  • Running tasks concurrently on multiple threads
  • notifyDataSetChanged (ArrayAdapter)
  • getSystemService (Context)
  • setScale (BigDecimal)
  • Color (java.awt)
    The Color class is used to encapsulate colors in the default sRGB color space or colors in arbitrary
  • FileReader (java.io)
    A specialized Reader that reads from a file in the file system. All read requests made by calling me
  • PrintStream (java.io)
    Fake signature of an existing Java class.
  • Permission (java.security)
    Legacy security code; do not use.
  • ConcurrentHashMap (java.util.concurrent)
    A plug-in replacement for JDK1.5 java.util.concurrent.ConcurrentHashMap. This version is based on or
  • XPath (javax.xml.xpath)
    XPath provides access to the XPath evaluation environment and expressions. Evaluation of XPath Expr
  • Best IntelliJ plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now