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

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

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

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

/**
 * Extracts the fully qualified name of the declaring type of a method
 * reference.
 *
 * @param methodProposal a proposed method
 * @return the qualified name of the declaring type
 */
private String extractDeclaringTypeFQN(CompletionProposal methodProposal) {
  char[] declaringTypeSignature= methodProposal.getDeclarationSignature();
  // special methods may not have a declaring type: methods defined on arrays etc.
  // TODO remove when bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=84690 gets fixed
  if (declaringTypeSignature == null)
    return "java.lang.Object"; //$NON-NLS-1$
  return SignatureUtil.stripSignatureToFQN(String.valueOf(declaringTypeSignature));
}
origin: org.eclipse.jdt/org.eclipse.jdt.ui

/**
 * Resolves to an IModuleDescription.
 * 
 * @return the <code>IModuleDescription</code> or <code>null</code> if no Java element can be found
 * @throws JavaModelException thrown if the given path is <code>null</code> or absolute
 */
private IJavaElement resolveModule() throws JavaModelException {
  char[] signature= fProposal.getDeclarationSignature();
  if (signature != null) {
    String typeName= String.valueOf(signature);
    return fJavaProject.findModule(typeName, null);
  }
  return null;
}
origin: org.eclipse/org.eclipse.jdt.ui

String createAnonymousTypeLabel(CompletionProposal proposal) {
  char[] declaringTypeSignature= proposal.getDeclarationSignature();
  StringBuffer buffer= new StringBuffer();
  buffer.append(Signature.getSignatureSimpleName(declaringTypeSignature));
  buffer.append('(');
  appendUnboundedParameterList(buffer, proposal);
  buffer.append(')');
  buffer.append("  "); //$NON-NLS-1$
  buffer.append(JavaTextMessages.ResultCollector_anonymous_type);
  return buffer.toString();
}
origin: org.eclipse/org.eclipse.jdt.ui

String createPackageProposalLabel(CompletionProposal proposal) {
  Assert.isTrue(proposal.getKind() == CompletionProposal.PACKAGE_REF);
  return String.valueOf(proposal.getDeclarationSignature());
}
origin: org.eclipse/org.eclipse.jdt.ui

  /**
   * Resolves the member described by the receiver and returns it if found.
   * Returns <code>null</code> if no corresponding member can be found.
   *
   * @return the resolved member or <code>null</code> if none is found
   * @throws JavaModelException if accessing the java model fails
   */
  protected IMember resolveMember() throws JavaModelException {
    char[] signature= fProposal.getDeclarationSignature();
    String typeName= SignatureUtil.stripSignatureToFQN(String.valueOf(signature));
    return fJavaProject.findType(typeName);
  }
}
origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui

/**
 * Extracts the fully qualified name of the declaring type of a method
 * reference.
 *
 * @param methodProposal a proposed method
 * @return the qualified name of the declaring type
 */
private String extractDeclaringTypeFQN(CompletionProposal methodProposal) {
  char[] declaringTypeSignature= methodProposal.getDeclarationSignature();
  // special methods may not have a declaring type: methods defined on arrays etc.
  // TODO remove when bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=84690 gets fixed
  if (declaringTypeSignature == null)
    return "java.lang.Object"; //$NON-NLS-1$
  return Signature.toString(Signature.getTypeErasure(String.valueOf(declaringTypeSignature)));
}
origin: org.eclipse.jdt/org.eclipse.jdt.ui

  /**
   * Resolves the member described by the receiver and returns it if found.
   * Returns <code>null</code> if no corresponding member can be found.
   *
   * @return the resolved member or <code>null</code> if none is found
   * @throws JavaModelException if accessing the java model fails
   */
  @Override
  protected IMember resolveMember() throws JavaModelException {
    char[] signature= fProposal.getDeclarationSignature();
    String typeName= SignatureUtil.stripSignatureToFQN(String.valueOf(signature));
    return fJavaProject.findType(typeName);
  }
}
origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui

  /**
   * Resolves the member described by the receiver and returns it if found.
   * Returns <code>null</code> if no corresponding member can be found.
   *
   * @return the resolved member or <code>null</code> if none is found
   * @throws JavaModelException if accessing the java model fails
   */
  @Override
  protected IMember resolveMember() throws JavaModelException {
    char[] signature= fProposal.getDeclarationSignature();
    String typeName= SignatureUtil.stripSignatureToFQN(String.valueOf(signature));
    return fJavaProject.findType(typeName);
  }
}
origin: org.eclipse/org.eclipse.jdt.ui

protected boolean isValidPrefix(String prefix) {
  if (super.isValidPrefix(prefix))
    return true;
  
  if (fProposal.getKind() == CompletionProposal.METHOD_NAME_REFERENCE) {
    // static imports - includes package & type name
    StringBuffer buf= new StringBuffer();
    buf.append(Signature.toCharArray(fProposal.getDeclarationSignature()));
    buf.append('.');
    buf.append(getDisplayString());
    return isPrefix(prefix, buf.toString());
  }
  
  return false;
}

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.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.scout.sdk.deps/org.eclipse.jdt.ui

StyledString createPackageProposalLabel(CompletionProposal proposal) {
  Assert.isTrue(proposal.getKind() == CompletionProposal.PACKAGE_REF);
  return Strings.markJavaElementLabelLTR(new StyledString(String.valueOf(proposal.getDeclarationSignature())));
}
origin: org.eclipse.jdt/org.eclipse.jdt.ui

StyledString createPackageProposalLabel(CompletionProposal proposal) {
  Assert.isTrue(proposal.getKind() == CompletionProposal.PACKAGE_REF);
  return Strings.markJavaElementLabelLTR(new StyledString(String.valueOf(proposal.getDeclarationSignature())));
}
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.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.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: eclipse/eclipse.jdt.ls

private void createPackageProposalLabel(CompletionProposal proposal, CompletionItem item) {
  Assert.isTrue(proposal.getKind() == CompletionProposal.PACKAGE_REF || proposal.getKind() == CompletionProposal.MODULE_REF || proposal.getKind() == CompletionProposal.MODULE_DECLARATION);
  item.setLabel(String.valueOf(proposal.getDeclarationSignature()));
}
origin: org.eclipse/org.eclipse.jdt.ui

private IJavaCompletionProposal createAnonymousTypeProposal(CompletionProposal proposal) {
  if (fCompilationUnit == null || fJavaProject == null)
    return null;
  String completion= String.valueOf(proposal.getCompletion());
  int start= proposal.getReplaceStart();
  int length= getLength(proposal);
  int relevance= computeRelevance(proposal);
  String label= fLabelProvider.createAnonymousTypeLabel(proposal);
  JavaCompletionProposal javaProposal= new AnonymousTypeCompletionProposal(fJavaProject, fCompilationUnit, start, length, completion, label, String.valueOf(proposal.getDeclarationSignature()), relevance);
  javaProposal.setProposalInfo(new AnonymousTypeProposalInfo(fJavaProject, proposal));
  return javaProposal;
}
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.recommenders.completion.rcp/subwords

public static SwAnonymousTypeCompletionProposal createAnonymousTypeCompletionProposal(
    final SubwordsProposalContext subwordsContext) throws JavaModelException {
  final JavaContentAssistInvocationContext context = subwordsContext.getContext();
  final CompletionProposal proposal = subwordsContext.getProposal();
  final JavaCompletionProposal jdtProposal = subwordsContext.getJdtProposal();
  final IJavaProject project = context.getProject();
  final String declarationSignature = String.valueOf(proposal.getDeclarationSignature());
  final String declarationKey = String.valueOf(proposal.getDeclarationKey());
  final String completionText = String.valueOf(proposal.getCompletion());
  return new SwAnonymousTypeCompletionProposal(project, context.getCompilationUnit(), context,
      proposal.getReplaceStart(), jdtProposal.getReplacementLength(), completionText,
      jdtProposal.getStyledDisplayString(), declarationSignature, (IType) project.findElement(declarationKey,
          null), jdtProposal.getRelevance(), subwordsContext);
}
org.eclipse.jdt.coreCompletionProposalgetDeclarationSignature

Javadoc

Returns the type signature or package name of the relevant declaration in the context, or null if none.

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

  • ANNOTATION_ATTRIBUT_REF - type signature of the annotation that declares the attribute that is referenced
  • ANONYMOUS_CLASS_DECLARATION - type signature of the type that is being subclassed or implemented
  • FIELD_IMPORT - type signature of the type that declares the field that is imported
  • FIELD_REF - type signature of the type that declares the field that is referenced
  • FIELD_REF_WITH_CASTED_RECEIVER - type signature of the type that declares the field that is referenced
  • METHOD_IMPORT - type signature of the type that declares the method that is imported
  • METHOD_REF - type signature of the type that declares the method that is referenced
  • METHOD_REF_WITH_CASTED_RECEIVER - type signature of the type that declares the method that is referenced
  • METHOD_DECLARATION - type signature of the type that declares the method that is being implemented or overridden
  • PACKAGE_REF - dot-based package name of the package that is referenced
  • TYPE_IMPORT - dot-based package name of the package containing the type that is imported
  • TYPE_REF - dot-based package name of the package containing the type that is referenced
  • POTENTIAL_METHOD_DECLARATION - type signature of the type that declares the method that is being created
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
  • 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
  • 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

  • Making http post requests using okhttp
  • getExternalFilesDir (Context)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • setContentView (Activity)
  • BufferedInputStream (java.io)
    A BufferedInputStream adds functionality to another input stream-namely, the ability to buffer the i
  • BigInteger (java.math)
    An immutable arbitrary-precision signed integer.FAST CRYPTOGRAPHY This implementation is efficient f
  • Enumeration (java.util)
    A legacy iteration interface.New code should use Iterator instead. Iterator replaces the enumeration
  • ExecutorService (java.util.concurrent)
    An Executor that provides methods to manage termination and methods that can produce a Future for tr
  • LogFactory (org.apache.commons.logging)
    Factory for creating Log instances, with discovery and configuration features similar to that employ
  • Project (org.apache.tools.ant)
    Central representation of an Ant project. This class defines an Ant project with all of its targets,
  • Top PhpStorm 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