private void createAnonymousTypeLabel(CompletionProposal proposal, CompletionItem item) { char[] declaringTypeSignature= proposal.getDeclarationSignature(); declaringTypeSignature= Signature.getTypeErasure(declaringTypeSignature); String name = new String(Signature.getSignatureSimpleName(declaringTypeSignature)); item.setInsertText(name); StringBuilder buf= new StringBuilder(); buf.append(name); buf.append('('); appendUnboundedParameterList(buf, proposal); buf.append(')'); buf.append(" "); //$NON-NLS-1$ buf.append("Anonymous Inner Type"); //TODO: consider externalization item.setLabel(buf.toString()); if (proposal.getRequiredProposals() != null) { char[] signatureQualifier= Signature.getSignatureQualifier(declaringTypeSignature); if (signatureQualifier.length > 0) { item.setDetail(String.valueOf(signatureQualifier)); } } setDeclarationSignature(item, String.valueOf(declaringTypeSignature)); }
setDeclarationSignature(item, String.valueOf(declaration)); StringBuilder declBuf = new StringBuilder(); declaration= Signature.getSignatureSimpleName(declaration);
private void createOverrideMethodProposalLabel(CompletionProposal methodProposal, CompletionItem item) { StringBuilder nameBuffer= new StringBuilder(); // method name String name = new String(methodProposal.getName()); item.setInsertText(name); nameBuffer.append(name); // parameters nameBuffer.append('('); appendUnboundedParameterList(nameBuffer, methodProposal); nameBuffer.append(')'); nameBuffer.append(RETURN_TYPE_SEPARATOR); // return type // TODO remove SignatureUtil.fix83600 call when bugs are fixed char[] returnType= createTypeDisplayName(SignatureUtil.getUpperBound(Signature.getReturnType(SignatureUtil.fix83600(methodProposal.getSignature())))); nameBuffer.append(returnType); item.setLabel(nameBuffer.toString()); item.setFilterText(name); // declaring type StringBuilder typeBuffer = new StringBuilder(); String declaringType= extractDeclaringTypeFQN(methodProposal); declaringType= Signature.getSimpleName(declaringType); typeBuffer.append(String.format("Override method in '%s'", declaringType)); item.setDetail(typeBuffer.toString()); setSignature(item, String.valueOf(methodProposal.getSignature())); setDeclarationSignature(item, String.valueOf(methodProposal.getDeclarationSignature())); setName(item, String.valueOf(methodProposal.getName())); }
setDeclarationSignature(item, String.valueOf(methodProposal.getDeclarationSignature())); setName(item, String.valueOf(methodProposal.getName()));
/** * Updates a display label for a given type proposal. The display label * consists of: * <ul> * <li>the simple type name (erased when the context is in javadoc)</li> * <li>the package name</li> * </ul> * <p> * Examples: * A proposal for the generic type <code>java.util.List<E></code>, the display label * is: <code>List<E> - java.util</code>. * </p> * * @param typeProposal the method proposal to display * @param item the completion to update */ private void createTypeProposalLabel(CompletionProposal typeProposal, CompletionItem item) { char[] signature; if (fContext != null && fContext.isInJavadoc()) { signature= Signature.getTypeErasure(typeProposal.getSignature()); } else { signature= typeProposal.getSignature(); } char[] fullName= Signature.toCharArray(signature); createTypeProposalLabel(fullName, item); setDeclarationSignature(item, String.valueOf(signature)); }