当前位置: 首页>>代码示例>>Java>>正文


Java CompletionProposal.getCompletionLocation方法代码示例

本文整理汇总了Java中org.eclipse.jdt.core.CompletionProposal.getCompletionLocation方法的典型用法代码示例。如果您正苦于以下问题:Java CompletionProposal.getCompletionLocation方法的具体用法?Java CompletionProposal.getCompletionLocation怎么用?Java CompletionProposal.getCompletionLocation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.jdt.core.CompletionProposal的用法示例。


在下文中一共展示了CompletionProposal.getCompletionLocation方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getLength

import org.eclipse.jdt.core.CompletionProposal; //导入方法依赖的package包/类
/**
 * 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;
}
 
开发者ID:eclipse,项目名称:che,代码行数:26,代码来源:CompletionProposalCollector.java

示例2: ProposalContextInformation

import org.eclipse.jdt.core.CompletionProposal; //导入方法依赖的package包/类
/**
 * 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);
}
 
开发者ID:eclipse,项目名称:che,代码行数:18,代码来源:ProposalContextInformation.java


注:本文中的org.eclipse.jdt.core.CompletionProposal.getCompletionLocation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。