/** * Returns a label for Java element name. Example is 'new Test<? extends List>() { ...}'. * This method should only be used for simple element names. Use * {@link JavaElementLabels} to create a label from a Java element or {@link BindingLabelProvider} * for labels of bindings. * * @param name the Java element name. * @return the label for the Java element */ public static String getJavaElementName(String name) { return Strings.markJavaElementLabelLTR(name); }
/** * Returns the label for a Java element with the flags as defined by this class. * * @param element the element to render * @param flags the rendering flags * @return the label of the Java element */ public static String getElementLabel(IJavaElement element, long flags) { StringBuffer result= new StringBuffer(); getElementLabel(element, flags, result); return Strings.markJavaElementLabelLTR(result.toString()); }
private String computeContextString(LazyGenericTypeProposal proposal) { try { TypeArgumentProposal[] proposals= proposal.computeTypeArgumentProposals(); if (proposals.length == 0) return null; StringBuffer buf= new StringBuffer(); for (int i= 0; i < proposals.length; i++) { buf.append(proposals[i].getDisplayName()); if (i < proposals.length - 1) buf.append(", "); //$NON-NLS-1$ } return Strings.markJavaElementLabelLTR(buf.toString()); } catch (JavaModelException e) { return null; } }
private String computeContextString(final ProcessableLazyGenericTypeProposal proposal) { try { final TypeArgumentProposal[] proposals = proposal.computeTypeArgumentProposals(); if (proposals.length == 0) { return null; } final StringBuffer buf = new StringBuffer(); for (int i = 0; i < proposals.length; i++) { buf.append(proposals[i].getDisplayName()); if (i < proposals.length - 1) { buf.append(", "); //$NON-NLS-1$ } } return Strings.markJavaElementLabelLTR(buf.toString()); } catch (final JavaModelException e) { return null; } }
private String computeContextString(final SwLazyGenericTypeProposal proposal) { try { final TypeArgumentProposal[] proposals = proposal.computeTypeArgumentProposals(); if (proposals.length == 0) { return null; } final StringBuffer buf = new StringBuffer(); for (int i = 0; i < proposals.length; i++) { buf.append(proposals[i].getDisplayName()); if (i < proposals.length - 1) { buf.append(", "); //$NON-NLS-1$ } } return Strings.markJavaElementLabelLTR(buf.toString()); } catch (final JavaModelException e) { return null; } }
StyledString createSimpleLabel(CompletionProposal proposal) { return Strings.markJavaElementLabelLTR(new StyledString(String.valueOf(proposal.getCompletion()))); }
StyledString createSimpleLabel(CompletionProposal proposal) { return Strings.markJavaElementLabelLTR(new StyledString(String.valueOf(proposal.getCompletion()))); }
/** * Returns the styled label for a Java element with the flags as defined by this class. * * @param element the element to render * @param flags the rendering flags * @return the label of the Java element * * @since 3.4 */ public static StyledString getStyledElementLabel(IJavaElement element, long flags) { StyledString result= new StyledString(); getElementLabel(element, flags, result); return Strings.markJavaElementLabelLTR(result); }
/** * Returns the styled label for a Java element with the flags as defined by this class. * * @param element the element to render * @param flags the rendering flags * @return the label of the Java element * * @since 3.4 */ public static StyledString getStyledElementLabel(IJavaElement element, long flags) { StyledString result= new StyledString(); getElementLabel(element, flags, result); return Strings.markJavaElementLabelLTR(result); }
StyledString createModuleProposalLabel(CompletionProposal proposal) { int kind= proposal.getKind(); Assert.isTrue(kind == CompletionProposal.MODULE_REF || kind == CompletionProposal.MODULE_DECLARATION); char[] label= proposal.getDeclarationSignature(); Assert.isNotNull(label); return Strings.markJavaElementLabelLTR(new StyledString(String.valueOf(label))); }
StyledString createTypeProposalLabel(char[] fullName) { // only display innermost type name as type name, using any // enclosing types as qualification int qIndex= findSimpleNameStart(fullName); StyledString buf= new StyledString(); buf.append(new String(fullName, qIndex, fullName.length - qIndex)); if (qIndex > 0) { buf.append(JavaElementLabels.CONCAT_STRING, StyledString.QUALIFIER_STYLER); buf.append(new String(fullName, 0, qIndex - 1), StyledString.QUALIFIER_STYLER); } return Strings.markJavaElementLabelLTR(buf); }
StyledString createTypeProposalLabel(char[] fullName) { // only display innermost type name as type name, using any // enclosing types as qualification int qIndex= findSimpleNameStart(fullName); StyledString buf= new StyledString(); buf.append(new String(fullName, qIndex, fullName.length - qIndex)); if (qIndex > 0) { buf.append(JavaElementLabels.CONCAT_STRING, StyledString.QUALIFIER_STYLER); buf.append(new String(fullName, 0, qIndex - 1), StyledString.QUALIFIER_STYLER); } return org.eclipse.jdt.internal.corext.util.Strings.markJavaElementLabelLTR(buf); }
StyledString createPackageProposalLabel(CompletionProposal proposal) { Assert.isTrue(proposal.getKind() == CompletionProposal.PACKAGE_REF); return Strings.markJavaElementLabelLTR(new StyledString(String.valueOf(proposal.getDeclarationSignature()))); }
StyledString createPackageProposalLabel(CompletionProposal proposal) { Assert.isTrue(proposal.getKind() == CompletionProposal.PACKAGE_REF); return Strings.markJavaElementLabelLTR(new StyledString(String.valueOf(proposal.getDeclarationSignature()))); }
StyledString createJavadocTypeProposalLabel(char[] fullName) { // only display innermost type name as type name, using any // enclosing types as qualification int qIndex= findSimpleNameStart(fullName); StyledString buf= new StyledString("{@link "); //$NON-NLS-1$ buf.append(new String(fullName, qIndex, fullName.length - qIndex)); buf.append('}'); if (qIndex > 0) { buf.append(JavaElementLabels.CONCAT_STRING, StyledString.QUALIFIER_STYLER); buf.append(new String(fullName, 0, qIndex - 1), StyledString.QUALIFIER_STYLER); } return Strings.markJavaElementLabelLTR(buf); }
StyledString createJavadocTypeProposalLabel(char[] fullName) { // only display innermost type name as type name, using any // enclosing types as qualification int qIndex= findSimpleNameStart(fullName); StyledString buf= new StyledString("{@link "); //$NON-NLS-1$ buf.append(new String(fullName, qIndex, fullName.length - qIndex)); buf.append('}'); if (qIndex > 0) { buf.append(JavaElementLabels.CONCAT_STRING, StyledString.QUALIFIER_STYLER); buf.append(new String(fullName, 0, qIndex - 1), StyledString.QUALIFIER_STYLER); } return org.eclipse.jdt.internal.corext.util.Strings.markJavaElementLabelLTR(buf); }
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); }
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); }
StyledString createAnonymousTypeLabel(CompletionProposal proposal) { char[] declaringTypeSignature= proposal.getDeclarationSignature(); declaringTypeSignature= Signature.getTypeErasure(declaringTypeSignature); StyledString buffer= new StyledString(); buffer.append(Signature.getSignatureSimpleName(declaringTypeSignature)); buffer.append('('); appendUnboundedParameterList(buffer, proposal); buffer.append(')'); buffer.append(" "); //$NON-NLS-1$ buffer.append(JavaTextMessages.ResultCollector_anonymous_type); if (proposal.getRequiredProposals() != null) { char[] signatureQualifier= Signature.getSignatureQualifier(declaringTypeSignature); if (signatureQualifier.length > 0) { buffer.append(JavaElementLabels.CONCAT_STRING, StyledString.QUALIFIER_STYLER); buffer.append(signatureQualifier, StyledString.QUALIFIER_STYLER); } } return Strings.markJavaElementLabelLTR(buffer); }
StyledString createAnonymousTypeLabel(CompletionProposal proposal) { char[] declaringTypeSignature= proposal.getDeclarationSignature(); declaringTypeSignature= Signature.getTypeErasure(declaringTypeSignature); StyledString buffer= new StyledString(); buffer.append(Signature.getSignatureSimpleName(declaringTypeSignature)); buffer.append('('); appendUnboundedParameterList(buffer, proposal); buffer.append(')'); buffer.append(" "); //$NON-NLS-1$ buffer.append(JavaTextMessages.ResultCollector_anonymous_type); if (proposal.getRequiredProposals() != null) { char[] signatureQualifier= Signature.getSignatureQualifier(declaringTypeSignature); if (signatureQualifier.length > 0) { buffer.append(JavaElementLabels.CONCAT_STRING, StyledString.QUALIFIER_STYLER); buffer.append(signatureQualifier, StyledString.QUALIFIER_STYLER); } } return Strings.markJavaElementLabelLTR(buffer); }