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

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

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

origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui

protected final boolean isImportCompletion() {
  char[] completion= fProposal.getCompletion();
  if (completion.length == 0)
    return false;
  char last= completion[completion.length - 1];
  /*
   * Proposals end in a semicolon when completing types in normal imports or when completing
   * static members, in a period when completing types in static imports.
   */
  return last == ';' || last == '.';
}
origin: eclipse/eclipse.jdt.ls

private boolean isImportCompletion(CompletionProposal proposal) {
  char[] completion = proposal.getCompletion();
  if (completion.length == 0) {
    return false;
  }
  char last = completion[completion.length - 1];
  /*
   * Proposals end in a semicolon when completing types in normal imports
   * or when completing static members, in a period when completing types
   * in static imports.
   */
  return last == SEMICOLON || last == '.';
}
origin: org.eclipse/org.eclipse.jdt.ui

protected final boolean isImportCompletion() {
  char[] completion= fProposal.getCompletion();
  if (completion.length == 0)
    return false;
  
  char last= completion[completion.length - 1];
  /*
   * Proposals end in a semicolon when completing types in normal imports or when completing
   * static members, in a period when completing types in static imports.
   */
  return last == ';' || last == '.';
}
origin: eclipse/eclipse.jdt.ls

StringBuilder createSimpleLabel(CompletionProposal proposal) {
  StringBuilder buf= new StringBuilder();
  buf.append(String.valueOf(proposal.getCompletion()));
  return buf;
}
origin: eclipse/eclipse.jdt.ls

private void createSimpleLabelWithType(CompletionProposal proposal, CompletionItem item) {
  StringBuilder nameBuffer= new StringBuilder();
  nameBuffer.append(proposal.getCompletion());
  item.setInsertText(nameBuffer.toString());
  char[] typeName= Signature.getSignatureSimpleName(proposal.getSignature());
  if (typeName.length > 0) {
    nameBuffer.append(VAR_TYPE_SEPARATOR);
    nameBuffer.append(typeName);
  }
  item.setLabel(nameBuffer.toString());
}
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

private IJavaCompletionProposal createKeywordProposal(CompletionProposal proposal) {
  String completion= String.valueOf(proposal.getCompletion());
  int start= proposal.getReplaceStart();
  int length= getLength(proposal);
  String label= fLabelProvider.createSimpleLabel(proposal);
  int relevance= computeRelevance(proposal);
  return new JavaCompletionProposal(completion, start, length, null, label, relevance);
}
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

private IJavaCompletionProposal createKeywordProposal(CompletionProposal proposal) {
  String completion= String.valueOf(proposal.getCompletion());
  int start= proposal.getReplaceStart();
  int length= getLength(proposal);
  StyledString label= fLabelProvider.createSimpleLabel(proposal);
  int relevance= computeRelevance(proposal);
  return new JavaCompletionProposal(completion, start, length, null, label, relevance);
}
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 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.recommenders.completion/rcp

public ProcessableAnonymousTypeCompletionProposal(CompletionProposal coreProposal, JavaCompletionProposal uiProposal,
    JavaContentAssistInvocationContext context) throws JavaModelException {
  super(context.getProject(), context.getCompilationUnit(), context, coreProposal.getReplaceStart(), uiProposal
      .getReplacementLength(), String.valueOf(coreProposal.getCompletion()), uiProposal
      .getStyledDisplayString(), String.valueOf(coreProposal.getDeclarationSignature()), (IType) context
      .getProject().findElement(String.valueOf(coreProposal.getDeclarationKey()), null), uiProposal
      .getRelevance());
  this.coreProposal = coreProposal;
}
origin: org.eclipse.jdt/org.eclipse.jdt.ui

  @Override
  protected IContextInformation computeContextInformation() {
    char[] signature= fProposal.getSignature();
    char[][] typeParameters= Signature.getTypeArguments(signature);
    if (typeParameters.length == 0)
      return super.computeContextInformation();

    ProposalContextInformation contextInformation= new ProposalContextInformation(fProposal);
    if (fContextInformationPosition != 0 && fProposal.getCompletion().length == 0)
      contextInformation.setContextInformationPosition(fContextInformationPosition);
    return contextInformation;

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

private IJavaCompletionProposal createAnnotationAttributeReferenceProposal(CompletionProposal proposal) {
  String displayString= fLabelProvider.createLabelWithTypeAndDeclaration(proposal);
  ImageDescriptor descriptor= fLabelProvider.createMethodImageDescriptor(proposal);
  String completion= String.valueOf(proposal.getCompletion());
  return new JavaCompletionProposal(completion, proposal.getReplaceStart(), getLength(proposal), getImage(descriptor), displayString, computeRelevance(proposal));
}
origin: org.eclipse/org.eclipse.jdt.ui

private IJavaCompletionProposal createPackageProposal(CompletionProposal proposal) {
  String completion= String.valueOf(proposal.getCompletion());
  int start= proposal.getReplaceStart();
  int length= getLength(proposal);
  String label= fLabelProvider.createSimpleLabel(proposal);
  Image image= getImage(fLabelProvider.createPackageImageDescriptor(proposal));
  int relevance= computeRelevance(proposal);
  return new JavaCompletionProposal(completion, start, length, image, label, relevance);
}
origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui

  @Override
  protected IContextInformation computeContextInformation() {
    char[] signature= fProposal.getSignature();
    char[][] typeParameters= Signature.getTypeArguments(signature);
    if (typeParameters.length == 0)
      return super.computeContextInformation();

    ProposalContextInformation contextInformation= new ProposalContextInformation(fProposal);
    if (fContextInformationPosition != 0 && fProposal.getCompletion().length == 0)
      contextInformation.setContextInformationPosition(fContextInformationPosition);
    return contextInformation;

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

private IJavaCompletionProposal createLocalVariableProposal(CompletionProposal proposal) {
  String completion= String.valueOf(proposal.getCompletion());
  int start= proposal.getReplaceStart();
  int length= getLength(proposal);
  Image image= getImage(fLabelProvider.createLocalImageDescriptor(proposal));
  String label= fLabelProvider.createSimpleLabelWithType(proposal);
  int relevance= computeRelevance(proposal);
  final JavaCompletionProposal javaProposal= new JavaCompletionProposal(completion, start, length, image, label, relevance);
  javaProposal.setTriggerCharacters(VAR_TRIGGER);
  return javaProposal;
}
origin: org.eclipse.jdt/org.eclipse.jdt.ui

private IJavaCompletionProposal createLocalVariableProposal(CompletionProposal proposal) {
  String completion= String.valueOf(proposal.getCompletion());
  int start= proposal.getReplaceStart();
  int length= getLength(proposal);
  Image image= getImage(fLabelProvider.createLocalImageDescriptor(proposal));
  StyledString label= fLabelProvider.createSimpleLabelWithType(proposal);
  int relevance= computeRelevance(proposal);
  final JavaCompletionProposal javaProposal= new JavaCompletionProposal(completion, start, length, image, label, relevance);
  javaProposal.setTriggerCharacters(VAR_TRIGGER);
  return javaProposal;
}
origin: org.eclipse.jdt/org.eclipse.jdt.ui

private IJavaCompletionProposal createAnnotationAttributeReferenceProposal(CompletionProposal proposal) {
  StyledString displayString= fLabelProvider.createLabelWithTypeAndDeclaration(proposal);
  ImageDescriptor descriptor= fLabelProvider.createMethodImageDescriptor(proposal);
  String completion= String.valueOf(proposal.getCompletion());
  JavaCompletionProposal javaProposal= new JavaCompletionProposal(completion, proposal.getReplaceStart(), getLength(proposal), getImage(descriptor), displayString, computeRelevance(proposal));
  if (fJavaProject != null)
    javaProposal.setProposalInfo(new AnnotationAtttributeProposalInfo(fJavaProject, proposal));
  return javaProposal;
}
origin: org.eclipse.jdt/org.eclipse.jdt.ui

StyledString createSimpleLabelWithType(CompletionProposal proposal) {
  StyledString buf= new StyledString();
  buf.append(proposal.getCompletion());
  char[] typeName= Signature.getSignatureSimpleName(proposal.getSignature());
  if (typeName.length > 0) {
    buf.append(VAR_TYPE_SEPARATOR);
    buf.append(typeName);
  }
  return Strings.markJavaElementLabelLTR(buf);
}
org.eclipse.jdt.coreCompletionProposalgetCompletion

Javadoc

Returns the proposed sequence of characters to insert into the source file buffer, replacing the characters at the specified source range. The string can be arbitrary; for example, it might include not only the name of a method but a set of parentheses.

The client must not modify the array returned.

Popular methods of CompletionProposal

  • getKind
    Returns the kind of completion being proposed. The set of different kinds of completion proposals is
  • 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
  • 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

  • Finding current android device location
  • getResourceAsStream (ClassLoader)
  • setContentView (Activity)
  • getSharedPreferences (Context)
  • InputStreamReader (java.io)
    A class for turning a byte stream into a character stream. Data read from the source input stream is
  • Date (java.util)
    A specific moment in time, with millisecond precision. Values typically come from System#currentTime
  • TimeZone (java.util)
    TimeZone represents a time zone offset, and also figures out daylight savings. Typically, you get a
  • ThreadPoolExecutor (java.util.concurrent)
    An ExecutorService that executes each submitted task using one of possibly several pooled threads, n
  • ReentrantLock (java.util.concurrent.locks)
    A reentrant mutual exclusion Lock with the same basic behavior and semantics as the implicit monitor
  • Pattern (java.util.regex)
    Patterns are compiled regular expressions. In many cases, convenience methods such as String#matches
  • From CI to AI: The AI layer in your organization
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