本文整理汇总了Java中org.eclipse.jdt.core.CompletionProposal.setDeclarationSignature方法的典型用法代码示例。如果您正苦于以下问题:Java CompletionProposal.setDeclarationSignature方法的具体用法?Java CompletionProposal.setDeclarationSignature怎么用?Java CompletionProposal.setDeclarationSignature使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jdt.core.CompletionProposal
的用法示例。
在下文中一共展示了CompletionProposal.setDeclarationSignature方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createTypeProposal
import org.eclipse.jdt.core.CompletionProposal; //导入方法依赖的package包/类
private IJavaCompletionProposal createTypeProposal(
int relevance, String fullyQualifiedType, JavaContentAssistInvocationContext context)
throws JavaModelException {
IType type = context.getCompilationUnit().getJavaProject().findType(fullyQualifiedType);
if (type == null) return null;
CompletionProposal proposal =
CompletionProposal.create(CompletionProposal.TYPE_REF, context.getInvocationOffset());
proposal.setCompletion(fullyQualifiedType.toCharArray());
proposal.setDeclarationSignature(type.getPackageFragment().getElementName().toCharArray());
proposal.setFlags(type.getFlags());
proposal.setRelevance(relevance);
proposal.setReplaceRange(context.getInvocationOffset(), context.getInvocationOffset());
proposal.setSignature(Signature.createTypeSignature(fullyQualifiedType, true).toCharArray());
if (shouldProposeGenerics(context.getProject()))
return new LazyGenericTypeProposal(proposal, context);
else return new LazyJavaTypeCompletionProposal(proposal, context);
}
示例2: createJavaCompletionProposal
import org.eclipse.jdt.core.CompletionProposal; //导入方法依赖的package包/类
@Override
protected IJavaCompletionProposal createJavaCompletionProposal(
CompletionProposal proposal) {
IJavaCompletionProposal defaultProposal = super.createJavaCompletionProposal(proposal);
// For members of inner classes, there's a bug in the JDT which results in
// the declaration signature of the proposal missing the outer classes, so
// we have to manually set the signature instead.
if (proposal.getKind() == CompletionProposal.METHOD_REF
|| proposal.getKind() == CompletionProposal.FIELD_REF) {
char[] typeSignature = Signature.createTypeSignature(qualifiedTypeName,
true).toCharArray();
proposal.setDeclarationSignature(typeSignature);
}
return JsniCompletionProposal.create(defaultProposal, proposal,
getCompilationUnit().getJavaProject(), refOffset, refLength);
}