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

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

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

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

/**
 * Returns the replacement length of a given completion proposal. The
 * replacement length is usually the difference between the return values of
 * <code>proposal.getReplaceEnd</code> and
 * <code>proposal.getReplaceStart</code>, but this behavior may be
 * overridden by calling {@link #setReplacementLength(int)}.
 *
 * @param proposal the completion proposal to get the replacement length for
 * @return the replacement length for <code>proposal</code>
 */
protected final int getLength(CompletionProposal proposal) {
  int start= proposal.getReplaceStart();
  int end= proposal.getReplaceEnd();
  int length;
  if (fUserReplacementLength == -1) {
    length= end - start;
  } else {
    length= fUserReplacementLength;
    // extend length to begin at start
    int behindCompletion= proposal.getCompletionLocation() + 1;
    if (start < behindCompletion) {
      length+= behindCompletion - start;
    }
  }
  return length;
}
origin: org.eclipse.jdt/org.eclipse.jdt.ui

/**
 * Returns the replacement length of a given completion proposal. The
 * replacement length is usually the difference between the return values of
 * <code>proposal.getReplaceEnd</code> and
 * <code>proposal.getReplaceStart</code>, but this behavior may be
 * overridden by calling {@link #setReplacementLength(int)}.
 *
 * @param proposal the completion proposal to get the replacement length for
 * @return the replacement length for <code>proposal</code>
 */
protected final int getLength(CompletionProposal proposal) {
  int start= proposal.getReplaceStart();
  int end= proposal.getReplaceEnd();
  int length;
  if (fUserReplacementLength == -1) {
    length= end - start;
  } else {
    length= fUserReplacementLength;
    // extend length to begin at start
    int behindCompletion= proposal.getCompletionLocation() + 1;
    if (start < behindCompletion) {
      length+= behindCompletion - start;
    }
  }
  return length;
}
origin: org.eclipse/org.eclipse.jdt.ui

/**
 * Returns the replacement length of a given completion proposal. The
 * replacement length is usually the difference between the return values of
 * <code>proposal.getReplaceEnd</code> and
 * <code>proposal.getReplaceStart</code>, but this behavior may be
 * overridden by calling {@link #setReplacementLength(int)}.
 *
 * @param proposal the completion proposal to get the replacement length for
 * @return the replacement length for <code>proposal</code>
 */
protected final int getLength(CompletionProposal proposal) {
  int start= proposal.getReplaceStart();
  int end= proposal.getReplaceEnd();
  int length;
  if (fUserReplacementLength == -1) {
    length= end - start;
  } else {
    length= fUserReplacementLength;
    // extend length to begin at start
    int behindCompletion= proposal.getCompletionLocation() + 1;
    if (start < behindCompletion) {
      length+= behindCompletion - start;
    }
  }
  return length;
}
origin: org.eclipse.jdt/org.eclipse.jdt.core

buffer.append("\tCompletionLocation[").append(proposal.getCompletionLocation()).append("]\n"); //$NON-NLS-1$ //$NON-NLS-2$
int start = proposal.getReplaceStart();
int end = proposal.getReplaceEnd();
origin: com.google.code.maven-play-plugin.org.eclipse.jdt/org.eclipse.jdt.core

buffer.append("\tCompletionLocation[").append(proposal.getCompletionLocation()).append("]\n"); //$NON-NLS-1$ //$NON-NLS-2$
int start = proposal.getReplaceStart();
int end = proposal.getReplaceEnd();
origin: org.eclipse.tycho/org.eclipse.jdt.core

buffer.append("\tCompletionLocation[").append(proposal.getCompletionLocation()).append("]\n"); //$NON-NLS-1$ //$NON-NLS-2$
int start = proposal.getReplaceStart();
int end = proposal.getReplaceEnd();
origin: org.jibx.config.3rdparty.org.eclipse/org.eclipse.jdt.core

buffer.append("\tCompletionLocation[").append(proposal.getCompletionLocation()).append("]\n"); //$NON-NLS-1$ //$NON-NLS-2$
int start = proposal.getReplaceStart();
int end = proposal.getReplaceEnd();
origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.core

buffer.append("\tCompletionLocation[").append(proposal.getCompletionLocation()).append("]\n"); //$NON-NLS-1$ //$NON-NLS-2$
int start = proposal.getReplaceStart();
int end = proposal.getReplaceEnd();
origin: trylimits/Eclipse-Postfix-Code-Completion

buffer.append("\tCompletionLocation[").append(proposal.getCompletionLocation()).append("]\n"); //$NON-NLS-1$ //$NON-NLS-2$
int start = proposal.getReplaceStart();
int end = proposal.getReplaceEnd();
origin: org.eclipse/org.eclipse.jdt.ui

JavaModelUtil.reconcile(cu);
String[][] parameterTypes= getParameterSignatures();
ParameterGuesser guesser= new ParameterGuesser(fProposal.getCompletionLocation() + 1, cu);
origin: org.eclipse/org.eclipse.jdt.ui

private void acceptPotentialMethodDeclaration(CompletionProposal proposal) {
  if (fCompilationUnit == null)
    return;
  String prefix= String.valueOf(proposal.getName());
  int completionStart= proposal.getReplaceStart();
  int completionEnd= proposal.getReplaceEnd();
  int relevance= computeRelevance(proposal);
  try {
    IJavaElement element= fCompilationUnit.getElementAt(proposal.getCompletionLocation() + 1);
    if (element != null) {
      IType type= (IType) element.getAncestor(IJavaElement.TYPE);
      if (type != null) {
        GetterSetterCompletionProposal.evaluateProposals(type, prefix, completionStart, completionEnd - completionStart, relevance + 1, fSuggestedMethodNames, fJavaProposals);
        MethodDeclarationCompletionProposal.evaluateProposals(type, prefix, completionStart, completionEnd - completionStart, relevance, fSuggestedMethodNames, fJavaProposals);
      }
    }
  } catch (CoreException e) {
    JavaPlugin.log(e);
  }
}
origin: org.eclipse.jdt/org.eclipse.jdt.ui

/**
 * Creates a new context information.
 *
 * @param proposal the JDT Core completion proposal
 */
public ProposalContextInformation(CompletionProposal proposal) {
  // don't cache the core proposal because the ContentAssistant might
  // hang on to the context info.
  CompletionProposalLabelProvider labelProvider= new CompletionProposalLabelProvider();
  fInformationDisplayString= labelProvider.createParameterList(proposal);
  ImageDescriptor descriptor= labelProvider.createImageDescriptor(proposal);
  if (descriptor != null)
    fImage= JavaPlugin.getImageDescriptorRegistry().get(descriptor);
  else
    fImage= null;
  if (proposal.getCompletion().length == 0)
    fPosition= proposal.getCompletionLocation() + 1;
  else
    fPosition= -1;
  fContextDisplayString= labelProvider.createLabel(proposal);
}
origin: org.eclipse/org.eclipse.jdt.ui

/**
 * Creates a new context information.
 */
public ProposalContextInformation(CompletionProposal proposal) {
  // don't cache the core proposal because the ContentAssistant might
  // hang on to the context info.
  CompletionProposalLabelProvider labelProvider= new CompletionProposalLabelProvider();
  fInformationDisplayString= labelProvider.createParameterList(proposal);
  ImageDescriptor descriptor= labelProvider.createImageDescriptor(proposal);
  if (descriptor != null)
    fImage= JavaPlugin.getImageDescriptorRegistry().get(descriptor);
  else
    fImage= null;
  if (proposal.getCompletion().length == 0)
    fPosition= proposal.getCompletionLocation() + 1;
  else
    fPosition= -1;
  fContextDisplayString= labelProvider.createLabel(proposal);
}
origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui

/**
 * Creates a new context information.
 *
 * @param proposal the JDT Core completion proposal
 */
public ProposalContextInformation(CompletionProposal proposal) {
  // don't cache the core proposal because the ContentAssistant might
  // hang on to the context info.
  CompletionProposalLabelProvider labelProvider= new CompletionProposalLabelProvider();
  fInformationDisplayString= labelProvider.createParameterList(proposal);
  ImageDescriptor descriptor= labelProvider.createImageDescriptor(proposal);
  if (descriptor != null)
    fImage= JavaPlugin.getImageDescriptorRegistry().get(descriptor);
  else
    fImage= null;
  if (proposal.getCompletion().length == 0)
    fPosition= proposal.getCompletionLocation() + 1;
  else
    fPosition= -1;
  fContextDisplayString= labelProvider.createLabel(proposal);
}
origin: eclipse/eclipse.jdt.ls

private void acceptPotentialMethodDeclaration(CompletionProposal proposal) {
  try {
    IJavaElement enclosingElement = null;
    if (response.getContext().isExtended()) {
      enclosingElement = response.getContext().getEnclosingElement();
    } else if (unit != null) {
      // kept for backward compatibility: CU is not reconciled at this moment, information is missing (bug 70005)
      enclosingElement = unit.getElementAt(proposal.getCompletionLocation() + 1);
    }
    if (enclosingElement == null) {
      return;
    }
    IType type = (IType) enclosingElement.getAncestor(IJavaElement.TYPE);
    if (type != null) {
      String prefix = String.valueOf(proposal.getName());
      int completionStart = proposal.getReplaceStart();
      int completionEnd = proposal.getReplaceEnd();
      int relevance = proposal.getRelevance() + 6;
      GetterSetterCompletionProposal.evaluateProposals(type, prefix, completionStart, completionEnd - completionStart, relevance, proposals);
    }
  } catch (CoreException e) {
    JavaLanguageServerPlugin.logException("Accept potential method declaration failed for completion ", e);
  }
}
origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui

private void acceptPotentialMethodDeclaration(CompletionProposal proposal) {
  try {
    IJavaElement enclosingElement= null;
    if (getContext().isExtended()) {
      enclosingElement= getContext().getEnclosingElement();
    } else if (fCompilationUnit != null) {
      // kept for backward compatibility: CU is not reconciled at this moment, information is missing (bug 70005)
      enclosingElement= fCompilationUnit.getElementAt(proposal.getCompletionLocation() + 1);
    }
    if (enclosingElement == null)
      return;
    IType type= (IType) enclosingElement.getAncestor(IJavaElement.TYPE);
    if (type != null) {
      String prefix= String.valueOf(proposal.getName());
      int completionStart= proposal.getReplaceStart();
      int completionEnd= proposal.getReplaceEnd();
      int relevance= computeRelevance(proposal);
      GetterSetterCompletionProposal.evaluateProposals(type, prefix, completionStart, completionEnd - completionStart, relevance + 2, fSuggestedMethodNames, fJavaProposals);
      MethodDeclarationCompletionProposal.evaluateProposals(type, prefix, completionStart, completionEnd - completionStart, relevance, fSuggestedMethodNames, fJavaProposals);
    }
  } catch (CoreException e) {
    JavaPlugin.log(e);
  }
}
origin: org.eclipse.jdt/org.eclipse.jdt.ui

private void acceptPotentialMethodDeclaration(CompletionProposal proposal) {
  try {
    IJavaElement enclosingElement= null;
    if (getContext().isExtended()) {
      enclosingElement= getContext().getEnclosingElement();
    } else if (fCompilationUnit != null) {
      // kept for backward compatibility: CU is not reconciled at this moment, information is missing (bug 70005)
      enclosingElement= fCompilationUnit.getElementAt(proposal.getCompletionLocation() + 1);
    }
    if (enclosingElement == null)
      return;
    IType type= (IType) enclosingElement.getAncestor(IJavaElement.TYPE);
    if (type != null) {
      String prefix= String.valueOf(proposal.getName());
      int completionStart= proposal.getReplaceStart();
      int completionEnd= proposal.getReplaceEnd();
      int relevance= computeRelevance(proposal);
      GetterSetterCompletionProposal.evaluateProposals(type, prefix, completionStart, completionEnd - completionStart, relevance + 2, fSuggestedMethodNames, fJavaProposals);
      MethodDeclarationCompletionProposal.evaluateProposals(type, prefix, completionStart, completionEnd - completionStart, relevance, fSuggestedMethodNames, fJavaProposals);
    }
  } catch (CoreException e) {
    JavaPlugin.log(e);
  }
}
org.eclipse.jdt.coreCompletionProposalgetCompletionLocation

Javadoc

Returns the character index in the source file buffer where source completion was requested (the offset parameter to ICodeAssist.codeComplete minus one).

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
  • 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
  • getFlags
    Returns the modifier flags relevant in the context, orFlags.AccDefault if none. This field is avail
  • getReplaceEnd,
  • getFlags,
  • getRequiredProposals,
  • setCompletion,
  • setDeclarationSignature,
  • setRelevance,
  • setReplaceRange,
  • setSignature,
  • setFlags

Popular in Java

  • Updating database using SQL prepared statement
  • getSharedPreferences (Context)
  • onRequestPermissionsResult (Fragment)
  • runOnUiThread (Activity)
  • File (java.io)
    An "abstract" representation of a file system entity identified by a pathname. The pathname may be a
  • FileOutputStream (java.io)
    An output stream that writes bytes to a file. If the output file exists, it can be replaced or appen
  • InetAddress (java.net)
    An Internet Protocol (IP) address. This can be either an IPv4 address or an IPv6 address, and in pra
  • URLEncoder (java.net)
    This class is used to encode a string using the format required by application/x-www-form-urlencoded
  • TreeSet (java.util)
    TreeSet is an implementation of SortedSet. All optional operations (adding and removing) are support
  • CountDownLatch (java.util.concurrent)
    A synchronization aid that allows one or more threads to wait until a set of operations being perfor
  • Top plugins for WebStorm
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