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

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

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

origin: org.eclipse.recommenders.completion/rcp

public ProcessableGetterSetterCompletionProposal(CompletionProposal coreProposal, IField field, boolean isGetter,
    int relevance) throws JavaModelException {
  super(field, coreProposal.getReplaceStart(), coreProposal.getReplaceEnd() - coreProposal.getReplaceStart(),
      isGetter, relevance);
}
origin: eclipse/eclipse.jdt.ls

private Range toReplacementRange(CompletionProposal proposal){
  try {
    return JDTUtils.toRange(compilationUnit, proposal.getReplaceStart(), proposal.getReplaceEnd()-proposal.getReplaceStart());
  } catch (JavaModelException e) {
    JavaLanguageServerPlugin.logException(e.getMessage(), e);
  }
  return null;
}
origin: org.eclipse.jdt/org.eclipse.jdt.ui

/**
 * Gets the replacement offset.
 * @return Returns a int
 */
@Override
public final int getReplacementOffset() {
  if (!fReplacementOffsetComputed)
    setReplacementOffset(fProposal.getReplaceStart());
  return super.getReplacementOffset();
}
origin: org.eclipse.jdt/org.eclipse.jdt.ui

/**
 * Gets the replacement length.
 * @return Returns a int
 */
@Override
public final int getReplacementLength() {
  if (!fReplacementLengthComputed)
    setReplacementLength(fProposal.getReplaceEnd() - fProposal.getReplaceStart());
  return super.getReplacementLength();
}
origin: org.eclipse/org.eclipse.jdt.ui

/**
 * Gets the replacement length.
 * @return Returns a int
 */
public final int getReplacementLength() {
  if (!fReplacementLengthComputed)
    setReplacementLength(fProposal.getReplaceEnd() - fProposal.getReplaceStart());
  return super.getReplacementLength();
}
origin: org.eclipse.scout.sdk.deps/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.scout.sdk.deps/org.eclipse.jdt.ui

/**
 * Gets the replacement length.
 * @return Returns a int
 */
@Override
public final int getReplacementLength() {
  if (!fReplacementLengthComputed)
    setReplacementLength(fProposal.getReplaceEnd() - fProposal.getReplaceStart());
  return super.getReplacementLength();
}
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: 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.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
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 int getPrefixCompletionStart(IDocument document, int completionOffset) {
  CompletionProposal coreProposal= ((MemberProposalInfo)getProposalInfo()).fProposal;
  if (coreProposal.getKind() != CompletionProposal.ANONYMOUS_CLASS_CONSTRUCTOR_INVOCATION)
    return super.getPrefixCompletionStart(document, completionOffset);
  return coreProposal.getRequiredProposals()[0].getReplaceStart();
}
origin: org.eclipse.jdt/org.eclipse.jdt.ui

@Override
public int getPrefixCompletionStart(IDocument document, int completionOffset) {
  CompletionProposal coreProposal= ((MemberProposalInfo)getProposalInfo()).fProposal;
  if (coreProposal.getKind() != CompletionProposal.ANONYMOUS_CLASS_CONSTRUCTOR_INVOCATION)
    return super.getPrefixCompletionStart(document, completionOffset);
  return coreProposal.getRequiredProposals()[0].getReplaceStart();
}
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/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.jdt/org.eclipse.jdt.ui

@Override
public int getPrefixCompletionStart(IDocument document, int completionOffset) {
  if (fProposal.getKind() == CompletionProposal.METHOD_REF_WITH_CASTED_RECEIVER) {
    return fProposal.getTokenStart();
  } else if (fProposal.getKind() == CompletionProposal.CONSTRUCTOR_INVOCATION)
    return fProposal.getRequiredProposals()[0].getReplaceStart();
  return super.getPrefixCompletionStart(document, completionOffset);
}

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 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.recommenders.completion.rcp/subwords

public static SwJavaCompletionProposal createJavaCompletionProposal(final SubwordsProposalContext subwordsContext) {
  final JavaCompletionProposal jdtProposal = subwordsContext.getJdtProposal();
  final int relevance = subwordsContext.calculateRelevance();
  return new SwJavaCompletionProposal(jdtProposal.getReplacementString(), subwordsContext.getProposal()
      .getReplaceStart(), jdtProposal.getReplacementLength(), jdtProposal.getImage(),
      jdtProposal.getStyledDisplayString(), relevance, true, subwordsContext.getContext(), subwordsContext);
}
org.eclipse.jdt.coreCompletionProposalgetReplaceStart

Javadoc

Returns the character index of the start of the subrange in the source file buffer to be replaced by the completion string. If the subrange is empty (getReplaceEnd() == getReplaceStart()), the completion string is to be inserted at this index.

Note that while the token subrange is precisely specified, the replacement range is loosely constrained and may not bear any direct relation to the original request offset. For example, it would be possible for a type completion to propose inserting an import declaration at the top of the compilation unit; or the completion might include trailing parentheses and punctuation for a method completion.

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
  • 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 requests using okhttp
  • getContentResolver (Context)
  • addToBackStack (FragmentTransaction)
  • compareTo (BigDecimal)
  • GridBagLayout (java.awt)
    The GridBagLayout class is a flexible layout manager that aligns components vertically and horizonta
  • MessageFormat (java.text)
    Produces concatenated messages in language-neutral way. New code should probably use java.util.Forma
  • Comparator (java.util)
    A Comparator is used to compare two objects to determine their ordering with respect to each other.
  • Locale (java.util)
    Locale represents a language/country/variant combination. Locales are used to alter the presentatio
  • UUID (java.util)
    UUID is an immutable representation of a 128-bit universally unique identifier (UUID). There are mul
  • Base64 (org.apache.commons.codec.binary)
    Provides Base64 encoding and decoding as defined by RFC 2045.This class implements section 6.8. Base
  • Github Copilot alternatives
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