congrats Icon
New! Announcing our next generation AI code completions
Read here
Tabnine Logo
CompletionProposal.getName
Code IndexAdd Tabnine to your IDE (free)

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

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

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

protected boolean isFiltered(CompletionProposal proposal) {
  if (proposal.getKind() == CompletionProposal.LOCAL_VARIABLE_REF) {
    if (Arrays.equals(proposal.getName(), fgHiddenLocal)) {
      return true;
    }
  }
  return super.isFiltered(proposal);
}
origin: eclipse/eclipse.jdt.ls

  @Override
  public void accept(CompletionProposal proposal) {
    if (elementName.equals(new String(proposal.getName()))) {
      CompletionProposal[] requiredProposals= proposal.getRequiredProposals();
      for (int i= 0; i < requiredProposals.length; i++) {
        CompletionProposal curr= requiredProposals[i];
        if (curr.getKind() == CompletionProposal.METHOD_IMPORT || curr.getKind() == CompletionProposal.FIELD_IMPORT) {
          result.add(JavaModelUtil.concatenateName(Signature.toCharArray(curr.getDeclarationSignature()), curr.getName()));
        }
      }
    }
  }
};
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.scout.sdk.deps/org.eclipse.jdt.ui

  @Override
  public void accept(CompletionProposal proposal) {
    if (elementName.equals(new String(proposal.getName()))) {
      CompletionProposal[] requiredProposals= proposal.getRequiredProposals();
      for (int i= 0; i < requiredProposals.length; i++) {
        CompletionProposal curr= requiredProposals[i];
        if (curr.getKind() == CompletionProposal.METHOD_IMPORT || curr.getKind() == CompletionProposal.FIELD_IMPORT) {
          result.add(JavaModelUtil.concatenateName(Signature.toCharArray(curr.getDeclarationSignature()), curr.getName()));
        }
      }
    }
  }
};
origin: org.eclipse/org.eclipse.jdt.ui

protected String computeSortString() {
  /*
   * Lexicographical sort order:
   * 1) by relevance (done by the proposal sorter)
   * 2) by method name
   * 3) by parameter count
   * 4) by parameter type names
   */
  char[] name= fProposal.getName();
  char[] parameterList= Signature.toCharArray(fProposal.getSignature(), null, null, false, false);
  int parameterCount= Signature.getParameterCount(fProposal.getSignature()) % 10; // we don't care about insane methods with >9 parameters
  StringBuffer buf= new StringBuffer(name.length + 2 + parameterList.length);
  
  buf.append(name);
  buf.append('\0'); // separator
  buf.append(parameterCount);
  buf.append(parameterList);
  return buf.toString();
}

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

  @Override
  public void accept(CompletionProposal proposal) {
    if (elementName.equals(new String(proposal.getName()))) {
      CompletionProposal[] requiredProposals= proposal.getRequiredProposals();
      for (int i= 0; i < requiredProposals.length; i++) {
        CompletionProposal curr= requiredProposals[i];
        if (curr.getKind() == CompletionProposal.METHOD_IMPORT || curr.getKind() == CompletionProposal.FIELD_IMPORT) {
          result.add(JavaModelUtil.concatenateName(Signature.toCharArray(curr.getDeclarationSignature()), curr.getName()));
        }
      }
    }
  }
};
origin: org.eclipse.scout.sdk.deps/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 String computeSortString() {
  /*
   * Lexicographical sort order:
   * 1) by relevance (done by the proposal sorter)
   * 2) by method name
   * 3) by parameter count
   * 4) by parameter type names
   */
  char[] name= fProposal.getName();
  char[] parameterList= Signature.toCharArray(fProposal.getSignature(), null, null, false, false);
  int parameterCount= Signature.getParameterCount(fProposal.getSignature()) % 10; // we don't care about insane methods with >9 parameters
  StringBuffer buf= new StringBuffer(name.length + 2 + parameterList.length);
  buf.append(name);
  buf.append('\0'); // separator
  buf.append(parameterCount);
  buf.append(parameterList);
  return buf.toString();
}
origin: org.eclipse.recommenders.completion.rcp/subwords

public static String getTokensBetweenLastWhitespaceAndFirstOpeningBracket(final CompletionProposal proposal) {
  boolean isPotentialMethodDecl = proposal.getKind() == CompletionProposal.POTENTIAL_METHOD_DECLARATION;
  char[] token = proposal.getCompletion();
  if (Arrays.equals(token, new char[] { '(', ')' })) {
    token = proposal.getName();
  } else if (isPotentialMethodDecl && proposal.getCompletion().length == 0) {
    char[] signature = proposal.getDeclarationSignature();
    char[] typeName = Signature.getSignatureSimpleName(signature);
    return String.valueOf(typeName);
  }
  return getTokensBetweenLastWhitespaceAndFirstOpeningBracket(String.valueOf(token));
}
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.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: org.eclipse.recommenders.completion.rcp/calls

public ProposalMatcher(CompletionProposal proposal) {
  jSignature = getSignature(proposal);
  jName = valueOf(proposal.getName());
  jParams = getParameterTypes(jSignature);
  for (int i = 0; i < jParams.length; i++) {
    String param = getTypeErasure(jParams[i]);
    String paramBaseType = getElementType(param);
    param = param.replace('.', '/');
    param = StringUtils.removeEnd(param, ";");
    if (isWildcardCapture(paramBaseType) || isTypeParameter(paramBaseType)) {
      int dimensions = getArrayCount(param);
      param = StringUtils.repeat('[', dimensions) + "Ljava/lang/Object";
    }
    jParams[i] = param;
  }
}
origin: eclipse/eclipse.jdt.ls

private void appendMethodNameReplacement(StringBuilder buffer, CompletionProposal proposal) {
  if (proposal.getKind() == CompletionProposal.METHOD_REF_WITH_CASTED_RECEIVER) {
    String coreCompletion = String.valueOf(proposal.getCompletion());
    if (client.isCompletionSnippetsSupported()) {
      coreCompletion = CompletionUtils.sanitizeCompletion(coreCompletion);
    }
    //			String lineDelimiter = TextUtilities.getDefaultLineDelimiter(getTextViewer().getDocument());
    //			String replacement= CodeFormatterUtil.format(CodeFormatter.K_EXPRESSION, coreCompletion, 0, lineDelimiter, fInvocationContext.getProject());
    //			buffer.append(replacement.substring(0, replacement.lastIndexOf('.') + 1));
    buffer.append(coreCompletion);
  }
  if (proposal.getKind() != CompletionProposal.CONSTRUCTOR_INVOCATION) {
    String str = new String(proposal.getName());
    if (client.isCompletionSnippetsSupported()) {
      str = CompletionUtils.sanitizeCompletion(str);
    }
    buffer.append(str);
  }
}
origin: org.eclipse/org.eclipse.jdt.ui

public CharSequence getPrefixCompletionText(IDocument document, int completionOffset) {
  if (hasArgumentList()) {
    String completion= String.valueOf(fProposal.getName());
    if (isCamelCaseMatching()) {
      String prefix= getPrefix(document, completionOffset);
      return getCamelCaseCompound(prefix, completion);
    }
    return completion;
  }
  return super.getPrefixCompletionText(document, completionOffset);
}

origin: org.eclipse.jdt/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);
}
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);
}
origin: org.eclipse.recommenders.completion/rcp

public ProcessableOverrideCompletionProposal(CompletionProposal coreProposal, JavaCompletionProposal uiProposal,
    JavaContentAssistInvocationContext context) {
  super(context.getProject(), context.getCompilationUnit(), String.valueOf(coreProposal.getName()),
      computeParamTypes(coreProposal), coreProposal.getReplaceStart(), uiProposal.getReplacementLength(),
      uiProposal.getStyledDisplayString(), String.valueOf(coreProposal.getCompletion()));
  this.coreProposal = coreProposal;
  final Image image = uiProposal.getImage();
  setImage(image);
  setRelevance(uiProposal.getRelevance());
}
origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui

private IJavaCompletionProposal createMethodDeclarationProposal(CompletionProposal proposal) {
  if (fCompilationUnit == null || fJavaProject == null)
    return null;
  String name= String.valueOf(proposal.getName());
  String[] paramTypes= Signature.getParameterTypes(String.valueOf(proposal.getSignature()));
  for (int index= 0; index < paramTypes.length; index++)
    paramTypes[index]= Signature.toString(paramTypes[index]);
  int start= proposal.getReplaceStart();
  int length= getLength(proposal);
  StyledString label= fLabelProvider.createOverrideMethodProposalLabel(proposal);
  JavaCompletionProposal javaProposal= new OverrideCompletionProposal(fJavaProject, fCompilationUnit, name, paramTypes, start, length, label, String.valueOf(proposal.getCompletion()));
  javaProposal.setImage(getImage(fLabelProvider.createMethodImageDescriptor(proposal)));
  javaProposal.setProposalInfo(new MethodProposalInfo(fJavaProject, proposal));
  javaProposal.setRelevance(computeRelevance(proposal));
  fSuggestedMethodNames.add(new String(name));
  return javaProposal;
}
origin: org.eclipse/org.eclipse.jdt.ui

private IJavaCompletionProposal createMethodDeclarationProposal(CompletionProposal proposal) {
  if (fCompilationUnit == null || fJavaProject == null)
    return null;
  String name= String.valueOf(proposal.getName());
  String[] paramTypes= Signature.getParameterTypes(String.valueOf(proposal.getSignature()));
  for (int index= 0; index < paramTypes.length; index++)
    paramTypes[index]= Signature.toString(paramTypes[index]);
  int start= proposal.getReplaceStart();
  int length= getLength(proposal);
  String label= fLabelProvider.createOverrideMethodProposalLabel(proposal);
  JavaCompletionProposal javaProposal= new OverrideCompletionProposal(fJavaProject, fCompilationUnit, name, paramTypes, start, length, label, String.valueOf(proposal.getCompletion()));
  javaProposal.setImage(getImage(fLabelProvider.createMethodImageDescriptor(proposal)));
  javaProposal.setProposalInfo(new MethodProposalInfo(fJavaProject, proposal));
  javaProposal.setRelevance(computeRelevance(proposal));
  fSuggestedMethodNames.add(new String(name));
  return javaProposal;
}
origin: org.eclipse.jdt/org.eclipse.jdt.ui

private IJavaCompletionProposal createMethodDeclarationProposal(CompletionProposal proposal) {
  if (fCompilationUnit == null || fJavaProject == null)
    return null;
  String name= String.valueOf(proposal.getName());
  String[] paramTypes= Signature.getParameterTypes(String.valueOf(proposal.getSignature()));
  for (int index= 0; index < paramTypes.length; index++)
    paramTypes[index]= Signature.toString(paramTypes[index]);
  int start= proposal.getReplaceStart();
  int length= getLength(proposal);
  StyledString label= fLabelProvider.createOverrideMethodProposalLabel(proposal);
  JavaCompletionProposal javaProposal= new OverrideCompletionProposal(fJavaProject, fCompilationUnit, name, paramTypes, start, length, label, String.valueOf(proposal.getCompletion()));
  javaProposal.setImage(getImage(fLabelProvider.createMethodImageDescriptor(proposal)));
  javaProposal.setProposalInfo(new MethodProposalInfo(fJavaProject, proposal));
  javaProposal.setRelevance(computeRelevance(proposal));
  fSuggestedMethodNames.add(name);
  return javaProposal;
}
org.eclipse.jdt.coreCompletionProposalgetName

Javadoc

Returns the simple name of the method, field, member, or variable relevant in the context, or null if none.

This field is available for the following kinds of completion proposals:

  • ANNOTATION_ATTRIBUT_REF - the name of the attribute
  • FIELD_IMPORT - the name of the field
  • FIELD_REF - the name of the field
  • FIELD_REF_WITH_CASTED_RECEIVER - the name of the field
  • KEYWORD - the keyword
  • LABEL_REF - the name of the label
  • LOCAL_VARIABLE_REF - the name of the local variable
  • METHOD_IMPORT - the name of the method
  • METHOD_REF - the name of the method (the type simple name for constructor)
  • METHOD_REF_WITH_CASTED_RECEIVER - the name of the method
  • METHOD_DECLARATION - the name of the method (the type simple name for constructor)
  • VARIABLE_DECLARATION - the name of the variable
  • POTENTIAL_METHOD_DECLARATION - the name of the method
For kinds of completion proposals, this method returns null. Clients 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
  • 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

  • Creating JSON documents from java classes using gson
  • getSharedPreferences (Context)
  • getContentResolver (Context)
  • getResourceAsStream (ClassLoader)
  • BigDecimal (java.math)
    An immutable arbitrary-precision signed decimal.A value is represented by an arbitrary-precision "un
  • Dictionary (java.util)
    Note: Do not use this class since it is obsolete. Please use the Map interface for new implementatio
  • Iterator (java.util)
    An iterator over a sequence of objects, such as a collection.If a collection has been changed since
  • Stack (java.util)
    Stack is a Last-In/First-Out(LIFO) data structure which represents a stack of objects. It enables u
  • JarFile (java.util.jar)
    JarFile is used to read jar entries and their associated data from jar files.
  • Handler (java.util.logging)
    A Handler object accepts a logging request and exports the desired messages to a target, for example
  • Top 12 Jupyter Notebook Extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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