本文整理汇总了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;
}
示例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);
}