use of org.eclipse.jface.viewers.StyledString in project che by eclipse.
the class CompletionProposalCollector method createMethodDeclarationProposal.
private IJavaCompletionProposal createMethodDeclarationProposal(CompletionProposal proposal) {
if (fCompilationUnit == null || fJavaProject == null)
return null;
String name = String.valueOf(proposal.getName());
String[] paramTypes = Signature.getParameterTypes(String.valueOf(proposal.getSignature()));
for (int index = 0; index < paramTypes.length; index++) paramTypes[index] = Signature.toString(paramTypes[index]);
int start = proposal.getReplaceStart();
int length = getLength(proposal);
StyledString label = fLabelProvider.createOverrideMethodProposalLabel(proposal);
JavaCompletionProposal javaProposal = new OverrideCompletionProposal(fJavaProject, fCompilationUnit, name, paramTypes, start, length, label, String.valueOf(proposal.getCompletion()));
javaProposal.setImage(getImage(fLabelProvider.createMethodImageDescriptor(proposal)));
javaProposal.setProposalInfo(new MethodProposalInfo(fJavaProject, proposal));
javaProposal.setRelevance(computeRelevance(proposal));
fSuggestedMethodNames.add(new String(name));
return javaProposal;
}
use of org.eclipse.jface.viewers.StyledString in project che by eclipse.
the class CompletionProposalCollector method createFieldProposal.
private IJavaCompletionProposal createFieldProposal(CompletionProposal proposal) {
String completion = String.valueOf(proposal.getCompletion());
int start = proposal.getReplaceStart();
int length = getLength(proposal);
StyledString label = fLabelProvider.createStyledLabel(proposal);
Image image = getImage(fLabelProvider.createFieldImageDescriptor(proposal));
int relevance = computeRelevance(proposal);
JavaCompletionProposal javaProposal = new JavaCompletionProposal(completion, start, length, image, label, relevance, getContext().isInJavadoc(), getInvocationContext());
if (fJavaProject != null)
javaProposal.setProposalInfo(new FieldProposalInfo(fJavaProject, proposal));
javaProposal.setTriggerCharacters(VAR_TRIGGER);
return javaProposal;
}
use of org.eclipse.jface.viewers.StyledString in project che by eclipse.
the class CompletionProposalCollector method createLabelProposal.
private IJavaCompletionProposal createLabelProposal(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);
}
use of org.eclipse.jface.viewers.StyledString in project che by eclipse.
the class CompletionProposalCollector method createKeywordProposal.
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);
}
use of org.eclipse.jface.viewers.StyledString in project che by eclipse.
the class CompletionProposalLabelProvider method createSimpleLabelWithType.
StyledString createSimpleLabelWithType(CompletionProposal proposal) {
StyledString buf = new StyledString();
buf.append(proposal.getCompletion());
char[] typeName = Signature.getSignatureSimpleName(proposal.getSignature());
if (typeName.length > 0) {
buf.append(VAR_TYPE_SEPARATOR);
buf.append(typeName);
}
return Strings.markJavaElementLabelLTR(buf);
}
Aggregations